diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2019-06-29 22:44:09 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2019-06-29 22:44:09 -0700 |
commit | d2af62e6c35583fafa2f39e9c204fad6a21b38ab (patch) | |
tree | 97821491f7ca0ee70c62e237263666283106bd46 | |
parent | 020e284847b79f94013a8bb56c20314376829ca8 (diff) | |
download | mill-d2af62e6c35583fafa2f39e9c204fad6a21b38ab.tar.gz mill-d2af62e6c35583fafa2f39e9c204fad6a21b38ab.tar.bz2 mill-d2af62e6c35583fafa2f39e9c204fad6a21b38ab.zip |
Delegate to `./mill` wrapper script from launcher
Only delegate if the file exists, and we are not currently being delegated to.
This makes the installed launcher automatically download the correct version of
itself to run the build, assuming a `./mill` wrapper script exists
-rwxr-xr-x | build.sc | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -444,7 +444,16 @@ def launcherScript(shellJvmArgs: Seq[String], def java(mainClass: String) = s"""exec $$JAVACMD $jvmArgsStr $$JAVA_OPTS -cp "${shellClassPath.mkString(":")}" $mainClass "$$@"""" - s"""if [ -z "$$JAVA_HOME" ] ; then + // Delegate to the `./mill` wrapper script if one exists, and we are being + // called manually (i.e. the MILL_EXEC_PATH that the wrapper script normally + // sets is not present in the environment) + s"""if [ -f "$$(dirname "$$BASH_SOURCE")/mill" ] ; then + | if [ ! -z "$$MILL_EXEC_PATH" ] ; then + | exec "$$(dirname "$$BASH_SOURCE")/mill" + | fi + |fi + | + |if [ -z "$$JAVA_HOME" ] ; then | JAVACMD="java" |else | JAVACMD="$$JAVA_HOME/bin/java" |