aboutsummaryrefslogtreecommitdiff
path: root/stage2
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-11-10 01:40:14 -0500
committerChristopher Vogt <oss.nsp@cvogt.org>2017-02-13 10:10:02 -0500
commit8ebada86b1fc58465751864acba8aafd387ccb4b (patch)
tree3c0cf15a408350511652dd0f0872a8eba6de7a9e /stage2
parent0a295c21d3379117e661fdbf586ecb6222c3602b (diff)
downloadcbt-8ebada86b1fc58465751864acba8aafd387ccb4b.tar.gz
cbt-8ebada86b1fc58465751864acba8aafd387ccb4b.tar.bz2
cbt-8ebada86b1fc58465751864acba8aafd387ccb4b.zip
Add support for nested builds and use it to replace cross compilation
command which was previously hard-coded This will allow multi-project builds, too but we should first fix caching across instances and GitDependencies on sub-builds within other repositories.
Diffstat (limited to 'stage2')
-rw-r--r--stage2/BasicBuild.scala5
-rw-r--r--stage2/Lib.scala14
-rw-r--r--stage2/Stage2.scala14
3 files changed, 19 insertions, 14 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala
index ed03de2..b7b0854 100644
--- a/stage2/BasicBuild.scala
+++ b/stage2/BasicBuild.scala
@@ -41,8 +41,6 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
def defaultScalaVersion: String = constants.scalaVersion
final def scalaVersion = context.scalaVersion getOrElse defaultScalaVersion
final def scalaMajorVersion: String = lib.libMajorVersion(scalaVersion)
- def crossScalaVersions: Seq[String] = Seq(scalaVersion, "2.10.6")
- final def crossScalaVersionsArray: Array[String] = crossScalaVersions.to
def projectName = "default"
// TODO: get rid of this in favor of newBuild.
@@ -285,4 +283,7 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
// a method that can be called only to trigger any side-effects
final def `void` = ()
+
+ @deprecated("use the MultipleScalaVersions plugin instead","")
+ final def crossScalaVersionsArray = Array(scalaVersion)
}
diff --git a/stage2/Lib.scala b/stage2/Lib.scala
index 47e1635..dfb7ef3 100644
--- a/stage2/Lib.scala
+++ b/stage2/Lib.scala
@@ -181,6 +181,20 @@ final class Lib(val logger: Logger) extends Stage1Lib(logger) with Scaffold{
case code if code.getClass.getSimpleName == "ExitCode" =>
// FIXME: ExitCode needs to be part of the compatibility interfaces
ExitCode(Stage0Lib.get(code,"integer").asInstanceOf[Int])
+ case Seq(b:BaseBuild) =>
+ val context = b.context.copy(args=b.context.args.drop(1))
+ val task = b.context.args.lift(0)
+ new ReflectBuild( b.copy(context=context) ).callNullary( task )
+ case Seq(b: BaseBuild, bs @ _*) if bs.forall(_.isInstanceOf[BaseBuild]) =>
+ (b +: bs)
+ .map( _.asInstanceOf[BaseBuild] )
+ .map{ b =>
+ val task = b.context.args.lift(0)
+ new ReflectBuild(
+ b.copy( context = b.context.copy(args=b.context.args.drop(1)) )
+ ).callNullary( task )
+ }
+ .head
case other =>
println( other.toString ) // no method .toConsole, using to String
ExitCode.Success
diff --git a/stage2/Stage2.scala b/stage2/Stage2.scala
index 0f5b557..25cd0ae 100644
--- a/stage2/Stage2.scala
+++ b/stage2/Stage2.scala
@@ -12,12 +12,10 @@ object Stage2 extends Stage2Base{
val paths = CbtPaths(args.cbtHome,args.cache)
import paths._
val lib = new Lib(args.logger)
-
logger.stage2(s"Stage2 start")
val loop = args.args.lift(0) == Some("loop")
- val cross = args.args.lift(0) == Some("cross")
- val taskIndex = if (loop || cross) {
+ val taskIndex = if (loop) {
1
} else {
0
@@ -44,15 +42,7 @@ object Stage2 extends Stage2Base{
val build = first.finalBuild
def call(build: BuildInterface): ExitCode = {
- if(cross){
- build.crossScalaVersions.map{
- v => new lib.ReflectBuild(
- build.copy(context.copy(scalaVersion = Some(v)))
- ).callNullary(task)
- }.filter(_ != ExitCode.Success).headOption getOrElse ExitCode.Success
- } else {
- new lib.ReflectBuild(build).callNullary(task)
- }
+ new lib.ReflectBuild(build).callNullary(task)
}
val res =