Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/scripts/check-cross-version-deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ val modules =

for { module <- modules } {
println(s"Checking for $module...")
val depRegex = "\\[\\d+]\\s+[│└├─\\S\\s]+\\s([\\w.-]+):([\\w.-]+):([\\w\\s\\S.-]+)".r
val depRegex = "[│└├─\\S\\s]+\\s([\\w.-]+):([\\w.-]+):([\\w\\s\\S.-]+)".r
val scalaDepSuffixRegex = "^(.+?)(_[23](?:\\.\\d{2})?)?$".r
val deps = os.proc(os.pwd / "mill", "-i", s"$module.ivyDepsTree")
val deps = os.proc(os.pwd / "mill", "-i", s"$module.showMvnDepsTree")
.call(cwd = os.pwd)
.out
.lines()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ jobs:
- name: Check native-image config format
run: ./mill -i __.checkNativeImageConfFormat
- name: Check Ammonite availability
run: ./mill -i 'dummy.amm[_].resolvedRunIvyDeps'
run: ./mill -i 'dummy.amm[_].resolvedRunMvnDeps'
- name: Check for cross Scala version conflicts
run: .github/scripts/check-cross-version-deps.sc
- name: Scalafix check
Expand Down
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.16
1.0.6
477 changes: 256 additions & 221 deletions build.mill.scala

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mill
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"

if [[ $IS_WINDOWS ]]; then
exec "$DIR/millw" "$@"
exec "$DIR/mill.bat" "$@"
else
exec "$DIR/millw" $COMMAND
fi
103 changes: 37 additions & 66 deletions mill.bat
Original file line number Diff line number Diff line change
@@ -1,40 +1,8 @@
@echo off

rem This is a wrapper script, that automatically selects or downloads Mill from Maven Central or GitHub release pages.
rem
rem This script determines the Mill version to use by trying these sources
rem - env-variable `MILL_VERSION`
rem - local file `.mill-version`
rem - local file `.config/mill-version`
rem - `mill-version` from YAML frontmatter of current buildfile
rem - if accessible, find the latest stable version available on Maven Central (https://repo1.maven.org/maven2)
rem - env-variable `DEFAULT_MILL_VERSION`
rem
rem If a version has the suffix '-native' a native binary will be used.
rem If a version has the suffix '-jvm' an executable jar file will be used, requiring an already installed Java runtime.
rem If no such suffix is found, the script will pick a default based on version and platform.
rem
rem Once a version was determined, it tries to use either
rem - a system-installed mill, if found and it's version matches
rem - an already downloaded version under %USERPROFILE%\.mill\download
rem
rem If no working mill version was found on the system,
rem this script downloads a binary file from Maven Central or Github Pages (this is version dependent)
rem into a cache location (%USERPROFILE%\.mill\download).
rem
rem Mill Project URL: https://github.com/com-lihaoyi/mill
rem Script Version: 1.0.5
rem
rem If you want to improve this script, please also contribute your changes back!
rem This script was generated from: dist/scripts/src/mill.bat
rem
rem Licensed under the Apache License, Version 2.0

rem setlocal seems to be unavailable on Windows 95/98/ME
rem but I don't think we need to support them in 2019
setlocal enabledelayedexpansion

if [!DEFAULT_MILL_VERSION!]==[] ( set "DEFAULT_MILL_VERSION=0.12.16" )
if [!DEFAULT_MILL_VERSION!]==[] ( set "DEFAULT_MILL_VERSION=1.0.6" )

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

Expand Down Expand Up @@ -65,9 +33,24 @@ if [!MILL_VERSION!]==[] (
if exist .config\mill-version (
set /p MILL_VERSION=<.config\mill-version
) else (
if not "%MILL_BUILD_SCRIPT%"=="" (
rem Determine which config file to use for version extraction
set "MILL_VERSION_CONFIG_FILE="
set "MILL_VERSION_SEARCH_PATTERN="

if exist build.mill.yaml (
set "MILL_VERSION_CONFIG_FILE=build.mill.yaml"
set "MILL_VERSION_SEARCH_PATTERN=mill-version:"
) else (
if not "%MILL_BUILD_SCRIPT%"=="" (
set "MILL_VERSION_CONFIG_FILE=%MILL_BUILD_SCRIPT%"
set "MILL_VERSION_SEARCH_PATTERN=//\|.*mill-version"
)
)

rem Process the config file if found
if not "!MILL_VERSION_CONFIG_FILE!"=="" (
rem Find the line and process it
for /f "tokens=*" %%a in ('findstr /R /C:"//\|.*mill-version" "%MILL_BUILD_SCRIPT%"') do (
for /f "tokens=*" %%a in ('findstr /R /C:"!MILL_VERSION_SEARCH_PATTERN!" "!MILL_VERSION_CONFIG_FILE!"') do (
set "line=%%a"

rem --- 1. Replicate sed 's/.*://' ---
Expand All @@ -85,7 +68,7 @@ if [!MILL_VERSION!]==[] (
set "line=!line:'=!"
set "line=!line:"=!"

rem --- 4. NEW: Replicate sed's trim/space removal ---
rem --- 4. Replicate sed's trim/space removal ---
rem Remove all space characters from the result. This is more robust.
set "MILL_VERSION=!line: =!"

Expand All @@ -95,27 +78,23 @@ if [!MILL_VERSION!]==[] (

:version_found
rem no-op
) else (
rem no-op
)
)
)
)

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

if [!MILL_DOWNLOAD_PATH!]==[] set MILL_DOWNLOAD_PATH=%USERPROFILE%\.mill\download
if [!MILL_FINAL_DOWNLOAD_FOLDER!]==[] set MILL_FINAL_DOWNLOAD_FOLDER=%USERPROFILE%\.cache\mill\download

rem without bat file extension, cmd doesn't seem to be able to run it

set "MILL_NATIVE_SUFFIX=-native"
set "MILL_JVM_SUFFIX=-jvm"
set "FULL_MILL_VERSION=%MILL_VERSION%"
set "MILL_EXT=.bat"
set "MILL_FULL_VERSION=%MILL_VERSION%"
set "MILL_DOWNLOAD_EXT=.bat"
set "ARTIFACT_SUFFIX="
REM Check if MILL_VERSION contains MILL_NATIVE_SUFFIX
echo !MILL_VERSION! | findstr /C:"%MILL_NATIVE_SUFFIX%" >nul
Expand All @@ -125,7 +104,7 @@ if !errorlevel! equ 0 (
REM https://github.com/oracle/graal/issues/9215
IF /I NOT "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
set "ARTIFACT_SUFFIX=-native-windows-amd64"
set "MILL_EXT=.exe"
set "MILL_DOWNLOAD_EXT=.exe"
) else (
rem no-op
)
Expand Down Expand Up @@ -153,15 +132,15 @@ if !errorlevel! equ 0 (
if "!SKIP_VERSION!"=="false" (
IF /I NOT "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
set "ARTIFACT_SUFFIX=-native-windows-amd64"
set "MILL_EXT=.exe"
set "MILL_DOWNLOAD_EXT=.exe"
)
) else (
rem no-op
)
)
)

set MILL=%MILL_DOWNLOAD_PATH%\!FULL_MILL_VERSION!!MILL_EXT!
set MILL=%MILL_FINAL_DOWNLOAD_FOLDER%\!MILL_FULL_VERSION!!MILL_DOWNLOAD_EXT!

set MILL_RESOLVE_DOWNLOAD=

Expand Down Expand Up @@ -257,34 +236,26 @@ if [!MILL_RESOLVE_DOWNLOAD!]==[true] (
)

rem there seems to be no way to generate a unique temporary file path (on native Windows)
set MILL_DOWNLOAD_FILE=%MILL%.tmp
if defined MILL_OUTPUT_DIR (
set MILL_TEMP_DOWNLOAD_FILE=%MILL_OUTPUT_DIR%\mill-temp-download
if not exist "%MILL_OUTPUT_DIR%" mkdir "%MILL_OUTPUT_DIR%"
) else (
set MILL_TEMP_DOWNLOAD_FILE=out\mill-bootstrap-download
if not exist "out" mkdir "out"
)

echo Downloading mill !MILL_VERSION! from !MILL_DOWNLOAD_URL! ... 1>&2

if not exist "%MILL_DOWNLOAD_PATH%" mkdir "%MILL_DOWNLOAD_PATH%"
rem curl is bundled with recent Windows 10
rem but I don't think we can expect all the users to have it in 2019
where /Q curl
if !ERRORLEVEL! EQU 0 (
curl -f -L "!MILL_DOWNLOAD_URL!" -o "!MILL_DOWNLOAD_FILE!"
) else (
rem bitsadmin seems to be available on Windows 7
rem without /dynamic, github returns 403
rem bitsadmin is sometimes needlessly slow but it looks better with /priority foreground
bitsadmin /transfer millDownloadJob /dynamic /priority foreground "!MILL_DOWNLOAD_URL!" "!MILL_DOWNLOAD_FILE!"
)
if not exist "!MILL_DOWNLOAD_FILE!" (
echo Could not download mill !MILL_VERSION! 1>&2
exit /b 1
)
curl -f -L "!MILL_DOWNLOAD_URL!" -o "!MILL_TEMP_DOWNLOAD_FILE!"

move /y "!MILL_DOWNLOAD_FILE!" "%MILL%"
if not exist "%MILL_FINAL_DOWNLOAD_FOLDER%" mkdir "%MILL_FINAL_DOWNLOAD_FOLDER%"
move /y "!MILL_TEMP_DOWNLOAD_FILE!" "%MILL%"

set MILL_DOWNLOAD_FILE=
set MILL_TEMP_DOWNLOAD_FILE=
set MILL_DOWNLOAD_SUFFIX=
)

set MILL_DOWNLOAD_PATH=
set MILL_FINAL_DOWNLOAD_FOLDER=
set MILL_VERSION=
set MILL_REPO_URL=

Expand Down
Loading
Loading