[sbt] Scala continuations plugin with SBT?

Showing 1-7 of 7 messages
[sbt] Scala continuations plugin with SBT? Oliver Schulz 4/25/10 6:34 AM
Does anyone know how to enable the continuations compiler plugin included with
recent Scala versions (> 2.8.0.RC1) in SBT?

It's usually enabled with

    scala -P:continuations:enable

resp.

    scalac -P:continuations:enable

However

    override def compileOptions = super.compileOptions ++ Seq(CompileOption("-P:continuations:enable"))

in the project definition for SBT doesn't seem to work, resulting in

    [error] bad option: -P:continuations:enable

on sbt compile and the plugin not being enabled on the sbt console either.

I guess I'm going about it the wrong way - any ideas?


Cheers,

Oliver

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.

Re: [sbt] Scala continuations plugin with SBT? Fluffy 4/25/10 9:00 AM
You need to add the compiler plugin to scala via a -X option (or SBT's built in scalac plugin features).   This is because SBT does not use the SCALA_HOME environment like a normal scala distribution (similarly with ANT/Maven - depending on your setup).

I forgot the syntax off the top of my head for scalac plugins in SBT, but I'm sure someone else can back me up here.  I had a continuations SBT project setup, however not on this computer...   Sorry for the lame response ;)


- Josh
[sbt] Re: Scala continuations plugin with SBT? n8han 4/25/10 9:46 AM
On Apr 25, 9:34 am, Oliver Schulz <oliver.sch...@tu-dortmund.de>
wrote:
> Does anyone know how to enable the continuations compiler plugin included with
> recent Scala versions (> 2.8.0.RC1) in SBT?

Here's an example:
http://github.com/n8han/spde-examples/blob/master/project/build/ExamplesProject.scala#L9

Nathan
Re: [sbt] Re: Scala continuations plugin with SBT? Mark Harrah 4/25/10 9:58 AM
On Sunday 25 April 2010, Nathan wrote:
> On Apr 25, 9:34 am, Oliver Schulz <oliver.sch...@tu-dortmund.de>
> wrote:
> > Does anyone know how to enable the continuations compiler plugin included with
> > recent Scala versions (> 2.8.0.RC1) in SBT?
>
> Here's an example:
> http://github.com/n8han/spde-examples/blob/master/project/build/ExamplesProject.scala#L9

Cool, thanks.  I added it as an example on the compiler plugins page[1].

-Mark

[1] http://code.google.com/p/simple-build-tool/wiki/CompilerPlugins
[sbt] Re: Scala continuations plugin with SBT? Oliver Schulz 4/26/10 7:01 AM
Thanks, looks like I was missing

   ... with AutoCompilerPlugins

and

    val cont = compilerPlugin("org.scala-lang.plugins" %
"continuations" % "2.8.0.RC1")

Continuations run through the compiler fine now. However, they're
still unavailable in the
console. The following works fine in "scala -P:continuations:enable"

    import scala.util.continuations._
    reset { val i = shift { body: (Int => Unit) => body(5);
println("done") }; println(i) }

but fails in the SBT console, resulting in a

java.lang.NoSuchMethodError: scala.util.continuations.package
$.shift(Lscala/Function1;)Ljava/lang/Object;
        at $anonfun$1.apply$mcV$sp(<console>:14)
        at $anonfun$1.apply(<console>:14)
        at $anonfun$1.apply(<console>:14)

I'd really love to have continuations available in the SBT console
(not only for testing code). Does anyone
know a way to do it?
Re: [sbt] Re: Scala continuations plugin with SBT? wrwills 4/26/10 7:12 AM
I suspect that there's no way to get it to work in the sbt console
unless sbt is itself built with the continuations plugin.

-Rob
Re: [sbt] Re: Scala continuations plugin with SBT? Mark Harrah 4/26/10 8:01 AM
On Monday 26 April 2010 10:01:09 am oschulz wrote:
> Thanks, looks like I was missing
>
>    ... with AutoCompilerPlugins
>
> and
>
>     val cont = compilerPlugin("org.scala-lang.plugins" %
> "continuations" % "2.8.0.RC1")
>
> Continuations run through the compiler fine now. However, they're
> still unavailable in the
> console. The following works fine in "scala -P:continuations:enable"
>
>     import scala.util.continuations._
>     reset { val i = shift { body: (Int => Unit) => body(5);
> println("done") }; println(i) }
>
> but fails in the SBT console, resulting in a
>
> java.lang.NoSuchMethodError: scala.util.continuations.package
> $.shift(Lscala/Function1;)Ljava/lang/Object;
>         at $anonfun$1.apply$mcV$sp(<console>:14)
>         at $anonfun$1.apply(<console>:14)
>         at $anonfun$1.apply(<console>:14)
>
> I'd really love to have continuations available in the SBT console
> (not only for testing code). Does anyone
> know a way to do it?

There was an odd omission in sbt- no way to specify options to the console.  
I've fixed this and by default consoleOptions = compileOptions.  It should work
without further configuration now.

-Mark