@@ -6,7 +6,7 @@ rem This script determines the Mill version to use by trying these sources
6
6
rem - env-variable `MILL_VERSION`
7
7
rem - local file `.mill-version`
8
8
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
10
10
rem - if accessible, find the latest stable version available on Maven Central (https://repo1.maven.org/maven2)
11
11
rem - env-variable `DEFAULT_MILL_VERSION`
12
12
rem
@@ -23,7 +23,7 @@ rem this script downloads a binary file from Maven Central or Github Pages (this
23
23
rem into a cache location (%USERPROFILE%\.mill\download).
24
24
rem
25
25
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
27
27
rem
28
28
rem If you want to improve this script, please also contribute your changes back!
29
29
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
34
34
rem but I don't think we need to support them in 2019
35
35
setlocal enabledelayedexpansion
36
36
37
- if [!DEFAULT_MILL_VERSION! ]== [] ( set " DEFAULT_MILL_VERSION = 0.12.15 " )
37
+ if [!DEFAULT_MILL_VERSION! ]== [] ( set " DEFAULT_MILL_VERSION = 0.12.16 " )
38
38
39
39
if [!MILL_GITHUB_RELEASE_CDN! ]== [] ( set " MILL_GITHUB_RELEASE_CDN = " )
40
40
@@ -66,17 +66,47 @@ if [!MILL_VERSION!]==[] (
66
66
set /p MILL_VERSION = < .config\mill-version
67
67
) else (
68
68
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
71
94
)
95
+
96
+ :version_found
97
+ rem no-op
72
98
) else (
73
99
rem no-op
74
100
)
75
101
)
76
102
)
77
103
)
78
104
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
+ )
80
110
81
111
if [!MILL_DOWNLOAD_PATH! ]== [] set MILL_DOWNLOAD_PATH = %USERPROFILE% \.mill\download
82
112
0 commit comments