According to a comment from @mjaskowski, Dou do you plan to use the bytecode of the tool created by the Scala compiler? , Scala is not a supported language.
Short answer: absolutely. The longer answer is yes, but not very soon. Scala is a very (very, very, very, very) complex language (oh my god, it is so incredibly difficult!), And it will take a long time to check Quasar with many (many, many, many) Scala. Given the relatively small number of Scala developers and the large integration of costs, this may take some time. However, we support Clojure (much easier integration), and soon (perhaps we will already do this) Kotlin support (trivial integration).
Follow on to see possible ways to configure javaagent in sbt.
This is my first meeting with Quasar, so the steps are really basic, but they should give you a start.
Running javaagent Quasar in JVM only
Only with the following command can you run Quasar javaagent without any Scala / sbt jars.
java -cp /Users/jacek/.ivy2/cache/org.ow2.asm/asm-util/jars/asm-util-5.0.1.jar:/Users/jacek/.ivy2/cache/org.ow2.asm / asm- commons / jars / asm-commons-5.0.1.jar: /Users/jacek/.ivy2/cache/org.ow2.asm/asm/jars/asm-5.0.1.jar -javaagent: / Users / jacek /. ivy2 / cache / co.paralleluniverse / quasar core / banks / quasar core-0.5.0.jar -help
It does not seem to be autonomous and needs additional jars on CLASSPATH .
Running javaagent Quasar with scala
The following command makes scala and Quasar javaagent happy.
scala -debug -usebootcp -toolcp /Users/jacek/.ivy2/cache/org.ow2.asm/asm-tree/jars/asm-tree-5.0.1.jar:/Users/jacek/.ivy2/cache/org .ow2.asm / asm- Util / banks / ASM-Util-5.0.1.jar: /Users/jacek/.ivy2/cache/org.ow2.asm/asm-commons/jars/asm-commons-5.0.1 .jar: /Users/Jacek/.ivy2/cache/org.ow2.asm/asm/jars/asm-5.0.1.jar: /Users/jacek/.ivy2/cache/org.ow2.asm/asm-analysis / jars / asm-analysis- 5.0.1.jar -J-javaagent: /Users/jacek/.ivy2/cache/co.paralleluniverse/quasar-core/jars/quasar-core-0.5.0.jar
Initial attempts to run Quasar with sbt
Add the necessary Quasar dependencies to build.sbt :
val quasarDeps = Seq( "quasar-core", "quasar-actors", "quasar-galaxy" ) libraryDependencies := quasarDeps.map("co.paralleluniverse" % _ % "0.5.0")
It comes down to increasing libraryDependencies with the help of the necessary cans. I selected all available.
I checked in the Scala console that the libraries are available.
➜ quasar-sbt xsbt [info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins [info] Set current project to quasar-sbt (in build file:/Users/jacek/sandbox/quasar-sbt/) > console Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_60). Type in expressions to have them evaluated. Type :help for more information. scala> import co.paralleluniverse.fibers._ import co.paralleluniverse.fibers._ scala> Fiber.DEFAULT_STACK_SIZE res0: Int = 32
You will also need to add a java agent. Add the following to build.sbt :
// FIXME the path to quasar-core should be simpler javaOptions in Test += "-javaagent:/Users/jacek/.ivy2/cache/co.paralleluniverse/quasar-core/jars/quasar-core-0.5.0.jar" fork in Test := true // only needed for Specs2 so I could test the test setup libraryDependencies += "org.specs2" %% "specs2" % "2.3.13" % Test scalacOptions in Test ++= Seq("-Yrangepos")
reload assembly changes.
> reload [info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins [info] Set current project to quasar-sbt (in build file:/Users/jacek/sandbox/quasar-sbt/)
Write a test to make sure everything is set up correctly. I used HelloWorldSpec from [Specs2][2] with some changes:
import org.specs2.mutable._ import co.paralleluniverse.fibers._ class HelloWorldSpec extends Specification { "Quasar" should { "Fiber.DEFAULT_STACK_SIZE defaults to 32" in { Fiber.DEFAULT_STACK_SIZE === 32 } } }
This is not a very extensive test, so customize it for your needs. Save the file under src/test/scala .
Run test .
> test objc[27427]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. [info] HelloWorldSpec [info] [info] Quasar should [info] + Fiber.DEFAULT_STACK_SIZE defaults to 32 [info] [info] Total for specification HelloWorldSpec [info] Finished in 40 ms [info] 1 example, 0 failure, 0 error [info] Passed: Total 1, Failed 0, Errors 0, Passed 1 [success] Total time: 4 s, completed Jul 13, 2014 2:04:13 PM
It works!