Skip to content

Commit b0db0c5

Browse files
committed
wip
1 parent 6a8c498 commit b0db0c5

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

mill

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
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.7
76

87
set -e
98

9+
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
10+
DEFAULT_MILL_VERSION=0.11.12
11+
fi
12+
1013
if [ -z "$MILL_VERSION" ] ; then
1114
if [ -f ".mill-version" ] ; then
1215
MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)"
@@ -37,15 +40,28 @@ if [ ! -s "$MILL_EXEC_PATH" ] ; then
3740
fi
3841
DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
3942
MILL_VERSION_TAG=$(echo $MILL_VERSION | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/')
40-
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"
4144
curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
4245
chmod +x "$DOWNLOAD_FILE"
4346
mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
4447
unset DOWNLOAD_FILE
4548
unset MILL_DOWNLOAD_URL
4649
fi
4750

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+
4864
unset MILL_DOWNLOAD_PATH
4965
unset MILL_VERSION
5066

51-
exec $MILL_EXEC_PATH "$@"
67+
exec $MILL_EXEC_PATH $MILL_FIRST_ARG -D "mill.main.cli=${MILL_MAIN_CLI}" "$@"

0 commit comments

Comments
 (0)