Skip to content

Commit 4dc415e

Browse files
authored
Bump Mill to 0.12.16 (was 0.12.15) (#3881)
1 parent a29adba commit 4dc415e

File tree

3 files changed

+53
-17
lines changed

3 files changed

+53
-17
lines changed

.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.15
1+
0.12.16

mill.bat

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ rem This script determines the Mill version to use by trying these sources
66
rem - env-variable `MILL_VERSION`
77
rem - local file `.mill-version`
88
rem - local file `.config/mill-version`
9-
rem - `mill-version` from YAML fronmatter of current buildfile
9+
rem - `mill-version` from YAML frontmatter of current buildfile
1010
rem - if accessible, find the latest stable version available on Maven Central (https://repo1.maven.org/maven2)
1111
rem - env-variable `DEFAULT_MILL_VERSION`
1212
rem
@@ -23,7 +23,7 @@ rem this script downloads a binary file from Maven Central or Github Pages (this
2323
rem into a cache location (%USERPROFILE%\.mill\download).
2424
rem
2525
rem Mill Project URL: https://github.com/com-lihaoyi/mill
26-
rem Script Version: 1.0.0-M1-21-7b6fae-DIRTY892b63e8
26+
rem Script Version: 1.0.5
2727
rem
2828
rem If you want to improve this script, please also contribute your changes back!
2929
rem This script was generated from: dist/scripts/src/mill.bat
@@ -34,7 +34,7 @@ rem setlocal seems to be unavailable on Windows 95/98/ME
3434
rem but I don't think we need to support them in 2019
3535
setlocal enabledelayedexpansion
3636

37-
if [!DEFAULT_MILL_VERSION!]==[] ( set "DEFAULT_MILL_VERSION=0.12.15" )
37+
if [!DEFAULT_MILL_VERSION!]==[] ( set "DEFAULT_MILL_VERSION=0.12.16" )
3838

3939
if [!MILL_GITHUB_RELEASE_CDN!]==[] ( set "MILL_GITHUB_RELEASE_CDN=" )
4040

@@ -66,17 +66,47 @@ if [!MILL_VERSION!]==[] (
6666
set /p MILL_VERSION=<.config\mill-version
6767
) else (
6868
if not "%MILL_BUILD_SCRIPT%"=="" (
69-
for /f "tokens=1-2*" %%a in ('findstr /C:"//| mill-version:" %MILL_BUILD_SCRIPT%') do (
70-
set "MILL_VERSION=%%c"
69+
rem Find the line and process it
70+
for /f "tokens=*" %%a in ('findstr /R /C:"//\|.*mill-version" "%MILL_BUILD_SCRIPT%"') do (
71+
set "line=%%a"
72+
73+
rem --- 1. Replicate sed 's/.*://' ---
74+
rem This removes everything up to and including the first colon
75+
set "line=!line:*:=!"
76+
77+
rem --- 2. Replicate sed 's/#.*//' ---
78+
rem Split on '#' and keep the first part
79+
for /f "tokens=1 delims=#" %%b in ("!line!") do (
80+
set "line=%%b"
81+
)
82+
83+
rem --- 3. Replicate sed 's/['"]//g' ---
84+
rem Remove all quotes
85+
set "line=!line:'=!"
86+
set "line=!line:"=!"
87+
88+
rem --- 4. NEW: Replicate sed's trim/space removal ---
89+
rem Remove all space characters from the result. This is more robust.
90+
set "MILL_VERSION=!line: =!"
91+
92+
rem We found the version, so we can exit the loop
93+
goto :version_found
7194
)
95+
96+
:version_found
97+
rem no-op
7298
) else (
7399
rem no-op
74100
)
75101
)
76102
)
77103
)
78104

79-
if [!MILL_VERSION!]==[] set MILL_VERSION=%DEFAULT_MILL_VERSION%
105+
if [!MILL_VERSION!]==[] (
106+
echo No mill version specified. >&2
107+
echo You should provide a version via a '//^| mill-version: ' comment or a '.mill-version' file. >&2
108+
set MILL_VERSION=%DEFAULT_MILL_VERSION%
109+
)
80110

81111
if [!MILL_DOWNLOAD_PATH!]==[] set MILL_DOWNLOAD_PATH=%USERPROFILE%\.mill\download
82112

millw

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# - env-variable `MILL_VERSION`
77
# - local file `.mill-version`
88
# - local file `.config/mill-version`
9-
# - `mill-version` from YAML fronmatter of current buildfile
9+
# - `mill-version` from YAML frontmatter of current buildfile
1010
# - if accessible, find the latest stable version available on Maven Central (https://repo1.maven.org/maven2)
1111
# - env-variable `DEFAULT_MILL_VERSION`
1212
#
@@ -23,7 +23,7 @@
2323
# into a cache location (~/.cache/mill/download).
2424
#
2525
# Mill Project URL: https://github.com/com-lihaoyi/mill
26-
# Script Version: 1.0.0-M1-21-7b6fae-DIRTY892b63e8
26+
# Script Version: 1.0.5
2727
#
2828
# If you want to improve this script, please also contribute your changes back!
2929
# This script was generated from: dist/scripts/src/mill.sh
@@ -32,14 +32,8 @@
3232

3333
set -e
3434

35-
if [ "$1" = "--setup-completions" ] ; then
36-
# Need to preserve the first position of those listed options
37-
MILL_FIRST_ARG=$1
38-
shift
39-
fi
40-
4135
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
42-
DEFAULT_MILL_VERSION=0.12.15
36+
DEFAULT_MILL_VERSION="0.12.16"
4337
fi
4438

4539

@@ -79,7 +73,19 @@ if [ -z "${MILL_VERSION}" ] ; then
7973
elif [ -f ".config/mill-version" ] ; then
8074
MILL_VERSION="$(tr '\r' '\n' < .config/mill-version | head -n 1 2> /dev/null)"
8175
elif [ -n "${MILL_BUILD_SCRIPT}" ] ; then
82-
MILL_VERSION="$(cat ${MILL_BUILD_SCRIPT} | grep '//[|] *mill-version: *' | sed 's;//| *mill-version: *;;')"
76+
# `s/.*://`:
77+
# This is a greedy match that removes everything from the beginning of the line up to (and including) the last
78+
# colon (:). This effectively isolates the value part of the declaration.
79+
#
80+
# `s/#.*//`:
81+
# This removes any comments at the end of the line.
82+
#
83+
# `s/['\"]//g`:
84+
# This removes all single and double quotes from the string, wherever they appear (g is for "global").
85+
#
86+
# `s/^[[:space:]]*//; s/[[:space:]]*$//`:
87+
# These two expressions trim any leading or trailing whitespace ([[:space:]] matches spaces and tabs).
88+
MILL_VERSION="$(grep -E "//\|.*mill-version" "${MILL_BUILD_SCRIPT}" | sed -E "s/.*://; s/#.*//; s/['\"]//g; s/^[[:space:]]*//; s/[[:space:]]*$//")"
8389
fi
8490
fi
8591

0 commit comments

Comments
 (0)