summaryrefslogtreecommitdiff
path: root/main/src/main/MillIvyHook.scala
diff options
context:
space:
mode:
authorOlivier Mélois <baccata64@gmail.com>2019-07-08 10:33:31 +0200
committerTobias Roeser <le.petit.fou@web.de>2019-07-08 10:33:31 +0200
commitfe8667d58aef03e8b97c1361495ab5d851deee60 (patch)
treea652df66b0d873f0635b2f6a55122195e9412a3a /main/src/main/MillIvyHook.scala
parent83aa7de17bf175ce64869f70c54de3882e047a1f (diff)
downloadmill-fe8667d58aef03e8b97c1361495ab5d851deee60.tar.gz
mill-fe8667d58aef03e8b97c1361495ab5d851deee60.tar.bz2
mill-fe8667d58aef03e8b97c1361495ab5d851deee60.zip
Interpolates $MILL_VERSION in ivy imports (#649)
* Interpolates $MILL_VERSION in ivy imports This overrides the default $ivy magic import by replacing the `$MILL_VERSION` string with mill's version, in order to facilitate the loading/update of contrib modules. Ammonite had to be bumped to 1.6.9 * Removed bloop import * AmmoniteExit import fix * Removed repl dep check * Removed problematic check * Made ammonite version override-able
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)))
+}