Skip to content

Commit 5c243b5

Browse files
Update mill-main to 0.11.6 (#2572)
* Update mill-main to 0.11.6 * Update default version in `millw` to `0.11.6` * Add missing `jsoniter-macros` dependency * Update default mill version in `mill.bat` to 0.11.6 * Format native image configuration * Fix backwards incompatibilities in the `mill` build definition --------- Co-authored-by: Piotr Chabelski <[email protected]>
1 parent 464ee18 commit 5c243b5

File tree

9 files changed

+69
-88
lines changed

9 files changed

+69
-88
lines changed

.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.11.1
1+
0.11.6

build.sc

Lines changed: 54 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,10 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
848848
super.runClasspath() ++ Seq(localRepoJar())
849849
}
850850

851+
def compileIvyDeps = super.ivyDeps() ++ Agg(
852+
Deps.jsoniterMacros
853+
)
854+
851855
// Required by the reflection usage in modules/cli/src/test/scala/cli/tests/SetupScalaCLITests.scala
852856
override def forkArgs: T[Seq[String]] = T {
853857
super.forkArgs() ++ Seq("--add-opens=java.base/java.util=ALL-UNNAMED")
@@ -949,46 +953,32 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
949953
}
950954
def generatedSources = super.generatedSources() ++ Seq(constantsFile())
951955

952-
private final class TestHelper(
953-
launcherTask: T[PathRef],
954-
cliKind: String
955-
) {
956-
def test(args: String*) = {
957-
val argsTask = T.task {
958-
val launcher = launcherTask().path
959-
val debugReg = "^--debug$|^--debug:([0-9]+)$".r
960-
val debugPortOpt = args.find(debugReg.matches).flatMap {
961-
case debugReg(port) => Option(port).orElse(Some("5005"))
962-
case _ => None
963-
}
964-
val debugArgs = debugPortOpt match {
965-
case Some(port) =>
966-
System.err.println(
967-
s"--debug option has been passed. Listening for transport dt_socket at address: $port"
968-
)
969-
Seq(s"-Dtest.scala-cli.debug.port=$port")
970-
case _ => Seq.empty
971-
}
972-
val extraArgs = Seq(
973-
s"-Dtest.scala-cli.path=$launcher",
974-
s"-Dtest.scala-cli.kind=$cliKind"
975-
)
976-
args ++ extraArgs ++ debugArgs
956+
def runTests(launcherTask: T[PathRef], cliKind: String, args: String*) = {
957+
val argsTask = T.task {
958+
val launcher = launcherTask().path
959+
val debugReg = "^--debug$|^--debug:([0-9]+)$".r
960+
val debugPortOpt = args.find(debugReg.matches).flatMap {
961+
case debugReg(port) => Option(port).orElse(Some("5005"))
962+
case _ => None
977963
}
978-
T.command {
979-
val res = testTask(argsTask, T.task(Seq.empty[String]))()
980-
val dotScalaInRoot = os.pwd / workspaceDirName
981-
assert(
982-
!os.isDir(dotScalaInRoot),
983-
s"Expected $workspaceDirName ($dotScalaInRoot) not to have been created"
984-
)
985-
res
964+
val debugArgs = debugPortOpt match {
965+
case Some(port) =>
966+
System.err.println(
967+
s"--debug option has been passed. Listening for transport dt_socket at address: $port"
968+
)
969+
Seq(s"-Dtest.scala-cli.debug.port=$port")
970+
case _ => Seq.empty
986971
}
972+
val extraArgs = Seq(
973+
s"-Dtest.scala-cli.path=$launcher",
974+
s"-Dtest.scala-cli.kind=$cliKind"
975+
)
976+
args ++ extraArgs ++ debugArgs
987977
}
978+
testTask(argsTask, T.task(Seq.empty[String]))
988979
}
989980

990-
def test(args: String*) =
991-
jvm(args: _*)
981+
override def test(args: String*) = jvm(args: _*)
992982

993983
def forcedLauncher = T.persistent {
994984
val ext = if (Properties.isWin) ".exe" else ""
@@ -1033,36 +1023,38 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
10331023
PathRef(launcher)
10341024
}
10351025

1036-
def jvm(args: String*) =
1037-
new TestHelper(
1038-
cli.standaloneLauncher,
1039-
"jvm"
1040-
).test(args: _*)
1026+
private object Launchers {
1027+
def jvm = cli.standaloneLauncher
1028+
1029+
def jvmBootstrapped = cliBootstrapped.jar
1030+
1031+
def native =
1032+
Option(System.getenv("SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY")) match {
1033+
case Some(_) => forcedLauncher
1034+
case None => cli.nativeImage
1035+
}
1036+
1037+
def nativeStatic =
1038+
Option(System.getenv("SCALA_CLI_IT_FORCED_STATIC_LAUNCHER_DIRECTORY")) match {
1039+
case Some(_) => forcedStaticLauncher
1040+
case None => cli.nativeImageStatic
1041+
}
1042+
1043+
def nativeMostlyStatic =
1044+
Option(System.getenv("SCALA_CLI_IT_FORCED_MOSTLY_STATIC_LAUNCHER_DIRECTORY")) match {
1045+
case Some(_) => forcedMostlyStaticLauncher
1046+
case None => cli.nativeImageMostlyStatic
1047+
}
1048+
}
1049+
1050+
def jvm(args: String*) = T.command(runTests(Launchers.jvm, "jvm", args: _*))
10411051
def jvmBootstrapped(args: String*) =
1042-
new TestHelper(
1043-
cliBootstrapped.jar,
1044-
"jvmBootstrapped"
1045-
).test(args: _*)
1046-
def native(args: String*) =
1047-
new TestHelper(
1048-
if (System.getenv("SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY") == null) cli.nativeImage
1049-
else forcedLauncher,
1050-
"native"
1051-
).test(args: _*)
1052+
T.command(runTests(Launchers.jvmBootstrapped, "jvmBootstrapped", args: _*))
1053+
def native(args: String*) = T.command(runTests(Launchers.native, "native", args: _*))
10521054
def nativeStatic(args: String*) =
1053-
new TestHelper(
1054-
if (System.getenv("SCALA_CLI_IT_FORCED_STATIC_LAUNCHER_DIRECTORY") == null)
1055-
cli.nativeImageStatic
1056-
else forcedStaticLauncher,
1057-
"native-static"
1058-
).test(args: _*)
1055+
T.command(runTests(Launchers.nativeStatic, "native-static", args: _*))
10591056
def nativeMostlyStatic(args: String*) =
1060-
new TestHelper(
1061-
if (System.getenv("SCALA_CLI_IT_FORCED_MOSTLY_STATIC_LAUNCHER_DIRECTORY") == null)
1062-
cli.nativeImageMostlyStatic
1063-
else forcedMostlyStaticLauncher,
1064-
"native-mostly-static"
1065-
).test(args: _*)
1057+
T.command(runTests(Launchers.nativeMostlyStatic, "native-mostly-static", args: _*))
10661058
}
10671059
}
10681060

mill.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ rem but I don't think we need to support them in 2019
1616
setlocal enabledelayedexpansion
1717

1818
if [!DEFAULT_MILL_VERSION!]==[] (
19-
set "DEFAULT_MILL_VERSION=0.10.12"
19+
set "DEFAULT_MILL_VERSION=0.11.6"
2020
)
2121

2222
set "MILL_REPO_URL=https://github.com/com-lihaoyi/mill"

millw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
set -e
1515

1616
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
17-
DEFAULT_MILL_VERSION=0.10.12
17+
DEFAULT_MILL_VERSION=0.11.6
1818
fi
1919

2020

modules/cli/src/main/resources/META-INF/native-image/extras/pprint/reflect-config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"methods": [
55
{
66
"name": "collectionClassName",
7-
"parameterTypes": [
8-
]
7+
"parameterTypes": []
98
}
109
]
1110
}

modules/cli/src/main/resources/META-INF/native-image/org.virtuslab/scala-cli-core/jni-config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"methods": [
2828
{
2929
"name": "getPlatformClassLoader",
30-
"parameterTypes": [
31-
]
30+
"parameterTypes": []
3231
}
3332
]
3433
},

