From 1531ea1c1383368f8a8048a079397f08e25ecd11 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Sun, 19 Jun 2016 16:12:56 -0400 Subject: simplify logic that delegates to test build and runs it --- stage2/BasicBuild.scala | 11 ++++++----- stage2/Lib.scala | 20 -------------------- 2 files changed, 6 insertions(+), 25 deletions(-) (limited to 'stage2') diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index 4be0e58..2083acc 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -143,9 +143,12 @@ trait BaseBuild extends DependencyImplementation with BuildInterface with Trigge def runClass: String = "Main" def run: ExitCode = lib.runMainIfFound( runClass, context.args, classLoader(context.classLoaderCache) ) - def test: Option[ExitCode] = { - lib.test(context) - } + def test: Option[ExitCode] = + Some(new lib.ReflectBuild( + BuildDependency(projectDirectory++"/test").build + ).callNullary(Some("run"))) + def t = test + def rt = recursiveUnsafe(Some("test")) def recursiveSafe(_run: BuildInterface => Any): ExitCode = { val builds = (this +: transitiveDependencies).collect{ @@ -192,9 +195,7 @@ trait BaseBuild extends DependencyImplementation with BuildInterface with Trigge } def c = compile - def t = test def r = run - def rt = recursiveUnsafe(Some("test")) /* context.logger.composition(">"*80) diff --git a/stage2/Lib.scala b/stage2/Lib.scala index 2430c1d..1cbff9a 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -107,26 +107,6 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ } } - 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 = - new ReflectBuild( - loadDynamic( - context.copy( projectDirectory = context.projectDirectory ++ "/test", args = loggerArg.toVector ++ context.args ), - new BasicBuild(_) with mixins.Test - ) - ).callNullary( Some("run") ) - logger.lib(s"return testDefault( $context )") - Some(exitCode) - } else None - } - // task reflection helpers def tasks(cls:Class[_]): Map[String, Method] = Stream -- cgit v1.2.3