diff options
-rw-r--r-- | core/src/main/scala/mill/eval/Evaluator.scala | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/core/src/main/scala/mill/eval/Evaluator.scala b/core/src/main/scala/mill/eval/Evaluator.scala index f91a1e8c..6acfe066 100644 --- a/core/src/main/scala/mill/eval/Evaluator.scala +++ b/core/src/main/scala/mill/eval/Evaluator.scala @@ -67,7 +67,8 @@ class Evaluator(workspacePath: Path, group.toIterator.map(_.sideHash).toVector.hashCode() terminal match{ - case Left(task) => evaluateGroup(group, results, None) + case Left(task) => + evaluateGroup(group, results, targetDestPath = None, maybeTargetLabel = None) case Right(labelledTarget) => val (destPath, metadataPath) = resolveDestPaths(labelledTarget) val cached = for{ @@ -84,16 +85,18 @@ class Evaluator(workspacePath: Path, case _ => - pprint.log(labelledTarget.segments) val Seq(first, rest @_*) = labelledTarget.segments val msgParts = Seq(first.asInstanceOf[Mirror.Segment.Label].value) ++ rest.map{ case Mirror.Segment.Label(s) => "." + s case Mirror.Segment.Cross(s) => "[" + s.mkString(",") + "]" } - log("Running " + msgParts.mkString) if (labelledTarget.target.flushDest) rm(destPath) - val (newResults, newEvaluated) = evaluateGroup(group, results, Some(destPath)) + val (newResults, newEvaluated) = evaluateGroup( + group, + results, + Some(destPath), + maybeTargetLabel = Some(msgParts.mkString)) newResults(labelledTarget.target) match{ case Result.Success(v) => @@ -116,12 +119,28 @@ class Evaluator(workspacePath: Path, def evaluateGroup(group: OSet[Task[_]], results: collection.Map[Task[_], Result[Any]], - targetDestPath: Option[Path]) = { + targetDestPath: Option[Path], + maybeTargetLabel: Option[String] + ) = { val newEvaluated = mutable.Buffer.empty[Task[_]] val newResults = mutable.LinkedHashMap.empty[Task[_], Result[Any]] - for (target <- group.items if !results.contains(target)) { + + val nonEvaluatedTargets = group.indexed.filterNot(results.contains) + + maybeTargetLabel.foreach { targetLabel => + val inputResults = for { + target <- nonEvaluatedTargets + item <- target.inputs.filterNot(group.contains) + } yield results(item) + + val logRun = inputResults.forall(_.isInstanceOf[Result.Success[_]]) + + if(logRun) { log("Running " + targetLabel) } + } + + for (target <- nonEvaluatedTargets) { newEvaluated.append(target) val targetInputValues = target.inputs @@ -152,4 +171,4 @@ object Evaluator{ failing: MultiBiMap[Either[Task[_], LabelledTarget[_]], Result.Failing]){ def values = rawValues.collect{case Result.Success(v) => v} } -}
\ No newline at end of file +} |