[Gradle] Fix kapt test with different JDK versions
This test was incorrect as it configured JVM toolchain to use JDK 1.8. This configured JVM toolchain forced kapt tasks to always use JDK 1.8 even if the build itself was running on different JDK versions. Now test uses different values for JVM toolchain which should correctly configure kapt JDK. ^KT-59588
This commit is contained in:
committed by
Space Team
parent
63b0e900a9
commit
19a60d6b85
@@ -358,6 +358,7 @@ tasks.withType<Test> {
|
||||
val mavenLocalRepo = project.providers.systemProperty("maven.repo.local").orNull
|
||||
|
||||
// Query required JDKs paths only on execution phase to avoid triggering auto-download on project configuration phase
|
||||
// names should follow "jdk\\d+Home" regex where number is a major JDK version
|
||||
doFirst {
|
||||
systemProperty("jdk8Home", jdk8Provider.get())
|
||||
systemProperty("jdk9Home", jdk9Provider.get())
|
||||
|
||||
+1
-2
@@ -160,14 +160,13 @@ open class Kapt3IT : Kapt3BaseIT() {
|
||||
project(
|
||||
"simple".withPrefix,
|
||||
gradleVersion,
|
||||
buildJdk = jdk.location
|
||||
) {
|
||||
//language=Groovy
|
||||
buildGradle.appendText(
|
||||
"""
|
||||
|
|
||||
|kotlin {
|
||||
| jvmToolchain(8)
|
||||
| jvmToolchain(${jdk.version.majorVersion})
|
||||
|}
|
||||
""".trimMargin()
|
||||
)
|
||||
|
||||
+7
@@ -417,9 +417,16 @@ private fun commonBuildSetup(
|
||||
gradleVersion: GradleVersion,
|
||||
kotlinDaemonDebugPort: Int? = null,
|
||||
): List<String> {
|
||||
// Following jdk system properties are provided via sub-project build.gradle.kts
|
||||
val jdkPropNameRegex = Regex("jdk\\d+Home")
|
||||
val jdkLocations = System.getProperties()
|
||||
.filterKeys { it.toString().matches(jdkPropNameRegex) }
|
||||
.values
|
||||
.joinToString(separator = ",")
|
||||
return buildOptions.toArguments(gradleVersion) + buildArguments + listOfNotNull(
|
||||
// Required toolchains should be pre-installed via repo. Tests should not download any JDKs
|
||||
"-Porg.gradle.java.installations.auto-download=false",
|
||||
"-Porg.gradle.java.installations.paths=$jdkLocations",
|
||||
"--full-stacktrace",
|
||||
if (enableBuildCacheDebug) "-Dorg.gradle.caching.debug=true" else null,
|
||||
if (enableBuildScan) "--scan" else null,
|
||||
|
||||
Reference in New Issue
Block a user