Skip to content

Commit 8371f48

Browse files
committed
Better support for testing with a local instance of Scala.
SBT's scalaHome handling doesn't pick up the local continuations plugin.
1 parent 74681a0 commit 8371f48

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

build.sbt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
scalaVersion := "2.10.2"
22

3+
// Uncomment to test with a locally built copy of Scala.
4+
// scalaHome := Some(file("/code/scala2/build/pack"))
5+
36
organization := "org.typesafe.async" // TODO new org name under scala-lang.
47

58
name := "scala-async"
@@ -23,10 +26,22 @@ parallelExecution in Global := false
2326

2427
autoCompilerPlugins := true
2528

26-
libraryDependencies <<= (scalaVersion, libraryDependencies) {
27-
(ver, deps) =>
28-
deps :+ compilerPlugin("org.scala-lang.plugins" % "continuations" % ver)
29-
}
29+
scalacOptions ++= (scalaHome.value match {
30+
case Some(sh) =>
31+
// Use continuations plugin from the local scala instance
32+
val continuationsJar = sh / "misc" / "scala-devel" / "plugins" / "continuations.jar"
33+
("-Xplugin:" + continuationsJar.getAbsolutePath) :: Nil
34+
case None =>
35+
Nil
36+
})
37+
38+
libraryDependencies ++= (scalaHome.value match {
39+
case Some(sh) =>
40+
Nil
41+
case None =>
42+
// Use continuations plugin from the published artifact.
43+
compilerPlugin("org.scala-lang.plugins" % "continuations" % scalaVersion.value) :: Nil
44+
})
3045

3146
scalacOptions += "-P:continuations:enable"
3247

0 commit comments

Comments
 (0)