Skip to content

Commit 6829211

Browse files
committed
Fixed mapping for jvmId in build conversions
1 parent 3504b6b commit 6829211

File tree

93 files changed

+1114
-841
lines changed

Some content is hidden

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

93 files changed

+1114
-841
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
zulu:21

example/migrating/javalib/3-maven-complete-large/build.mill

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
> ./mill init
1010

11-
> echo 21 > .mill-jvm-version # Repo needs Java >=21 to build and test
12-
1311
> rm twin/src/test/java/com/iluwatar/twin/BallThreadTest.java # skip flaky test
1412
> rm actor-model/src/test/java/com/iluwatar/actor/ActorModelTest.java # skip flaky test
1513

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
zulu:17
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
zulu:17

example/migrating/javalib/5-gradle-incomplete/build.mill

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
> git init .
66
> git remote add -f origin https://github.com/mockito/mockito.git
7-
> git checkout v5.19.0 # multi-module Java project
7+
> git checkout v5.20.0 # multi-module Java project
88

9-
> ./mill init --gradle-jvm-id 17 # imported modules are not fully functional
9+
> ./mill init # imported modules are not fully functional
1010
converting Gradle build
1111
init completed, run "mill resolve _" to list available tasks
1212

13-
> ./mill mockito-core.compile # module jvmId needs tweaking
14-
error: java.lang.UnsupportedClassVersionError: com/google/errorprone/ErrorProneJavacPlugin has been compiled by a more recent version...
13+
> ./mill mockito-core.compile # Compilation needs manual tweaking to pass
14+
compiling 477 Java sources...
15+
error: ...mockito-core/src/main/java/module-info.java:8:17: module not found: net.bytebuddy
1516
*/

example/package.mill

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import mill.contrib.buildinfo.BuildInfo
1313
import mill.T
1414
import mill.api.Cross
1515
import mill.api.BuildCtx
16+
import java.io.File.pathSeparator
1617

1718
object `package` extends Module {
1819
def exampleModules: Seq[ExampleCrossModule] = moduleInternal
@@ -65,8 +66,8 @@ object `package` extends Module {
6566
}
6667

6768
object migrating extends Module {
68-
object javalib extends Cross[ExampleCrossModule](build.listCross)
69-
object scalalib extends Cross[ExampleCrossModule](build.listCross)
69+
object javalib extends Cross[ExampleCrossModuleMigrating](build.listCross)
70+
object scalalib extends Cross[ExampleCrossModuleMigrating](build.listCross)
7071
}
7172
object javascriptlib extends Module {
7273
object basic extends Cross[ExampleCrossModule](build.listCross)
@@ -122,6 +123,26 @@ object `package` extends Module {
122123
object typescript extends Cross[ExampleCrossModule](build.listCross)
123124
}
124125

126+
trait ExampleCrossModuleMigrating extends ExampleCrossModule {
127+
def forkEnvJvmIdFile = Task.Source(".env-jvm-version")
128+
def forkEnvJvmId = Task {
129+
val file = forkEnvJvmIdFile().path
130+
if (os.exists(file)) BuildCtx.withFilesystemCheckerDisabled {
131+
os.read(file)
132+
}
133+
else "zulu:11"
134+
}
135+
def forkEnv = Task {
136+
val javaHome = Jvm.resolveJavaHome(forkEnvJvmId()).get
137+
val javaExe = Jvm.javaExe(Some(javaHome))
138+
Map(
139+
"MILL_INTEGRATION_PROPAGATE_JAVA_HOME" -> "false",
140+
"JAVA_HOME" -> javaHome.toString,
141+
"PATH" -> s"$javaExe$pathSeparator${System.getenv("PATH")}"
142+
)
143+
}
144+
}
145+
125146
trait ExampleCrossModuleKotlin extends ExampleCrossModuleJava {
126147

127148
override def lineTransform(line: String) = this.moduleSegments.parts.last match {

integration/manual/migrating/src/MillInitGradleAsmTests.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ package mill.integration
22
import utest.*
33
object MillInitGradleAsmTests extends MillInitTestSuite {
44
def tests = Tests {
5-
test - checkImport(
6-
gitUrl = "https://gitlab.ow2.org/asm/asm.git",
7-
gitBranch = "ASM_9_8",
8-
initArgs = Seq("--gradle-jvm-id", "11"),
5+
test("realistic") - checkImport(
6+
"https://gitlab.ow2.org/asm/asm.git",
7+
"ASM_9_9",
98
passingTasks = Seq("asm.compile"),
10-
failingTasks = Seq("tools.retrofitter.compile")
9+
failingTasks = Seq(
10+
// requires custom source dir
11+
"tools.retrofitter.compile"
12+
)
1113
)
1214
}
1315
}

integration/manual/migrating/src/MillInitGradleEhcache3Tests.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ package mill.integration
22
import utest.*
33
object MillInitGradleEhcache3Tests extends MillInitTestSuite {
44
def tests = Tests {
5-
test - checkImport(
6-
gitUrl = "https://github.com/ehcache/ehcache3.git",
7-
gitBranch = "v3.10.8",
8-
initArgs = Seq("--gradle-jvm-id", "11"),
9-
failingTasks = Seq("ehcache-api.compile")
5+
test("realistic") - checkImport(
6+
"https://github.com/ehcache/ehcache3.git",
7+
"v3.11.1",
8+
passingTasks = Seq(("resolve", "_")),
9+
failingTasks = Seq(
10+
// Gradle auto-configures -proc:none
11+
"ehcache-api.compile"
12+
),
13+
envJvmId = "zulu:17"
1014
)
1115
}
1216
}

integration/manual/migrating/src/MillInitGradleFastCsvTests.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ package mill.integration
22
import utest.*
33
object MillInitGradleFastCsvTests extends MillInitTestSuite {
44
def tests = Tests {
5-
test - checkImport(
6-
gitUrl = "https://github.com/osiegmar/FastCSV.git",
7-
gitBranch = "v4.0.0",
8-
initArgs = Seq("--gradle-jvm-id", "24"),
9-
failingTasks = Seq("lib.compile")
5+
test("realistic") - checkImport(
6+
"https://github.com/osiegmar/FastCSV.git",
7+
"v4.1.0",
8+
passingTasks = Seq(("resolve", "_")),
9+
failingTasks = Seq(
10+
// Gradle auto-configures -proc:none
11+
"lib.compile"
12+
),
13+
envJvmId = "zulu:24" // 25 is not available in Coursier index
1014
)
1115
}
1216
}

integration/manual/migrating/src/MillInitGradleJCommanderTests.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ package mill.integration
22
import utest.*
33
object MillInitGradleJCommanderTests extends MillInitTestSuite {
44
def tests = Tests {
5-
test - checkImport(
6-
gitUrl = "https://github.com/cbeust/jcommander.git",
7-
gitBranch = "2.0",
8-
initArgs = Seq("--gradle-jvm-id", "11"),
9-
failingTasks = Seq("test.compile")
5+
test("realistic") - checkImport(
6+
"https://github.com/cbeust/jcommander.git",
7+
"3.0",
8+
passingTasks = Seq("compile"),
9+
failingTasks = Seq(
10+
// localCompileClasspath hidden by circular transitive dep
11+
"test.compile"
12+
),
13+
envJvmId = "zulu:17"
1014
)
1115
}
1216
}

0 commit comments

Comments
 (0)