mirror of https://github.com/sbt/sbt.git
Scripted test for a macro def in a source file.
Needed to increase MaxPermSize, otherwise I was unable to run this test on Java 1.6.0_29 64bit Server on Mac OS.
This commit is contained in:
parent
17eeec6876
commit
d422b5cb8f
|
|
@ -143,7 +143,8 @@ object Sbt extends Build
|
|||
val loader = classpath.ClasspathUtilities.toLoader(scriptedSbtClasspath.files, scriptedSbtInstance.loader)
|
||||
val m = ModuleUtilities.getObject("sbt.test.ScriptedTests", loader)
|
||||
val r = m.getClass.getMethod("run", classOf[File], classOf[Boolean], classOf[String], classOf[String], classOf[String], classOf[Array[String]], classOf[File], classOf[Array[String]])
|
||||
try { r.invoke(m, sourcePath, true: java.lang.Boolean, v, sv, ssv, args.toArray[String], launcher, Array[String]()) }
|
||||
val launcherVmOptions = Array("-XX:MaxPermSize=256M") // increased after a failure in scripted source-dependencies/macro
|
||||
try { r.invoke(m, sourcePath, true: java.lang.Boolean, v, sv, ssv, args.toArray[String], launcher, launcherVmOptions) }
|
||||
catch { case ite: java.lang.reflect.InvocationTargetException => throw ite.getCause }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package macro
|
||||
|
||||
object Client {
|
||||
Provider.tree(0)
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package macro
|
||||
|
||||
object Provider {
|
||||
def macro tree(args: Any) = reify(args)
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package macro
|
||||
|
||||
object Provider {
|
||||
def macro tree(args: Any) = sys.error("no macro for you!")
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
|
||||
object build extends Build {
|
||||
val defaultSettings = Seq(
|
||||
scalaVersion := "2.10.0-M2",
|
||||
scalacOptions += "-Xmacros"
|
||||
)
|
||||
|
||||
lazy val root = Project(
|
||||
base = file("."),
|
||||
id = "macro",
|
||||
aggregate = Seq(macroProvider, macroClient),
|
||||
settings = Defaults.defaultSettings ++ defaultSettings
|
||||
)
|
||||
|
||||
lazy val macroProvider = Project(
|
||||
base = file("macro-provider"),
|
||||
id = "macro-provider",
|
||||
settings = Defaults.defaultSettings ++ defaultSettings
|
||||
)
|
||||
|
||||
lazy val macroClient = Project(
|
||||
base = file("macro-client"),
|
||||
id = "macro-client",
|
||||
dependencies = Seq(macroProvider),
|
||||
settings = Defaults.defaultSettings ++ defaultSettings
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
> compile
|
||||
|
||||
# replace macro with one that throws an error
|
||||
|
||||
$ copy-file macro-provider/changes/Provider.scala macro-provider/Provider.scala
|
||||
|
||||
> macro-provider/compile
|
||||
|
||||
-> macro-client/compile
|
||||
|
||||
> clean
|
||||
|
||||
-> compile
|
||||
Loading…
Reference in New Issue