Skip to content

Commit b07a1fb

Browse files
committed
Bump Mill to 1.0.5 (was 0.12.15)
1 parent a29adba commit b07a1fb

File tree

10 files changed

+420
-348
lines changed

10 files changed

+420
-348
lines changed

.github/scripts/check-cross-version-deps.sc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ val modules =
1111

1212
for { module <- modules } {
1313
println(s"Checking for $module...")
14-
val depRegex = "\\[\\d+]\\s+[│└├─\\S\\s]+\\s([\\w.-]+):([\\w.-]+):([\\w\\s\\S.-]+)".r
14+
val depRegex = "[│└├─\\S\\s]+\\s([\\w.-]+):([\\w.-]+):([\\w\\s\\S.-]+)".r
1515
val scalaDepSuffixRegex = "^(.+?)(_[23](?:\\.\\d{2})?)?$".r
16-
val deps = os.proc(os.pwd / "mill", "-i", s"$module.ivyDepsTree")
16+
val deps = os.proc(os.pwd / "mill", "-i", s"$module.showMvnDepsTree")
1717
.call(cwd = os.pwd)
1818
.out
1919
.lines()

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ jobs:
15361536
- name: Check native-image config format
15371537
run: ./mill -i __.checkNativeImageConfFormat
15381538
- name: Check Ammonite availability
1539-
run: ./mill -i 'dummy.amm[_].resolvedRunIvyDeps'
1539+
run: ./mill -i 'dummy.amm[_].resolvedRunMvnDeps'
15401540
- name: Check for cross Scala version conflicts
15411541
run: .github/scripts/check-cross-version-deps.sc
15421542
- name: Scalafix check

.mill-version

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

build.mill.scala

Lines changed: 235 additions & 219 deletions
Large diffs are not rendered by default.

mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false
8484
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
8585

8686
if [[ $IS_WINDOWS ]]; then
87-
exec "$DIR/millw" "$@"
87+
exec "$DIR/mill.bat" "$@"
8888
else
8989
exec "$DIR/millw" $COMMAND
9090
fi

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=1.0.5" )
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="1.0.5"
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

project/deps/package.mill.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package build.project.deps
2-
import mill._
3-
import scalalib._
2+
3+
import mill.*
4+
import mill.api.BuildInfo
5+
import scalalib.*
46

57
object Cli {
68
def runnerLegacyVersion = "1.7.1" // last runner version to support pre-LTS Scala 3 versions
@@ -100,7 +102,7 @@ object TestDeps {
100102

101103
object InternalDeps {
102104
object Versions {
103-
def mill: String = _root_.mill.main.BuildInfo.millVersion
105+
def mill: String = BuildInfo.millVersion
104106
def lefouMillwRef = "166bcdf5741de8569e0630e18c3b2ef7e252cd96"
105107
}
106108
}

project/publish/package.mill.scala

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
package build.project.publish
2-
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
3-
import $ivy.`org.eclipse.jgit:org.eclipse.jgit:7.3.0.202506031305-r`
2+
43
import build.project.settings
54
import com.lumidion.sonatype.central.client.core.{PublishingType, SonatypeCredentials}
65
import settings.{PublishLocalNoFluff, workspaceDirName}
7-
import de.tobiasroeser.mill.vcs.version._
8-
import mill._
6+
import mill.*
97
import mill.javalib.publish.Artifact
10-
import scalalib._
8+
import mill.util.{Tasks, VcsVersion}
9+
import scalalib.*
1110
import org.eclipse.jgit.api.Git
11+
import mill.api.{BuildCtx, ModuleCtx, Task}
1212

1313
import java.nio.charset.Charset
14-
import scala.concurrent.duration._
15-
import scala.jdk.CollectionConverters._
14+
import scala.concurrent.duration.*
15+
import scala.jdk.CollectionConverters.*
1616

17-
lazy val (ghOrg: String, ghName: String) = {
17+
def gh: (ghOrg: String, ghName: String) = {
1818
def default = ("VirtusLab", "scala-cli")
1919
val isCI = System.getenv("CI") != null
2020
if (isCI) {
@@ -62,7 +62,9 @@ lazy val (ghOrg: String, ghName: String) = {
6262
default
6363
}
6464

65-
private def computePublishVersion(state: VcsState, simple: Boolean): String =
65+
lazy val (ghOrg: String, ghName: String) = gh
66+
67+
private def computePublishVersion(state: VcsVersion.State, simple: Boolean): String =
6668
if (state.commitsSinceLastTag > 0)
6769
if (simple) {
6870
val versionOrEmpty = state.lastTag
@@ -141,15 +143,18 @@ trait ScalaCliPublishModule extends SonatypeCentralPublishModule with PublishLoc
141143
)
142144
override def publishVersion: T[String] = finalPublishVersion()
143145
override def sourceJar: T[PathRef] = Task {
144-
import mill.util.Jvm.createJar
145-
val allSources0 = allSources().map(_.path).filter(os.exists).toSet
146-
createJar(
147-
allSources0 ++ resources().map(_.path).filter(os.exists),
148-
manifest(),
149-
(input, relPath) =>
150-
!allSources0(input) ||
151-
(!relPath.segments.contains(".scala") && !relPath.segments.contains(workspaceDirName))
152-
)
146+
PathRef {
147+
import mill.util.Jvm.createJar
148+
val allSources0 = allSources().map(_.path).filter(os.exists)
149+
createJar(
150+
jar = Task.dest / "out.jar",
151+
inputPaths = allSources0 ++ resources().map(_.path).filter(os.exists),
152+
manifest = manifest(),
153+
fileFilter = (input, relPath) =>
154+
!allSources0.toSet(input) ||
155+
(!relPath.segments.contains(".scala") && !relPath.segments.contains(workspaceDirName))
156+
)
157+
}
153158
}
154159
}
155160

@@ -211,7 +216,7 @@ def publishSonatype(
211216
publisher.publishAll(
212217
publishingType = publishingType,
213218
singleBundleName = finalBundleName,
214-
artifacts = artifacts: _*
219+
artifacts = artifacts*
215220
)
216221
}
217222

@@ -235,7 +240,7 @@ def setShouldPublish() = Task.Command {
235240
val charSet = Charset.defaultCharset()
236241
val nl = System.lineSeparator()
237242
os.write.append(
238-
os.Path(envFile, Task.workspace),
243+
os.Path(envFile, BuildCtx.workspaceRoot),
239244
s"SHOULD_PUBLISH=${shouldPublish()}$nl".getBytes(charSet)
240245
)
241246
}

0 commit comments

Comments
 (0)