aboutsummaryrefslogtreecommitdiff
path: root/stage2
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2017-06-15 22:34:42 -0400
committerChristopher Vogt <oss.nsp@cvogt.org>2017-06-15 22:43:18 -0400
commitb5194aab6f1f57aff6e4538acaf91245fdf15039 (patch)
tree4516f4c4686ceaf35619a68c0d9d1a6c359d1897 /stage2
parentc65d21ae38bdfb646af991a5f3b1dfe8e41a5318 (diff)
downloadcbt-b5194aab6f1f57aff6e4538acaf91245fdf15039.tar.gz
cbt-b5194aab6f1f57aff6e4538acaf91245fdf15039.tar.bz2
cbt-b5194aab6f1f57aff6e4538acaf91245fdf15039.zip
add process library with extracted and new functions
Diffstat (limited to 'stage2')
-rw-r--r--stage2/BasicBuild.scala28
-rw-r--r--stage2/Lib.scala5
-rw-r--r--stage2/libraries.scala1
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" )