diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-15 10:26:09 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-15 10:26:09 -0800 |
commit | 9c7f1930e839be67980e50c614f7c8582b8a707d (patch) | |
tree | f2856aae6b1da5f53eaeede21001e07e2a059211 /core | |
parent | 3f768a3a0407c1b331199abea5fdd6d970da7615 (diff) | |
download | mill-9c7f1930e839be67980e50c614f7c8582b8a707d.tar.gz mill-9c7f1930e839be67980e50c614f7c8582b8a707d.tar.bz2 mill-9c7f1930e839be67980e50c614f7c8582b8a707d.zip |
Avoid compiling code just to get access to compiled code output paths
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/mill/eval/Evaluator.scala | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/core/src/main/scala/mill/eval/Evaluator.scala b/core/src/main/scala/mill/eval/Evaluator.scala index 8163a304..6e103ace 100644 --- a/core/src/main/scala/mill/eval/Evaluator.scala +++ b/core/src/main/scala/mill/eval/Evaluator.scala @@ -35,6 +35,16 @@ class Evaluator(workspacePath: Path, Evaluator.Results(goals.items.map(results), evaluated, transitive) } + def resolveDestPaths(t: Task[_]): Option[(Path, Path)] = { + labeling.get(t) match{ + case Some(labeling) => + val targetDestPath = workspacePath / labeling.segments + val metadataPath = targetDestPath / up / (targetDestPath.last + ".mill.json") + Some((targetDestPath, metadataPath)) + case None => None + } + } + def evaluateGroupCached(terminal: Task[_], group: OSet[Task[_]], results: collection.Map[Task[_], Any]): (collection.Map[Task[_], Any], Seq[Task[_]]) = { @@ -46,13 +56,8 @@ class Evaluator(workspacePath: Path, externalInputs.toIterator.map(results).toVector.hashCode + group.toIterator.map(_.sideHash).toVector.hashCode() - val (targetDestPath, metadataPath) = labeling.get(terminal) match{ - case Some(labeling) => - val targetDestPath = workspacePath / labeling.segments - val metadataPath = targetDestPath / up / (targetDestPath.last + ".mill.json") - (Some(targetDestPath), Some(metadataPath)) - case None => (None, None) - } + val destPaths = resolveDestPaths(terminal) + val (targetDestPath, metadataPath) = (destPaths.map(_._1), destPaths.map(_._2)) val cached = for{ metadataPath <- metadataPath |