summaryrefslogtreecommitdiff
path: root/build.sc
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2019-06-29 22:44:09 -0700
committerLi Haoyi <haoyi.sg@gmail.com>2019-06-29 22:44:09 -0700
commitd2af62e6c35583fafa2f39e9c204fad6a21b38ab (patch)
tree97821491f7ca0ee70c62e237263666283106bd46 /build.sc
parent020e284847b79f94013a8bb56c20314376829ca8 (diff)
downloadmill-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
Diffstat (limited to 'build.sc')
-rwxr-xr-xbuild.sc11
1 files changed, 10 insertions, 1 deletions
diff --git a/build.sc b/build.sc
index aed391d4..dce241b9 100755
--- a/build.sc
+++ b/build.sc
@@ -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"