From ac444e59a96ac4f307135e0f8416b61f2a36225f Mon Sep 17 00:00:00 2001 From: ex0ns Date: Thu, 15 Jan 2026 08:14:46 +0100 Subject: [PATCH] chore: upgrade mill bootstrap --- mill | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/mill b/mill index 555d7fc7..136be4df 100755 --- a/mill +++ b/mill @@ -6,7 +6,7 @@ # - env-variable `MILL_VERSION` # - local file `.mill-version` # - local file `.config/mill-version` -# - `mill-version` from YAML fronmatter of current buildfile +# - `mill-version` from YAML frontmatter of current buildfile # - if accessible, find the latest stable version available on Maven Central (https://repo1.maven.org/maven2) # - env-variable `DEFAULT_MILL_VERSION` # @@ -23,7 +23,7 @@ # into a cache location (~/.cache/mill/download). # # Mill Project URL: https://github.com/com-lihaoyi/mill -# Script Version: 1.0.0-M1-49-ac90e3 +# Script Version: 1.0.6 # # If you want to improve this script, please also contribute your changes back! # This script was generated from: dist/scripts/src/mill.sh @@ -33,7 +33,7 @@ set -e if [ -z "${DEFAULT_MILL_VERSION}" ] ; then - DEFAULT_MILL_VERSION=0.12.14 + DEFAULT_MILL_VERSION="1.0.6" fi @@ -73,7 +73,19 @@ if [ -z "${MILL_VERSION}" ] ; then elif [ -f ".config/mill-version" ] ; then MILL_VERSION="$(tr '\r' '\n' < .config/mill-version | head -n 1 2> /dev/null)" elif [ -n "${MILL_BUILD_SCRIPT}" ] ; then - MILL_VERSION="$(cat ${MILL_BUILD_SCRIPT} | grep '//[|] *mill-version: *' | sed 's;//| *mill-version: *;;')" + # `s/.*://`: + # This is a greedy match that removes everything from the beginning of the line up to (and including) the last + # colon (:). This effectively isolates the value part of the declaration. + # + # `s/#.*//`: + # This removes any comments at the end of the line. + # + # `s/['\"]//g`: + # This removes all single and double quotes from the string, wherever they appear (g is for "global"). + # + # `s/^[[:space:]]*//; s/[[:space:]]*$//`: + # These two expressions trim any leading or trailing whitespace ([[:space:]] matches spaces and tabs). + MILL_VERSION="$(grep -E "//\|.*mill-version" "${MILL_BUILD_SCRIPT}" | sed -E "s/.*://; s/#.*//; s/['\"]//g; s/^[[:space:]]*//; s/[[:space:]]*$//")" fi fi @@ -309,7 +321,7 @@ if [ -z "$MILL_MAIN_CLI" ] ; then fi MILL_FIRST_ARG="" -if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then +if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--no-daemon" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then # Need to preserve the first position of those listed options MILL_FIRST_ARG=$1 shift