Skip to content

Commit

Permalink
Upgrade mill script
Browse files Browse the repository at this point in the history
  • Loading branch information
joan38 committed Feb 22, 2025
1 parent a2083e6 commit 3cc4acd
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions mill
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
set -e

if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
DEFAULT_MILL_VERSION=0.12.5
DEFAULT_MILL_VERSION=0.13.0-M0
fi


Expand Down Expand Up @@ -101,7 +101,31 @@ if [ -z "${MILL_VERSION}" ] ; then
fi
fi

MILL="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"
MILL_NATIVE_SUFFIX="-native"
FULL_MILL_VERSION=$MILL_VERSION
ARTIFACT_SUFFIX=""
case "$MILL_VERSION" in
*"$MILL_NATIVE_SUFFIX")
MILL_VERSION=${MILL_VERSION%"$MILL_NATIVE_SUFFIX"}
if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" = "Linux" ]; then
if [ "$(uname -m)" = "aarch64" ]; then
ARTIFACT_SUFFIX="-native-linux-aarch64"
else
ARTIFACT_SUFFIX="-native-linux-amd64"
fi
elif [ "$(uname)" = "Darwin" ]; then
if [ "$(uname -m)" = "arm64" ]; then
ARTIFACT_SUFFIX="-native-mac-aarch64"
else
ARTIFACT_SUFFIX="-native-mac-amd64"
fi
else
echo "This native mill launcher supports only Linux and macOS." 1>&2
exit 1
fi
esac

MILL="${MILL_DOWNLOAD_PATH}/${FULL_MILL_VERSION}"

try_to_use_system_mill() {
if [ "$(uname)" != "Linux" ]; then
Expand Down Expand Up @@ -200,7 +224,7 @@ if [ ! -s "${MILL}" ] ; then
DOWNLOAD_FILE=$(mktemp mill.XXXXXX)

if [ "$DOWNLOAD_FROM_MAVEN" = "1" ] ; then
DOWNLOAD_URL="https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/${MILL_VERSION}/mill-dist-${MILL_VERSION}.jar"
DOWNLOAD_URL="https://repo1.maven.org/maven2/com/lihaoyi/mill-dist${ARTIFACT_SUFFIX}/${MILL_VERSION}/mill-dist${ARTIFACT_SUFFIX}-${MILL_VERSION}.jar"
else
MILL_VERSION_TAG=$(echo "$MILL_VERSION" | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/')
DOWNLOAD_URL="${GITHUB_RELEASE_CDN}${MILL_REPO_URL}/releases/download/${MILL_VERSION_TAG}/${MILL_VERSION}${DOWNLOAD_SUFFIX}"
Expand Down

0 comments on commit 3cc4acd

Please sign in to comment.