summaryrefslogtreecommitdiff
path: root/main/src/main/MillIvyHook.scala
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/main/MillIvyHook.scala')
-rw-r--r--main/src/main/MillIvyHook.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/src/main/MillIvyHook.scala b/main/src/main/MillIvyHook.scala
new file mode 100644
index 00000000..2b4eb6a7
--- /dev/null
+++ b/main/src/main/MillIvyHook.scala
@@ -0,0 +1,15 @@
+package mill.main
+import ammonite.runtime.ImportHook.BaseIvy
+import ammonite.runtime.ImportHook
+import java.io.File
+
+/**
+ * Overrides the ivy hook to interpret $MILL_VERSION as the version of mill
+ * the user runs.
+ *
+ * Can be used to ensure loaded contrib modules keep up to date.
+ */
+object MillIvyHook extends BaseIvy(plugin = false){
+ override def resolve(interp: ImportHook.InterpreterInterface, signatures: Seq[String]): Either[String,Set[File]] =
+ super.resolve(interp, signatures.map(_.replace("$MILL_VERSION", mill.BuildInfo.millVersion)))
+}