From fe8667d58aef03e8b97c1361495ab5d851deee60 Mon Sep 17 00:00:00 2001 From: Olivier Mélois Date: Mon, 8 Jul 2019 10:33:31 +0200 Subject: 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 --- main/src/main/MillIvyHook.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 main/src/main/MillIvyHook.scala (limited to 'main/src/main/MillIvyHook.scala') 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))) +} -- cgit v1.2.3