Run the tests in module tests_java_17
Test: ./tools/test.py 'records.*'
Test: ./tools/test.py --no-r8lib 'records.*'
Bug: b/337801526
Change-Id: I7da8c9d6f56becf2dc5b4ffc1bac20ee1248833f
diff --git a/d8_r8/test/build.gradle.kts b/d8_r8/test/build.gradle.kts
index c9a5d63..43ccadc 100644
--- a/d8_r8/test/build.gradle.kts
+++ b/d8_r8/test/build.gradle.kts
@@ -32,6 +32,7 @@
val javaTestBaseDepsJar = projectTask("testbase", "depsJar")
val java8TestJarTask = projectTask("tests_java_8", "testJar")
val java11TestJarTask = projectTask("tests_java_11", "testJar")
+val java17TestJarTask = projectTask("tests_java_17", "testJar")
val bootstrapTestsDepsJarTask = projectTask("tests_bootstrap", "depsJar")
val bootstrapTestJarTask = projectTask("tests_bootstrap", "testJar")
val testsJava8SourceSetDependenciesTask = projectTask("tests_java_8", "sourceSetDependencyTask")
@@ -63,9 +64,11 @@
val packageTests by registering(Jar::class) {
dependsOn(java8TestJarTask)
dependsOn(java11TestJarTask)
+ dependsOn(java17TestJarTask)
dependsOn(bootstrapTestJarTask)
from(java8TestJarTask.outputs.files.map(::zipTree))
from(java11TestJarTask.outputs.files.map(::zipTree))
+ from(java17TestJarTask.outputs.files.map(::zipTree))
from(bootstrapTestJarTask.outputs.files.map(::zipTree))
exclude("META-INF/*.kotlin_module", "**/*.kotlin_metadata")
destinationDirectory.set(getRoot().resolveAll("build", "libs"))
@@ -149,7 +152,7 @@
val argList = mutableListOf("--keep-rules",
"--allowobfuscation",
"--lib",
- "${org.gradle.internal.jvm.Jvm.current().getJavaHome()}",
+ "${getJavaHome(Jdk.JDK_17)}",
"--lib",
"$mainDepsJar",
"--lib",
@@ -283,7 +286,7 @@
"--classfile",
"--debug",
"--lib",
- "${org.gradle.internal.jvm.Jvm.current().getJavaHome()}",
+ "${getJavaHome(Jdk.JDK_17)}",
"--classpath",
"$r8Jar",
"--classpath",
@@ -424,6 +427,8 @@
systemProperty("com.android.tools.r8.artprofilerewritingcompletenesscheck", "true")
systemProperty("R8_WITH_RELOCATED_DEPS", r8WithRelocatedDepsTask.outputs.files.singleFile)
+ javaLauncher = getJavaLauncher(Jdk.JDK_17)
+
reports.junitXml.outputLocation.set(getRoot().resolveAll("build", "test-results", "test"))
reports.html.outputLocation.set(getRoot().resolveAll("build", "reports", "tests", "test"))
}
diff --git a/d8_r8/test_modules/tests_java_17/build.gradle.kts b/d8_r8/test_modules/tests_java_17/build.gradle.kts
index d46f487..6f37f81 100644
--- a/d8_r8/test_modules/tests_java_17/build.gradle.kts
+++ b/d8_r8/test_modules/tests_java_17/build.gradle.kts
@@ -59,5 +59,13 @@
systemProperty("TESTBASE_DATA_LOCATION",
testbaseJavaCompileTask.outputs.files.getAsPath().split(File.pathSeparator)[0])
}
+
+ val testJar by registering(Jar::class) {
+ from(sourceSets.test.get().output)
+ // TODO(b/296486206): Seems like IntelliJ has a problem depending on test source sets. Renaming
+ // this from the default name (tests_java_8.jar) will allow IntelliJ to find the resources in
+ // the jar and not show red underlines. However, navigation to base classes will not work.
+ archiveFileName.set("not_named_tests_java_17.jar")
+ }
}