diff options
author | Vojin Jovanovic <vojin.jovanovic@epfl.ch> | 2012-01-09 18:11:10 +0100 |
---|---|---|
committer | Vojin Jovanovic <vojin.jovanovic@epfl.ch> | 2012-01-09 18:11:10 +0100 |
commit | 1126912bce5d098571c1bd29a04e4781e19c3d85 (patch) | |
tree | 79e753014c1adfa26e39e32911125bfc0ad8ee4c /project/build/ForkSBT.scala | |
parent | 5a4b555c378d79d57b59dfd6edafd2b9a59866bb (diff) | |
parent | 820491ed6376e9f8f8a8102387495113dce55444 (diff) | |
download | scala-1126912bce5d098571c1bd29a04e4781e19c3d85.tar.gz scala-1126912bce5d098571c1bd29a04e4781e19c3d85.tar.bz2 scala-1126912bce5d098571c1bd29a04e4781e19c3d85.zip |
Merge branch 'master' into execution-context
Diffstat (limited to 'project/build/ForkSBT.scala')
-rw-r--r-- | project/build/ForkSBT.scala | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/project/build/ForkSBT.scala b/project/build/ForkSBT.scala deleted file mode 100644 index b30e35e61f..0000000000 --- a/project/build/ForkSBT.scala +++ /dev/null @@ -1,49 +0,0 @@ -/** Scala SBT build - * Copyright 2005-2010 LAMP/EPFL - * @author Paul Phillips - */ - -import sbt._ - -/** Worked out a way to fork sbt tasks, preserving all sbt command line - * options and without hardcoding anything. - */ -trait ForkSBT { - self: BasicLayer => - - def jvmArguments: List[String] = { - import scala.collection.jcl.Conversions._ - import java.lang.management.ManagementFactory - ManagementFactory.getRuntimeMXBean().getInputArguments().toList - } - - private var extraJVMArgs: List[String] = Nil - def withJVMArgs[T](args: String*)(body: => T): T = { - val saved = extraJVMArgs - extraJVMArgs = args.toList - try { body } - finally extraJVMArgs = saved - } - - // Set a property in forked sbts to inhibit possible forking cycles. - def markForked = "-D" + forkProperty + "=true" - - /** Forks a new process to run "sbt task task ...": - */ - def forkTasks(tasks: String*): Boolean = { - require (!isForked, "Tried to fork but sbt is already forked: " + tasks.mkString(" ")) - - val sbtJar = System.getProperty("java.class.path") - val sbtMain = "xsbt.boot.Boot" // ok, much of anything. - val args = jvmArguments ++ Seq(markForked, "-classpath", sbtJar, sbtMain) ++ tasks - - log.info("Forking: " + args.mkString("java ", " ", "")) - Fork.java(None, args, StdoutOutput) == 0 - } - def maybeFork(task: TaskManager#Task): Option[String] = maybeFork(task, "Error during external compilation.") - def maybeFork(task: TaskManager#Task, errorMsg: String): Option[String] = { - if (isForked) task.run - else if (forkTasks("project " + this.name, task.name)) None - else Some(errorMsg) - } -} |