Skip to content

Commit 1faa384

Browse files
Gedochaololgabtgodzik
authored
Bump mill to 0.12 (#3691)
* Bump `mill` to 0.12.14 Co-authored-by: Lorenzo Gabriele <[email protected]> * Bump `mill-scalafix` to 0.5.1 & apply `RemoveUnused` in Scala 3 modules Co-authored-by: Lorenzo Gabriele <[email protected]> * Migrate from deprecated syntax from Mill <0.12 * Apply suggestions from code review Co-authored-by: Tomasz Godzik <[email protected]> --------- Co-authored-by: Lorenzo Gabriele <[email protected]> Co-authored-by: Tomasz Godzik <[email protected]>
1 parent 465c3f9 commit 1faa384

File tree

278 files changed

+1079
-1565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

278 files changed

+1079
-1565
lines changed

.github/scripts/build-linux-aarch64-from-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ eval "$(cs java --env --jvm temurin:17 --jvm-index https://github.com/coursier/j
1212
git config --global --add safe.directory "$(pwd)"
1313

1414
./mill -i show 'cli[]'.nativeImage
15-
./mill -i copyDefaultLauncher ./artifacts
15+
./mill -i copyDefaultLauncher --directory ./artifacts
1616
if "true" == $(./mill -i ci.shouldPublish); then
1717
.github/scripts/generate-os-packages.sh
1818
fi

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ val modules =
1010

1111
for { module <- modules } {
1212
println(s"Checking for $module...")
13-
val depRegex = "[│└\\S\\s]+\\s([\\w.-]+):([\\w.-]+):([\\w\\s\\S.-]+)".r
13+
val depRegex = "\\[\\d+]\\s+[│└├\\S\\s]+\\s([\\w.-]+):([\\w.-]+):([\\w\\s\\S.-]+)".r
1414
val scalaDepSuffixRegex = "^(.+?)(_[23](?:\\.\\d{2})?)?$".r
1515
val deps = os.proc(os.pwd / "mill", "-i", s"$module.ivyDepsTree")
1616
.call(cwd = os.pwd)
1717
.out
1818
.lines()
19+
.filter(_.count(_ == ':') == 2)
1920
.map { case depRegex(org, name, depVersion) => (org, name, depVersion) }
2021
val scalaVersionsByOrgAndName = deps
2122
.groupBy { case (org, scalaDepSuffixRegex(nameWithoutSuffix, _), _) =>

.github/scripts/generate-docker-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
55
WORKDIR="$ROOT/out/docker-workdir"
66

77
mkdir -p "$WORKDIR"
8-
./mill -i copyTo 'cli[]'.nativeImageStatic "$WORKDIR/scala-cli" 1>&2
8+
./mill -i copyTo --task 'cli[]'.nativeImageStatic --dest "$WORKDIR/scala-cli" 1>&2
99

1010
cd "$WORKDIR"
1111
docker build -t scala-cli -f "$ROOT/.github/scripts/docker/ScalaCliDockerFile" .

.github/scripts/generate-native-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
1919
MAX_RETRIES=5
2020
RETRY_COUNT=0
2121
while (( RETRY_COUNT < MAX_RETRIES )); do
22-
./mill.bat -i "$COMMAND" generate-native-image.bat
22+
./mill.bat -i "$COMMAND" --scriptDest generate-native-image.bat
2323

2424
if [[ $? -ne 0 ]]; then
2525
echo "Error occurred during 'mill.bat -i $COMMAND generate-native-image.bat' command. Retrying... ($((RETRY_COUNT + 1))/$MAX_RETRIES)"

.github/scripts/generate-os-packages.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ launcher() {
3434
launcherName="scala"
3535
fi
3636

37-
"$mill" -i copyTo "$launcherMillCommand" "$launcherName" 1>&2
37+
"$mill" -i copyTo --task "$launcherMillCommand" --dest "$launcherName" 1>&2
3838
echo "$launcherName"
3939
}
4040

4141
version() {
42-
"$mill" -i writePackageVersionTo scala-cli-version 1>&2
42+
"$mill" -i writePackageVersionTo --dest scala-cli-version 1>&2
4343
cat scala-cli-version
4444
}
4545

4646
shortVersion() {
47-
"$mill" -i writeShortPackageVersionTo scala-cli-short-version 1>&2
47+
"$mill" -i writeShortPackageVersionTo --dest scala-cli-short-version 1>&2
4848
cat scala-cli-short-version
4949
}
5050

@@ -89,7 +89,7 @@ generate_msi() {
8989

9090
# Having the MSI automatically install Visual C++ redistributable when needed,
9191
# see https://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_vcredist.html
92-
"$mill" -i ci.writeWixConfigExtra wix-visual-cpp-redist.xml
92+
"$mill" -i ci.writeWixConfigExtra --dest wix-visual-cpp-redist.xml
9393

9494
packager \
9595
--msi \

.github/scripts/generate-slim-docker-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
55
WORKDIR="$ROOT/out/docker-slim-workdir"
66

77
mkdir -p "$WORKDIR"
8-
./mill -i copyTo 'cli[]'.nativeImageMostlyStatic "$WORKDIR/scala-cli" 1>&2
8+
./mill -i copyTo --task 'cli[]'.nativeImageMostlyStatic --dest "$WORKDIR/scala-cli" 1>&2
99

1010
cd "$WORKDIR"
1111
docker build -t scala-cli-slim -f "$ROOT/.github/scripts/docker/ScalaCliSlimDockerFile" .

.github/scripts/publish-sdkman.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
set -eu
1111

1212
version() {
13-
"./mill" -i writePackageVersionTo scala-cli-version 1>&2
13+
"./mill" -i writePackageVersionTo --dest scala-cli-version 1>&2
1414
cat scala-cli-version
1515
}
1616

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
with:
2626
jvm: "temurin:17"
2727
- name: Copy launcher
28-
run: ./mill -i copyJvmLauncher artifacts/
28+
run: ./mill -i copyJvmLauncher --directory artifacts/
2929
if: runner.os == 'Linux'
3030
- name: Copy bootstrapped launcher
31-
run: ./mill -i copyJvmBootstrappedLauncher artifacts/
31+
run: ./mill -i copyJvmBootstrappedLauncher --directory artifacts/
3232
if: runner.os == 'Linux'
3333
- uses: actions/upload-artifact@v4
3434
if: runner.os == 'Linux'
@@ -217,7 +217,7 @@ jobs:
217217
if: env.SHOULD_PUBLISH == 'true'
218218
run: .github/scripts/generate-os-packages.sh
219219
- name: Copy artifacts
220-
run: ./mill -i copyDefaultLauncher artifacts/
220+
run: ./mill -i copyDefaultLauncher --directory artifacts/
221221
- uses: actions/upload-artifact@v4
222222
with:
223223
name: linux-launchers
@@ -433,7 +433,7 @@ jobs:
433433
if: env.SHOULD_PUBLISH == 'true'
434434
run: .github/scripts/generate-os-packages.sh
435435
- name: Copy artifacts
436-
run: ./mill -i copyDefaultLauncher artifacts/
436+
run: ./mill -i copyDefaultLauncher --directory artifacts/
437437
- uses: actions/upload-artifact@v4
438438
with:
439439
name: macos-launchers
@@ -636,7 +636,7 @@ jobs:
636636
if: env.SHOULD_PUBLISH == 'true'
637637
run: .github/scripts/generate-os-packages.sh
638638
- name: Copy artifacts
639-
run: ./mill -i copyDefaultLauncher artifacts/
639+
run: ./mill -i copyDefaultLauncher --directory artifacts/
640640
- uses: actions/upload-artifact@v4
641641
with:
642642
name: macos-m1-launchers
@@ -842,7 +842,7 @@ jobs:
842842
run: .github/scripts/generate-os-packages.sh
843843
shell: bash
844844
- name: Copy artifacts
845-
run: ./mill -i copyDefaultLauncher artifacts/
845+
run: ./mill -i copyDefaultLauncher --directory artifacts/
846846
- uses: actions/upload-artifact@v4
847847
with:
848848
name: windows-launchers
@@ -1070,7 +1070,7 @@ jobs:
10701070
run: .github/scripts/generate-native-image.sh mostly-static
10711071
shell: bash
10721072
- name: Copy artifacts
1073-
run: ./mill -i copyMostlyStaticLauncher artifacts/
1073+
run: ./mill -i copyMostlyStaticLauncher --directory artifacts/
10741074
- uses: actions/upload-artifact@v4
10751075
with:
10761076
name: mostly-static-launchers
@@ -1273,7 +1273,7 @@ jobs:
12731273
run: .github/scripts/generate-native-image.sh static
12741274
shell: bash
12751275
- name: Copy artifacts
1276-
run: ./mill -i copyStaticLauncher artifacts/
1276+
run: ./mill -i copyStaticLauncher --directory artifacts/
12771277
- uses: actions/upload-artifact@v4
12781278
with:
12791279
name: static-launchers
@@ -1570,7 +1570,7 @@ jobs:
15701570
- name: Java Home
15711571
run: echo "$JAVA_HOME"
15721572
- name: Build Scala CLI
1573-
run: ./mill copyJvmLauncher build
1573+
run: ./mill copyJvmLauncher --directory build
15741574
- name: Build Benchmark
15751575
run: java -jar ./build/scala-cli --power package --standalone gcbenchmark/gcbenchmark.scala -o gc
15761576
- name: Run Benchmark

.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.11.13
1+
0.12.14

.scalafix.legacy.conf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Same as .scalafix3.conf, but targets Scala2
2+
rules = [
3+
DisableSyntax,
4+
# RemoveUnused,
5+
OrganizeImports,
6+
NoValInForComprehension,
7+
# ProcedureSyntax
8+
]
9+
DisableSyntax.noFinalize = true
10+
DisableSyntax.noIsInstanceOf = true
11+
DisableSyntax.noReturns = true
12+
13+
// `rules` on compilation
14+
triggered.rules = [
15+
DisableSyntax
16+
]
17+
18+
OrganizeImports {
19+
coalesceToWildcardImportThreshold = 6
20+
expandRelative = true
21+
groups = ["*", "re:javax?\\.", "scala."]
22+
groupedImports = AggressiveMerge
23+
removeUnused = false # added for Scala 3
24+
targetDialect = Scala2
25+
}

0 commit comments

Comments
 (0)