1

I'm trying to compile a class using continuations in scala 2.11.2 and I can't get it to compile with sbt. The program compiles when using scalac and it works how I want it to, so I know that it isn't my code.

I compile and run successfully using

scalac -Xplugin ~/Software/scala-continuations-plugin_2.11.2-1.0.2.jar -P:continuations:enable Coroutine.scala

scala -Xplugin ~/Software/scala-continuations-plugin_2.11.2-1.0.2.jar -cp . coroutine.CoroutineTest

however, when I try compiling with sbt, I get the following error

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

Here is my build.sbt file

name := "coroutine"
version := "1.0"
scalaVersion := "2.11.2"
autoCompilerPlugins := true
libraryDependencies += "org.scala-lang.plugins" % "scala-continuations-plugin_2.11.2" % "1.0.2"
scalacOptions += "-P:continuations:enable"

You can view the code and sbt file as well at

http://www.cs.uga.edu/~jam/coroutine/Coroutine.scala

and

http://www.cs.uga.edu/~jam/coroutine/build.sbt

I also tried using scalacOptions to call -Xplugins as I do in my scalac command above. This resulted in the error

[error] bad option: '-Xplugin ~/Software/scala-continuations-plugin_2.11.2-1.0.2.jar'
  • Would you please try `addCompilerPlugin("org.scala-lang.plugins" % "continuations" % "2.8.1")`? Check this post http://www.scala-sbt.org/0.13/docs/Compiler-Plugins.html. – longhua Sep 18 '14 at 20:29

1 Answers1

4

You may need to use addCompilerPlugin to add continuations plugin. Besides, scala-continuations-library_2.11 is required.

name := "coroutine"

version := "1.0"

scalaVersion := "2.11.2"

autoCompilerPlugins := true

addCompilerPlugin("org.scala-lang.plugins" % "scala-continuations-plugin_2.11.2" % "1.0.2")

libraryDependencies += "org.scala-lang.plugins" % "scala-continuations-library_2.11" % "1.0.2"

scalacOptions += "-P:continuations:enable"
longhua
  • 4,142
  • 21
  • 28