From d94bb5eae6cd5f75d3cac1b69518b80c0a90169b Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 8 Apr 2018 15:46:22 -0700 Subject: Properly support test frameworks which spawn child tasks Needed to fix https://github.com/lihaoyi/mill/issues/286 --- scalalib/src/mill/scalalib/Lib.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scalalib/src') diff --git a/scalalib/src/mill/scalalib/Lib.scala b/scalalib/src/mill/scalalib/Lib.scala index 3eb2defd..07d88891 100644 --- a/scalalib/src/mill/scalalib/Lib.scala +++ b/scalalib/src/mill/scalalib/Lib.scala @@ -219,11 +219,12 @@ object Lib{ val tasks = runner.tasks( for ((cls, fingerprint) <- testClasses.toArray) - yield new TaskDef(cls.getName.stripSuffix("$"), fingerprint, true, Array(new SuiteSelector)) + yield new TaskDef(cls.getName.stripSuffix("$"), fingerprint, true, Array(new SuiteSelector)) ) - for (t <- tasks) { - t.execute( + val taskQueue = tasks.to[mutable.Queue] + while (taskQueue.nonEmpty){ + val next = taskQueue.dequeue().execute( new EventHandler { def handle(event: Event) = events.append(event) }, @@ -242,6 +243,7 @@ object Lib{ def info(msg: String) = ctx.log.outputStream.println(msg) }) ) + taskQueue.enqueue(next:_*) } ctx.log.outputStream.println(runner.done()) } @@ -299,7 +301,6 @@ object Lib{ cls.isAnnotationPresent(annotationCls) || cls.getDeclaredMethods.exists(_.isAnnotationPresent(annotationCls)) ) - }.map { f => (cls, f) } } } -- cgit v1.2.3