diff options
Diffstat (limited to 'stage2')
-rw-r--r-- | stage2/BasicBuild.scala | 28 | ||||
-rw-r--r-- | stage2/Lib.scala | 5 | ||||
-rw-r--r-- | stage2/libraries.scala | 1 |
3 files changed, 33 insertions, 1 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index 0bdbad7..e41545b 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -319,4 +319,32 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with SbtDep final def crossScalaVersionsArray = Array(scalaVersion) def publish: Seq[URL] = Seq() + + def fork = false + + def runForked: ExitCode = { + val ( pid, waitFor, destroy ) = runForkedHandles + waitFor() + } + + protected def runForkedHandles = runForked( mainClassOrFail.getName, context.args ) + + def runForked( className: String, args: Seq[String] ): ( Int, () => ExitCode, () => ExitCode ) = + lib.runMainForked( + className, + args, + classpath.string, + Some( context.workingDirectory ), + NailgunLauncher.runningViaNailgun.option( + lib.getOutErrIn match { case (l,r, in) => (l.get,r.get, in) } + ) + ) + + override def runMain( className: String, args: Seq[String] ): ExitCode = { + if(fork){ + runForked(className, args)._2() + } else { + super.runMain( className, args ) + } + } } diff --git a/stage2/Lib.scala b/stage2/Lib.scala index 56f24c6..8801b33 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -16,7 +16,10 @@ import scala.reflect.NameTransformer case class Developer(id: String, name: String, timezone: String, url: URL) /** Don't extend. Create your own libs :). */ -final class Lib(val logger: Logger) extends Stage1Lib(logger){ +final class Lib(val logger: Logger) extends + Stage1Lib(logger) with + _root_.cbt.process.Module +{ lib => val buildFileName = "build.scala" diff --git a/stage2/libraries.scala b/stage2/libraries.scala index 08a7a74..b4515e1 100644 --- a/stage2/libraries.scala +++ b/stage2/libraries.scala @@ -14,6 +14,7 @@ class libraries( context: Context, scalaVersion: String, scalaMajorVersion: Stri def eval = dep( "eval" ) def file = dep( "file" ) def interfaces = dep( "interfaces" ) + def process = dep( "process" ) def proguard = dep( "proguard" ) def reflect = dep( "reflect" ) def scalatestRunner = dep( "scalatest-runner" ) |