33# This is a wrapper script, that automatically download mill from GitHub release pages
44# You can give the required mill version with MILL_VERSION env variable
55# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
6- DEFAULT_MILL_VERSION=0.10.5
76
87set -e
98
9+ if [ -z " ${DEFAULT_MILL_VERSION} " ] ; then
10+ DEFAULT_MILL_VERSION=0.11.12
11+ fi
12+
1013if [ -z " $MILL_VERSION " ] ; then
1114 if [ -f " .mill-version" ] ; then
1215 MILL_VERSION=" $( head -n 1 .mill-version 2> /dev/null) "
16+ elif [ -f " .config/mill-version" ] ; then
17+ MILL_VERSION=" $( head -n 1 .config/mill-version 2> /dev/null) "
1318 elif [ -f " mill" ] && [ " $0 " != " mill" ] ; then
1419 MILL_VERSION=$( grep -F " DEFAULT_MILL_VERSION=" " mill" | head -n 1 | cut -d= -f2)
1520 else
@@ -35,15 +40,28 @@ if [ ! -s "$MILL_EXEC_PATH" ] ; then
3540 fi
3641 DOWNLOAD_FILE=$MILL_EXEC_PATH -tmp-download
3742 MILL_VERSION_TAG=$( echo $MILL_VERSION | sed -E ' s/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/' )
38- MILL_DOWNLOAD_URL=" https://github. com/lihaoyi/mill/releases/download/ ${MILL_VERSION_TAG} / $MILL_VERSION ${ASSEMBLY} "
43+ MILL_DOWNLOAD_URL=" https://repo1.maven.org/maven2/ com/lihaoyi/mill-dist/ $MILL_VERSION /mill-dist- $MILL_VERSION .jar "
3944 curl --fail -L -o " $DOWNLOAD_FILE " " $MILL_DOWNLOAD_URL "
4045 chmod +x " $DOWNLOAD_FILE "
4146 mv " $DOWNLOAD_FILE " " $MILL_EXEC_PATH "
4247 unset DOWNLOAD_FILE
4348 unset MILL_DOWNLOAD_URL
4449fi
4550
51+ if [ -z " $MILL_MAIN_CLI " ] ; then
52+ MILL_MAIN_CLI=" ${0} "
53+ fi
54+
55+ MILL_FIRST_ARG=" "
56+
57+ # first arg is a long flag for "--interactive" or starts with "-i"
58+ if [ " $1 " = " --bsp" ] || [ " ${1# " -i" } " != " $1 " ] || [ " $1 " = " --interactive" ] || [ " $1 " = " --no-server" ] || [ " $1 " = " --repl" ] || [ " $1 " = " --help" ] ; then
59+ # Need to preserve the first position of those listed options
60+ MILL_FIRST_ARG=$1
61+ shift
62+ fi
63+
4664unset MILL_DOWNLOAD_PATH
4765unset MILL_VERSION
4866
49- exec $MILL_EXEC_PATH " $@ "
67+ exec $MILL_EXEC_PATH $MILL_FIRST_ARG -D " mill.main.cli= ${MILL_MAIN_CLI} " " $@ "
0 commit comments