Skip to content

Commit 4b4972b

Browse files
authored
Update Mill to 0.10.12 (#163)
Required to fix scala-js/scala-js-js-envs#12 in CI.
1 parent a3516ad commit 4b4972b

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

.mill-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.10.12

build.sc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ val sjsonnetVersion = "0.4.3-SNAPSHOT"
33

44
object sjsonnet extends Cross[SjsonnetModule]("2.12.13", "2.13.4")
55
class SjsonnetModule(val crossScalaVersion: String) extends Module {
6-
def millSourcePath = super.millSourcePath / ammonite.ops.up
6+
def millSourcePath = super.millSourcePath / os.up
77
trait SjsonnetJvmNative extends SjsonnetCrossModule {
88
def ivyDeps = super.ivyDeps() ++ Agg(
99
ivy"com.lihaoyi::os-lib::0.7.2",

mill

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,63 @@
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.9.5-7-f9a698
76

87
set -e
98

9+
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
10+
DEFAULT_MILL_VERSION=0.10.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)"
13-
elif [ -f "mill" ] && [ "$BASH_SOURCE" != "mill" ] ; then
16+
elif [ -f ".config/mill-version" ] ; then
17+
MILL_VERSION="$(head -n 1 .config/mill-version 2> /dev/null)"
18+
elif [ -f "mill" ] && [ "$0" != "mill" ] ; then
1419
MILL_VERSION=$(grep -F "DEFAULT_MILL_VERSION=" "mill" | head -n 1 | cut -d= -f2)
1520
else
1621
MILL_VERSION=$DEFAULT_MILL_VERSION
1722
fi
1823
fi
1924

20-
MILL_DOWNLOAD_PATH="$HOME/.mill/download"
21-
MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/$MILL_VERSION"
25+
if [ "x${XDG_CACHE_HOME}" != "x" ] ; then
26+
MILL_DOWNLOAD_PATH="${XDG_CACHE_HOME}/mill/download"
27+
else
28+
MILL_DOWNLOAD_PATH="${HOME}/.cache/mill/download"
29+
fi
30+
MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"
2231

23-
if [ ! -x "$MILL_EXEC_PATH" ] ; then
24-
mkdir -p $MILL_DOWNLOAD_PATH
32+
version_remainder="$MILL_VERSION"
33+
MILL_MAJOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
34+
MILL_MINOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
35+
36+
if [ ! -s "$MILL_EXEC_PATH" ] ; then
37+
mkdir -p "$MILL_DOWNLOAD_PATH"
38+
if [ "$MILL_MAJOR_VERSION" -gt 0 ] || [ "$MILL_MINOR_VERSION" -ge 5 ] ; then
39+
ASSEMBLY="-assembly"
40+
fi
2541
DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
26-
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/$MILL_VERSION-assembly"
42+
MILL_VERSION_TAG=$(echo $MILL_VERSION | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/')
43+
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION_TAG}/$MILL_VERSION${ASSEMBLY}"
2744
curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
2845
chmod +x "$DOWNLOAD_FILE"
2946
mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
3047
unset DOWNLOAD_FILE
3148
unset MILL_DOWNLOAD_URL
3249
fi
3350

51+
if [ -z "$MILL_MAIN_CLI" ] ; then
52+
MILL_MAIN_CLI="${0}"
53+
fi
54+
55+
MILL_FIRST_ARG=""
56+
if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
57+
# Need to preserve the first position of those listed options
58+
MILL_FIRST_ARG=$1
59+
shift
60+
fi
61+
3462
unset MILL_DOWNLOAD_PATH
3563
unset MILL_VERSION
3664

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

0 commit comments

Comments
 (0)