aboutsummaryrefslogtreecommitdiff
path: root/stage2/BasicBuild.scala
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2017-02-21 12:22:31 +0800
committerChristopher Vogt <oss.nsp@cvogt.org>2017-02-27 18:53:27 +0800
commit00f1e2719d507261f40a494096487b0f0a4bae2f (patch)
tree9684b673bc9147a70eeca7783d4f455221872966 /stage2/BasicBuild.scala
parentaf5361b7eaeff292f551848d51cc1e8b0a6851c6 (diff)
downloadcbt-00f1e2719d507261f40a494096487b0f0a4bae2f.tar.gz
cbt-00f1e2719d507261f40a494096487b0f0a4bae2f.tar.bz2
cbt-00f1e2719d507261f40a494096487b0f0a4bae2f.zip
turn `test` into a subproject for easy access to test’s tasks
Diffstat (limited to 'stage2/BasicBuild.scala')
-rw-r--r--stage2/BasicBuild.scala26
1 files changed, 16 insertions, 10 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala
index b8a6790..88f08dc 100644
--- a/stage2/BasicBuild.scala
+++ b/stage2/BasicBuild.scala
@@ -187,16 +187,22 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
}
def run: ExitCode = run( context.args: _* )
-
- def test: Any =
- lib.callReflective(
- DirectoryDependency(projectDirectory++"/test").dependency,
- Some("run"),
- context
- )
-
- def t = test
- def rt = recursiveUnsafe(Some("test"))
+ def test: Dependency = {
+ val testDirectory = projectDirectory / "test"
+ if( (testDirectory / lib.buildDirectoryName / lib.buildFileName).exists ){
+ // FIYME: maybe we can make loadRoot(...).finalBuild an Option some
+ DirectoryDependency( testDirectory ).dependency
+ } else {
+ new BasicBuild( context.copy(workingDirectory = testDirectory) ){
+ override def dependencies = Seq(
+ DirectoryDependency(projectDirectory++"/..")
+ )
+ def apply = run
+ }
+ }
+ }
+ def t: Any = lib.callReflective( test, Some("run"), context )
+ def rt = recursiveUnsafe(Some("test.run"))
def recursiveSafe(_run: BuildInterface => Any): ExitCode = {
val builds = (this +: transitiveDependencies).collect{