aboutsummaryrefslogtreecommitdiff
path: root/stage2/Lib.scala
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-04-27 09:41:55 -0400
committerChristopher Vogt <oss.nsp@cvogt.org>2016-04-28 13:34:01 -0400
commitb54f3fd4c4d9601a5f5bfc6d4ed881a15f37a472 (patch)
treea12be76a1b6c5cc5a5134356228106cecbeced24 /stage2/Lib.scala
parent373a16fef9dd00dbbd9b1fa973c1bd5f51994fc6 (diff)
downloadcbt-b54f3fd4c4d9601a5f5bfc6d4ed881a15f37a472.tar.gz
cbt-b54f3fd4c4d9601a5f5bfc6d4ed881a15f37a472.tar.bz2
cbt-b54f3fd4c4d9601a5f5bfc6d4ed881a15f37a472.zip
only run tests if there are actually tests to run (useful for recursively running tests in nested projects)
Diffstat (limited to 'stage2/Lib.scala')
-rw-r--r--stage2/Lib.scala28
1 files changed, 15 insertions, 13 deletions
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