modules/cli/src/main/resources/META-INF/native-image/org.virtuslab/scala-cli-core/reflect-config.json

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,7 @@
828828
"methods": [
829829
{
830830
"name": "<init>",
831-
"parameterTypes": [
832-
]
831+
"parameterTypes": []
833832
}
834833
]
835834
},
@@ -838,8 +837,7 @@
838837
"methods": [
839838
{
840839
"name": "<init>",
841-
"parameterTypes": [
842-
]
840+
"parameterTypes": []
843841
}
844842
]
845843
},
@@ -929,8 +927,7 @@
929927
"methods": [
930928
{
931929
"name": "<init>",
932-
"parameterTypes": [
933-
]
930+
"parameterTypes": []
934931
}
935932
]
936933
},
@@ -950,8 +947,7 @@
950947
"methods": [
951948
{
952949
"name": "<init>",
953-
"parameterTypes": [
954-
]
950+
"parameterTypes": []
955951
}
956952
]
957953
},
@@ -961,8 +957,7 @@
961957
"methods": [
962958
{
963959
"name": "<init>",
964-
"parameterTypes": [
965-
]
960+
"parameterTypes": []
966961
}
967962
]
968963
},
@@ -971,8 +966,7 @@
971966
"methods": [
972967
{
973968
"name": "values",
974-
"parameterTypes": [
975-
]
969+
"parameterTypes": []
976970
}
977971
]
978972
},
@@ -981,8 +975,7 @@
981975
"methods": [
982976
{
983977
"name": "values",
984-
"parameterTypes": [
985-
]
978+
"parameterTypes": []
986979
}
987980
]
988981
},

modules/cli/src/main/resources/META-INF/native-image/org.virtuslab/scala-cli-core/resource-config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@
2727
}
2828
]
2929
},
30-
"bundles": [
31-
]
30+
"bundles": []
3231
}

project/settings.sc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,12 @@ trait HasTests extends SbtModule {
540540
else Nil
541541
super.scalacOptions() ++ extraOptions
542542
}
543-
trait ScalaCliTests extends ScalaCliModule with super.SbtModuleTests {
543+
trait ScalaCliTests extends ScalaCliModule with super.SbtModuleTests with TestModule.Munit {
544544
def ivyDeps = super.ivyDeps() ++ Agg(
545545
Deps.expecty,
546546
Deps.munit
547547
)
548-
def testFramework = "munit.Framework"
549-
def forkArgs = super.forkArgs() ++ Seq("-Xmx512m", "-Xms128m")
548+
def forkArgs = super.forkArgs() ++ Seq("-Xmx512m", "-Xms128m")
550549

551550
def repositoriesTask =
552551
T.task(super.repositoriesTask() ++ deps.customRepositories)

0 commit comments

Comments
 (0)