diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2017-11-26 19:31:38 +0100 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-11-26 10:31:38 -0800 |
commit | 5cd797e25682ea3ac8d02c75b06c905c5b2fb103 (patch) | |
tree | 97f5f7b637152c5a96fec86113ba098d5a03c2c4 /core/src/main/scala | |
parent | 082a6eab011173fa09a0e6b4cbd2234d1dcb5138 (diff) | |
download | mill-5cd797e25682ea3ac8d02c75b06c905c5b2fb103.tar.gz mill-5cd797e25682ea3ac8d02c75b06c905c5b2fb103.tar.bz2 mill-5cd797e25682ea3ac8d02c75b06c905c5b2fb103.zip |
Bust caches when the build itself has changed. (#24)
Use the Ammonite classloader to check if the classpath has changed
Fix #7
Diffstat (limited to 'core/src/main/scala')
-rw-r--r-- | core/src/main/scala/mill/eval/Evaluator.scala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/src/main/scala/mill/eval/Evaluator.scala b/core/src/main/scala/mill/eval/Evaluator.scala index 6acfe066..007e1755 100644 --- a/core/src/main/scala/mill/eval/Evaluator.scala +++ b/core/src/main/scala/mill/eval/Evaluator.scala @@ -1,13 +1,14 @@ package mill.eval import ammonite.ops._ +import ammonite.runtime.SpecialClassLoader import mill.define.{Graph, Target, Task} import mill.discover.Mirror import mill.discover.Mirror.LabelledTarget import mill.util import mill.util.{Args, MultiBiMap, OSet} - import scala.collection.mutable + class Evaluator(workspacePath: Path, labeling: Map[Target[_], LabelledTarget[_]], log: String => Unit){ @@ -62,9 +63,16 @@ class Evaluator(workspacePath: Path, val externalInputs = group.items.flatMap(_.inputs).filter(!group.contains(_)) + // check if the build itself has changed + val classLoaderSig = Thread.currentThread().getContextClassLoader match { + case scl: SpecialClassLoader => scl.classpathSignature + case _ => Nil + } + val inputsHash = externalInputs.map(results).toVector.hashCode + - group.toIterator.map(_.sideHash).toVector.hashCode() + group.toIterator.map(_.sideHash).toVector.hashCode() + + classLoaderSig.hashCode() terminal match{ case Left(task) => |