summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2019-07-08 05:38:55 +0800
committerGitHub <noreply@github.com>2019-07-08 05:38:55 +0800
commita8d1adf065f3e494bb91034960afcc7198957a2e (patch)
tree0e43bab1d48fcfd79e9281c283019d06ddb2530c
parent79a63fb3f12e9fc856e22cdc5eba9095ad882051 (diff)
downloadmill-a8d1adf065f3e494bb91034960afcc7198957a2e.tar.gz
mill-a8d1adf065f3e494bb91034960afcc7198957a2e.tar.bz2
mill-a8d1adf065f3e494bb91034960afcc7198957a2e.zip
Consolidate ./mill and ./millw script (#650)
* . * ensure MILL_VERSION environment variable always takes precedence over .mill-version file, which takes precedence over DEFAULT_MILL_VERSION
-rwxr-xr-xbuild.sc2
-rwxr-xr-xmill6
-rwxr-xr-xmillw59
3 files changed, 6 insertions, 61 deletions
diff --git a/build.sc b/build.sc
index ce02aa95..ed0a838c 100755
--- a/build.sc
+++ b/build.sc
@@ -456,7 +456,7 @@ def launcherScript(shellJvmArgs: Seq[String],
if (millBootstrapString == "") ""
else {
val cutCount = millBootstrapGrepPrefix.length + 1
- s"""if [ -f "$$PWD/mill" ] ; then
+ s"""if [ -f "mill" ] ; then
| if [ -z "$$MILL_EXEC_PATH" ] ; then
| MILL_VERSION=$$(grep -F "$millBootstrapGrepPrefix" "$$PWD/mill" | cut -c $cutCount-)
| ${millBootstrapStringValue.replace("\n", "\n ")}
diff --git a/mill b/mill
index abd5a6bf..3d073df4 100755
--- a/mill
+++ b/mill
@@ -8,7 +8,11 @@ DEFAULT_MILL_VERSION=0.4.2
set -e
if [ -z "$MILL_VERSION" ] ; then
- MILL_VERSION=$DEFAULT_MILL_VERSION
+ if [ -f ".mill-version" ] ; then
+ MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)"
+ else
+ MILL_VERSION=$DEFAULT_MILL_VERSION
+ fi
fi
MILL_DOWNLOAD_PATH="$HOME/.mill/download"
diff --git a/millw b/millw
deleted file mode 100755
index 7650fad9..00000000
--- a/millw
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env sh
-
-# This is a wrapper script, that automatically download mill from GitHub release pages
-# You can give the required mill version with --mill-version parameter
-# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
-
-DEFAULT_MILL_VERSION=0.4.1
-
-set -e
-
-if [ -f ".mill-version" ] ; then
- MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)"
-fi
-
-if [ "x$1" = "x--mill-version" ] ; then
- shift
- if [ "x$1" != "x" ] ; then
- MILL_VERSION="$1"
- shift
- else
- echo "You specified --mill-version without a version."
- echo "Please provide a version that matches one provided on"
- echo "https://github.com/lihaoyi/mill/releases"
- false
- fi
-fi
-
-MILL_DOWNLOAD_PATH="${HOME}/.mill/download"
-
-if [ "x${MILL_VERSION}" = "x" ] ; then
- # TODO: try to load latest version from release page
- echo -n "Retrieving latest mill version..."
- if [ -e "${MILL_DOWNLOAD_PATH}/.latest" ] ; then
-
- MILL_VERSION="$(head -n 1 \"${MILL_DOWNLOAD_PATH}/.latest\" 2> /dev/null)"
- fi
-
- # Last resort
- if [ "x${MILL_VERSION}" = "x" ] ; then
- MILL_VERSION="${DEFAULT_MILL_VERSION}"
- fi
-fi
-
-MILL="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"
-
-if [ ! -x "${MILL}" ] ; then
- DOWNLOAD_FILE=$(mktemp mill.XXXX)
- # TODO: handle command not found
- curl -L -o "${DOWNLOAD_FILE}" "https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/${MILL_VERSION}"
- chmod +x "${DOWNLOAD_FILE}"
- mkdir -p "${MILL_DOWNLOAD_PATH}"
- mv "${DOWNLOAD_FILE}" "${MILL}"
- unset DOWNLOAD_FILE
-fi
-
-unset MILL_DOWNLOAD_PATH
-unset MILL_VERSION
-
-exec $MILL "$@"