Skip to content

Commit

Permalink
Update mill-main to 0.11.6 (#2572)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
scala-steward and Gedochao authored Nov 23, 2023
1 parent 464ee18 commit 5c243b5
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.1
0.11.6
116 changes: 54 additions & 62 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,10 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
super.runClasspath() ++ Seq(localRepoJar())
}

def compileIvyDeps = super.ivyDeps() ++ Agg(
Deps.jsoniterMacros
)

// Required by the reflection usage in modules/cli/src/test/scala/cli/tests/SetupScalaCLITests.scala
override def forkArgs: T[Seq[String]] = T {
super.forkArgs() ++ Seq("--add-opens=java.base/java.util=ALL-UNNAMED")
Expand Down Expand Up @@ -949,46 +953,32 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
}
def generatedSources = super.generatedSources() ++ Seq(constantsFile())

private final class TestHelper(
launcherTask: T[PathRef],
cliKind: String
) {
def test(args: String*) = {
val argsTask = T.task {
val launcher = launcherTask().path
val debugReg = "^--debug$|^--debug:([0-9]+)$".r
val debugPortOpt = args.find(debugReg.matches).flatMap {
case debugReg(port) => Option(port).orElse(Some("5005"))
case _ => None
}
val debugArgs = debugPortOpt match {
case Some(port) =>
System.err.println(
s"--debug option has been passed. Listening for transport dt_socket at address: $port"
)
Seq(s"-Dtest.scala-cli.debug.port=$port")
case _ => Seq.empty
}
val extraArgs = Seq(
s"-Dtest.scala-cli.path=$launcher",
s"-Dtest.scala-cli.kind=$cliKind"
)
args ++ extraArgs ++ debugArgs
def runTests(launcherTask: T[PathRef], cliKind: String, args: String*) = {
val argsTask = T.task {
val launcher = launcherTask().path
val debugReg = "^--debug$|^--debug:([0-9]+)$".r
val debugPortOpt = args.find(debugReg.matches).flatMap {
case debugReg(port) => Option(port).orElse(Some("5005"))
case _ => None
}
T.command {
val res = testTask(argsTask, T.task(Seq.empty[String]))()
val dotScalaInRoot = os.pwd / workspaceDirName
assert(
!os.isDir(dotScalaInRoot),
s"Expected $workspaceDirName ($dotScalaInRoot) not to have been created"
)
res
val debugArgs = debugPortOpt match {
case Some(port) =>
System.err.println(
s"--debug option has been passed. Listening for transport dt_socket at address: $port"
)
Seq(s"-Dtest.scala-cli.debug.port=$port")
case _ => Seq.empty
}
val extraArgs = Seq(
s"-Dtest.scala-cli.path=$launcher",
s"-Dtest.scala-cli.kind=$cliKind"
)
args ++ extraArgs ++ debugArgs
}
testTask(argsTask, T.task(Seq.empty[String]))
}

def test(args: String*) =
jvm(args: _*)
override def test(args: String*) = jvm(args: _*)

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

def jvm(args: String*) =
new TestHelper(
cli.standaloneLauncher,
"jvm"
).test(args: _*)
private object Launchers {
def jvm = cli.standaloneLauncher

def jvmBootstrapped = cliBootstrapped.jar

def native =
Option(System.getenv("SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY")) match {
case Some(_) => forcedLauncher
case None => cli.nativeImage
}

def nativeStatic =
Option(System.getenv("SCALA_CLI_IT_FORCED_STATIC_LAUNCHER_DIRECTORY")) match {
case Some(_) => forcedStaticLauncher
case None => cli.nativeImageStatic
}

def nativeMostlyStatic =
Option(System.getenv("SCALA_CLI_IT_FORCED_MOSTLY_STATIC_LAUNCHER_DIRECTORY")) match {
case Some(_) => forcedMostlyStaticLauncher
case None => cli.nativeImageMostlyStatic
}
}

def jvm(args: String*) = T.command(runTests(Launchers.jvm, "jvm", args: _*))
def jvmBootstrapped(args: String*) =
new TestHelper(
cliBootstrapped.jar,
"jvmBootstrapped"
).test(args: _*)
def native(args: String*) =
new TestHelper(
if (System.getenv("SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY") == null) cli.nativeImage
else forcedLauncher,
"native"
).test(args: _*)
T.command(runTests(Launchers.jvmBootstrapped, "jvmBootstrapped", args: _*))
def native(args: String*) = T.command(runTests(Launchers.native, "native", args: _*))
def nativeStatic(args: String*) =
new TestHelper(
if (System.getenv("SCALA_CLI_IT_FORCED_STATIC_LAUNCHER_DIRECTORY") == null)
cli.nativeImageStatic
else forcedStaticLauncher,
"native-static"
).test(args: _*)
T.command(runTests(Launchers.nativeStatic, "native-static", args: _*))
def nativeMostlyStatic(args: String*) =
new TestHelper(
if (System.getenv("SCALA_CLI_IT_FORCED_MOSTLY_STATIC_LAUNCHER_DIRECTORY") == null)
cli.nativeImageMostlyStatic
else forcedMostlyStaticLauncher,
"native-mostly-static"
).test(args: _*)
T.command(runTests(Launchers.nativeMostlyStatic, "native-mostly-static", args: _*))
}
}

Expand Down
2 changes: 1 addition & 1 deletion mill.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rem but I don't think we need to support them in 2019
setlocal enabledelayedexpansion

if [!DEFAULT_MILL_VERSION!]==[] (
set "DEFAULT_MILL_VERSION=0.10.12"
set "DEFAULT_MILL_VERSION=0.11.6"
)

set "MILL_REPO_URL=https://github.com/com-lihaoyi/mill"
Expand Down
2 changes: 1 addition & 1 deletion millw
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
set -e

if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
DEFAULT_MILL_VERSION=0.10.12
DEFAULT_MILL_VERSION=0.11.6
fi


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"methods": [
{
"name": "collectionClassName",
"parameterTypes": [
]
"parameterTypes": []
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"methods": [
{
"name": "getPlatformClassLoader",
"parameterTypes": [
]
"parameterTypes": []
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,7 @@
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
"parameterTypes": []
}
]
},
Expand All @@ -838,8 +837,7 @@
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
"parameterTypes": []
}
]
},
Expand Down Expand Up @@ -929,8 +927,7 @@
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
"parameterTypes": []
}
]
},
Expand All @@ -950,8 +947,7 @@
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
"parameterTypes": []
}
]
},
Expand All @@ -961,8 +957,7 @@
"methods": [
{
"name": "<init>",
"parameterTypes": [
]
"parameterTypes": []
}
]
},
Expand All @@ -971,8 +966,7 @@
"methods": [
{
"name": "values",
"parameterTypes": [
]
"parameterTypes": []
}
]
},
Expand All @@ -981,8 +975,7 @@
"methods": [
{
"name": "values",
"parameterTypes": [
]
"parameterTypes": []
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
}
]
},
"bundles": [
]
"bundles": []
}
5 changes: 2 additions & 3 deletions project/settings.sc
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,12 @@ trait HasTests extends SbtModule {
else Nil
super.scalacOptions() ++ extraOptions
}
trait ScalaCliTests extends ScalaCliModule with super.SbtModuleTests {
trait ScalaCliTests extends ScalaCliModule with super.SbtModuleTests with TestModule.Munit {
def ivyDeps = super.ivyDeps() ++ Agg(
Deps.expecty,
Deps.munit
)
def testFramework = "munit.Framework"
def forkArgs = super.forkArgs() ++ Seq("-Xmx512m", "-Xms128m")
def forkArgs = super.forkArgs() ++ Seq("-Xmx512m", "-Xms128m")

def repositoriesTask =
T.task(super.repositoriesTask() ++ deps.customRepositories)
Expand Down

0 comments on commit 5c243b5

Please sign in to comment.