aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stage2/BasicBuild.scala4
-rw-r--r--stage2/Lib.scala28
2 files changed, 18 insertions, 14 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala
index b489947..65db8a4 100644
--- a/stage2/BasicBuild.scala
+++ b/stage2/BasicBuild.scala
@@ -139,7 +139,9 @@ class Build(val context: Context) extends Dependency with TriggerLoop with SbtDe
def runClass: String = "Main"
def run: ExitCode = lib.runMainIfFound( runClass, context.args, classLoader(context.classLoaderCache) )
- def test: ExitCode = lib.test(context)
+ def test: Option[ExitCode] = {
+ lib.test(context)
+ }
/*
context.logger.composition(">"*80)
diff --git a/stage2/Lib.scala b/stage2/Lib.scala
index aa98e7c..d7456e1 100644
--- a/stage2/Lib.scala
+++ b/stage2/Lib.scala
@@ -108,19 +108,21 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
}
}
- def test( context: Context ): ExitCode = {
- val loggers = logger.enabledLoggers.mkString(",")
- // FIXME: this is a hack to pass logger args on to the tests.
- // should probably have a more structured way
- val loggerArg = if(loggers != "") Some("-Dlog="++loggers) else None
-
- logger.lib(s"invoke testDefault( $context )")
- val exitCode: ExitCode = loadDynamic(
- context.copy( projectDirectory = context.projectDirectory ++ "/test", args = loggerArg.toVector ++ context.args ),
- new Build(_) with mixins.Test
- ).run
- logger.lib(s"return testDefault( $context )")
- exitCode
+ def test( context: Context ): Option[ExitCode] = {
+ if((context.projectDirectory ++ "/test").exists){
+ val loggers = logger.enabledLoggers.mkString(",")
+ // FIXME: this is a hack to pass logger args on to the tests.
+ // should probably have a more structured way
+ val loggerArg = if(loggers != "") Some("-Dlog="++loggers) else None
+
+ logger.lib(s"invoke testDefault( $context )")
+ val exitCode: ExitCode = loadDynamic(
+ context.copy( projectDirectory = context.projectDirectory ++ "/test", args = loggerArg.toVector ++ context.args ),
+ new BasicBuild(_) with mixins.Test
+ ).run.asInstanceOf[ExitCode] // FIXME
+ logger.lib(s"return testDefault( $context )")
+ Some(exitCode)
+ } else None
}
// task reflection helpers