Move to JDK_X_Y variables

This commit is contained in:
Nikolay Krasko
2022-09-05 15:04:44 +02:00
committed by Space
parent 2df9203336
commit 1630386712
24 changed files with 71 additions and 52 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ This repository is using [Gradle toolchains](https://docs.gradle.org/current/use
to select and auto-provision required JDKs from [AdoptOpenJdk](https://adoptopenjdk.net) project. to select and auto-provision required JDKs from [AdoptOpenJdk](https://adoptopenjdk.net) project.
Unfortunately [AdoptOpenJdk](https://adoptopenjdk.net) project does not provide required JDK 1.6 and 1.7 images, Unfortunately [AdoptOpenJdk](https://adoptopenjdk.net) project does not provide required JDK 1.6 and 1.7 images,
so you could either download them manually and provide path to installation via `JDK_16` and `JDK_17` environment variables or so you could either download them manually and provide path to installation via `JDK_1_6` and `JDK_1_7` environment variables or
use following SDK managers: use following SDK managers:
- [Asdf-vm](https://asdf-vm.com/) - [Asdf-vm](https://asdf-vm.com/)
- [Jabba](https://github.com/shyiko/jabba) - [Jabba](https://github.com/shyiko/jabba)
+10 -1
View File
@@ -14,4 +14,13 @@ kotlin.build.gradlePlugin.version=0.0.38
# Please keep it in sync with root gradle.properties. # Please keep it in sync with root gradle.properties.
# It's currently needed for proper configuration cache work, the reason will be investigated later # It's currently needed for proper configuration cache work, the reason will be investigated later
org.gradle.java.installations.fromEnv=JDK_16,JDK_17,JDK_18,JDK_9,JDK_10,JDK_11,JDK_15,JDK_16_0,JDK_17_0 org.gradle.java.installations.fromEnv=\
JDK_1_6,JDK_16,\
JDK_1_7,JDK_17,\
JDK_1_8,JDK_18,\
JDK_9_0,JDK_9,\
JDK_10_0,JDK_10,\
JDK_11_0,JDK_11,\
JDK_15_0,JDK_15,\
JDK_16_0,\
JDK_17_0
+5 -5
View File
@@ -18,11 +18,11 @@ enum class JdkMajorVersion(
JDK_1_6(6, targetName = "1.6", overrideMajorVersion = 8), JDK_1_6(6, targetName = "1.6", overrideMajorVersion = 8),
JDK_1_7(7, targetName = "1.7", overrideMajorVersion = 8), JDK_1_7(7, targetName = "1.7", overrideMajorVersion = 8),
JDK_1_8(8, targetName = "1.8"), JDK_1_8(8, targetName = "1.8"),
JDK_9(9, overrideMajorVersion = 11), JDK_9_0(9, overrideMajorVersion = 11),
JDK_10(10, mandatory = false, overrideMajorVersion = 11), JDK_10_0(10, mandatory = false, overrideMajorVersion = 11),
JDK_11(11, mandatory = false), JDK_11_0(11, mandatory = false),
JDK_16(16, mandatory = false), JDK_16_0(16, mandatory = false),
JDK_17(17, mandatory = false); JDK_17_0(17, mandatory = false);
fun isMandatory(): Boolean = mandatory fun isMandatory(): Boolean = mandatory
+3 -3
View File
@@ -21,9 +21,9 @@ fun Project.configureJava9Compilation(
configurations["java9CompileClasspath"].extendsFrom(configurations["compileClasspath"]) configurations["java9CompileClasspath"].extendsFrom(configurations["compileClasspath"])
tasks.named("compileJava9Kotlin", KotlinCompile::class.java) { tasks.named("compileJava9Kotlin", KotlinCompile::class.java) {
configureTaskToolchain(JdkMajorVersion.JDK_9) configureTaskToolchain(JdkMajorVersion.JDK_9_0)
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
kotlinOptions.jvmTarget = JdkMajorVersion.JDK_9.targetName kotlinOptions.jvmTarget = JdkMajorVersion.JDK_9_0.targetName
} }
tasks.named("compileJava9Java", JavaCompile::class.java) { tasks.named("compileJava9Java", JavaCompile::class.java) {
@@ -31,7 +31,7 @@ fun Project.configureJava9Compilation(
targetCompatibility = JavaVersion.VERSION_1_9.toString() targetCompatibility = JavaVersion.VERSION_1_9.toString()
sourceCompatibility = JavaVersion.VERSION_1_9.toString() sourceCompatibility = JavaVersion.VERSION_1_9.toString()
configureTaskToolchain(JdkMajorVersion.JDK_9) configureTaskToolchain(JdkMajorVersion.JDK_9_0)
// module-info.java should be in java9 source set by convention // module-info.java should be in java9 source set by convention
val java9SourceSet = sourceSets["java9"].java val java9SourceSet = sourceSets["java9"].java
+4 -1
View File
@@ -279,7 +279,10 @@ private fun String.toMaybeVersionedJarRegex(): Regex {
return Regex(if (hasJarExtension) escaped else "$escaped(-\\d.*)?\\.jar") // TODO: consider more precise version part of the regex return Regex(if (hasJarExtension) escaped else "$escaped(-\\d.*)?\\.jar") // TODO: consider more precise version part of the regex
} }
fun Project.firstFromJavaHomeThatExists(vararg paths: String, jdkHome: File = File(this.property("JDK_18") as String)): File? = fun Project.firstFromJavaHomeThatExists(
vararg paths: String,
jdkHome: File = File((this.property("JDK_1_8") ?: this.property("JDK_18") ?: error("Can't find JDK_1_8 property")) as String)
): File? =
paths.map { File(jdkHome, it) }.firstOrNull { it.exists() }.also { paths.map { File(jdkHome, it) }.firstOrNull { it.exists() }.also {
if (it == null) if (it == null)
logger.warn("Cannot find file by paths: ${paths.toList()} in $jdkHome") logger.warn("Cannot find file by paths: ${paths.toList()} in $jdkHome")
@@ -49,7 +49,7 @@ projectTest("testJvmICWithJdk11", parallel = true) {
filter { filter {
includeTestsMatching("org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunnerTestGenerated*") includeTestsMatching("org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunnerTestGenerated*")
} }
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_11)) javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_11_0))
} }
testsJar() testsJar()
@@ -23,13 +23,13 @@ enum class TestJdkKind(val requiresSeparateProcess: Boolean = false) {
// Also, now it contains new methods in java.lang.String introduced in JDK 11 // Also, now it contains new methods in java.lang.String introduced in JDK 11
MODIFIED_MOCK_JDK, MODIFIED_MOCK_JDK,
// JDK found at $JDK_16 // JDK found at $JDK_1_6
FULL_JDK_6(requiresSeparateProcess = true), FULL_JDK_6(requiresSeparateProcess = true),
// JDK found at $JDK_11 // JDK found at $JDK_11_0
FULL_JDK_11(requiresSeparateProcess = true), FULL_JDK_11(requiresSeparateProcess = true),
// JDK found at $JDK_17 // JDK found at $JDK_17_0
FULL_JDK_17(requiresSeparateProcess = true), FULL_JDK_17(requiresSeparateProcess = true),
// JDK found at java.home // JDK found at java.home
@@ -145,17 +145,17 @@ public class KtTestUtil {
@NotNull @NotNull
public static File getJdk6Home() { public static File getJdk6Home() {
return getJdkHome("JDK_6", "JDK_16"); return getJdkHome("JDK_1_6", "JDK_6", "JDK_16");
} }
@NotNull @NotNull
public static File getJdk8Home() { public static File getJdk8Home() {
return getJdkHome("JDK_8", "JDK_18"); return getJdkHome("JDK_1_8", "JDK_8", "JDK_18");
} }
@NotNull @NotNull
public static File getJdk11Home() { public static File getJdk11Home() {
return getJdkHome("JDK_11"); return getJdkHome("JDK_11_0", "JDK_11");
} }
@NotNull @NotNull
@@ -5,18 +5,14 @@
package org.jetbrains.kotlin.test package org.jetbrains.kotlin.test
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.checkers.ENABLE_JVM_PREVIEW import org.jetbrains.kotlin.checkers.ENABLE_JVM_PREVIEW
import org.jetbrains.kotlin.checkers.parseLanguageVersionSettings import org.jetbrains.kotlin.checkers.parseLanguageVersionSettings
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoot
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.config.JvmTarget.Companion.fromString import org.jetbrains.kotlin.config.JvmTarget.Companion.fromString
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
import org.jetbrains.kotlin.test.util.KtTestUtil import org.jetbrains.kotlin.test.util.KtTestUtil
import java.io.File import java.io.File
import java.util.*
abstract class KotlinBaseTest<F : KotlinBaseTest.TestFile> : KtUsefulTestCase() { abstract class KotlinBaseTest<F : KotlinBaseTest.TestFile> : KtUsefulTestCase() {
@Throws(Exception::class) @Throws(Exception::class)
@@ -42,7 +38,7 @@ abstract class KotlinBaseTest<F : KotlinBaseTest.TestFile> : KtUsefulTestCase()
} }
protected open fun getTestJdkKind(files: List<F>): TestJdkKind { protected open fun getTestJdkKind(files: List<F>): TestJdkKind {
if (files.any { file -> InTextDirectivesUtils.isDirectiveDefined(file.content, "JDK_17") }) return TestJdkKind.FULL_JDK_17 if (files.any { file -> InTextDirectivesUtils.isDirectiveDefined(file.content, "JDK_17_0") }) return TestJdkKind.FULL_JDK_17
for (file in files) { for (file in files) {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "FULL_JDK")) { if (InTextDirectivesUtils.isDirectiveDefined(file.content, "FULL_JDK")) {
@@ -184,8 +184,11 @@ public class KotlinTestUtils {
configuration.put(JVMConfigurationKeys.NO_JDK, true); configuration.put(JVMConfigurationKeys.NO_JDK, true);
} }
else if (jdkKind == TestJdkKind.FULL_JDK_6) { else if (jdkKind == TestJdkKind.FULL_JDK_6) {
String jdk6 = System.getenv("JDK_16"); String jdk6 = System.getenv("JDK_1_6");
assert jdk6 != null : "Environment variable JDK_16 is not set"; if (jdk6 == null) {
jdk6 = System.getenv("JDK_16");
}
assert jdk6 != null : "Environment variable JDK_1_6 is not set";
configuration.put(JVMConfigurationKeys.JDK_HOME, new File(jdk6)); configuration.put(JVMConfigurationKeys.JDK_HOME, new File(jdk6));
} }
else if (jdkKind == TestJdkKind.FULL_JDK_17) { else if (jdkKind == TestJdkKind.FULL_JDK_17) {
@@ -51,14 +51,14 @@ fun Project.codegenTest(
codegenTest(target = 8, jdk = JdkMajorVersion.JDK_1_8) codegenTest(target = 8, jdk = JdkMajorVersion.JDK_1_8)
//JDK 11 //JDK 11
codegenTest(target = 8, jdk = JdkMajorVersion.JDK_11) codegenTest(target = 8, jdk = JdkMajorVersion.JDK_11_0)
codegenTest(target = 11, jdk = JdkMajorVersion.JDK_11) codegenTest(target = 11, jdk = JdkMajorVersion.JDK_11_0)
//JDK 17 //JDK 17
codegenTest(target = 8, jdk = JdkMajorVersion.JDK_17) codegenTest(target = 8, jdk = JdkMajorVersion.JDK_17_0)
codegenTest(target = 17, jdk = JdkMajorVersion.JDK_17) { codegenTest(target = 17, jdk = JdkMajorVersion.JDK_17_0) {
systemProperty("kotlin.test.box.d8.disable", true) systemProperty("kotlin.test.box.d8.disable", true)
} }
@@ -65,8 +65,9 @@ abstract class JavaModulesIntegrationTest(private val jdkVersion: Int, private v
return { actual -> return { actual ->
KotlinTestUtils.assertEqualsToFile( KotlinTestUtils.assertEqualsToFile(
expectedFile, expectedFile,
getNormalizedCompilerOutput(actual, null, testDataPath).replace(System.getenv("JDK_11").replace("\\", "/"), "\$JDK11") getNormalizedCompilerOutput(actual, null, testDataPath)
.replace(System.getenv("JDK_17").replace("\\", "/"), "\$JDK17") .replace((System.getenv("JDK_11_0") ?: System.getenv("JDK_11")).replace("\\", "/"), "\$JDK11")
.replace((System.getenv("JDK_17_0") ?: System.getenv("JDK_17")).replace("\\", "/"), "\$JDK17")
) )
} }
} }
@@ -18,5 +18,5 @@ sourceSets {
} }
val generateIdePluginGradleFiles by generator("org.jetbrains.kotlin.generators.imltogradle.MainKt") { val generateIdePluginGradleFiles by generator("org.jetbrains.kotlin.generators.imltogradle.MainKt") {
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_11)) javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_11_0))
} }
+10 -1
View File
@@ -8,7 +8,16 @@ org.gradle.caching=true
# Please keep it in sync with buildSrc gradle.properties. # Please keep it in sync with buildSrc gradle.properties.
# It's currently needed for proper configuration cache work, the reason will be investigated later # It's currently needed for proper configuration cache work, the reason will be investigated later
org.gradle.java.installations.fromEnv=JDK_16,JDK_17,JDK_18,JDK_9,JDK_10,JDK_11,JDK_15,JDK_16_0,JDK_17_0 org.gradle.java.installations.fromEnv=\
JDK_1_6,JDK_16,\
JDK_1_7,JDK_17,\
JDK_1_8,JDK_18,\
JDK_9_0,JDK_9,\
JDK_10_0,JDK_10,\
JDK_11_0,JDK_11,\
JDK_15_0,JDK_15,\
JDK_16_0,\
JDK_17_0
systemProp.org.gradle.internal.http.connectionTimeout=90000 systemProp.org.gradle.internal.http.connectionTimeout=90000
systemProp.org.gradle.internal.http.socketTimeout=90000 systemProp.org.gradle.internal.http.socketTimeout=90000
@@ -5,7 +5,7 @@ import org.jetbrains.kotlin.kotlinNativeDist
import org.jetbrains.kotlin.mergeManifestsByTargets import org.jetbrains.kotlin.mergeManifestsByTargets
if (HostManager.host == KonanTarget.MACOS_ARM64) { if (HostManager.host == KonanTarget.MACOS_ARM64) {
project.configureJvmToolchain(JdkMajorVersion.JDK_17) project.configureJvmToolchain(JdkMajorVersion.JDK_17_0)
} }
plugins { plugins {
+1 -1
View File
@@ -43,7 +43,7 @@ fun defFileToLibName(target: String, name: String) = "$target-$name"
// endregion // endregion
if (HostManager.host == KonanTarget.MACOS_ARM64) { if (HostManager.host == KonanTarget.MACOS_ARM64) {
project.configureJvmToolchain(JdkMajorVersion.JDK_17) project.configureJvmToolchain(JdkMajorVersion.JDK_17_0)
} }
val konanTargetList: List<KonanTarget> by project val konanTargetList: List<KonanTarget> by project
+2 -3
View File
@@ -3,15 +3,14 @@
* that can be found in the LICENSE file. * that can be found in the LICENSE file.
*/ */
import org.jetbrains.kotlin.* import org.jetbrains.kotlin.*
import org.jetbrains.kotlin.bitcode.CompileToBitcode
import org.jetbrains.kotlin.bitcode.CompileToBitcodeExtension import org.jetbrains.kotlin.bitcode.CompileToBitcodeExtension
import org.jetbrains.kotlin.gradle.plugin.konan.tasks.KonanCacheTask import org.jetbrains.kotlin.gradle.plugin.konan.tasks.KonanCacheTask
import org.jetbrains.kotlin.konan.properties.loadProperties import org.jetbrains.kotlin.konan.properties.loadProperties
import org.jetbrains.kotlin.konan.properties.saveProperties import org.jetbrains.kotlin.konan.properties.saveProperties
import org.jetbrains.kotlin.konan.target.* import org.jetbrains.kotlin.konan.target.*
import org.jetbrains.kotlin.library.KLIB_PROPERTY_NATIVE_TARGETS import org.jetbrains.kotlin.library.KLIB_PROPERTY_NATIVE_TARGETS
import org.jetbrains.kotlin.konan.target.Architecture as TargetArchitecture
import org.jetbrains.kotlin.konan.file.File as KFile import org.jetbrains.kotlin.konan.file.File as KFile
import org.jetbrains.kotlin.konan.target.Architecture as TargetArchitecture
// These properties are used by the 'konan' plugin, thus we set them before applying it. // These properties are used by the 'konan' plugin, thus we set them before applying it.
val distDir: File by project val distDir: File by project
@@ -25,7 +24,7 @@ plugins {
} }
if (HostManager.host == KonanTarget.MACOS_ARM64) { if (HostManager.host == KonanTarget.MACOS_ARM64) {
project.configureJvmToolchain(JdkMajorVersion.JDK_17) project.configureJvmToolchain(JdkMajorVersion.JDK_17_0)
} }
googletest { googletest {
@@ -343,7 +343,7 @@ class KonanPlugin @Inject constructor(private val registry: ToolingModelBuilderR
// If the JDK that was set is not available get the JDK 11 as a default // If the JDK that was set is not available get the JDK 11 as a default
service.launcherFor(object : Action<JavaToolchainSpec> { service.launcherFor(object : Action<JavaToolchainSpec> {
override fun execute(toolchainSpec: JavaToolchainSpec) { override fun execute(toolchainSpec: JavaToolchainSpec) {
toolchainSpec.languageVersion.set(JavaLanguageVersion.of(JdkMajorVersion.JDK_11.majorVersion)) toolchainSpec.languageVersion.set(JavaLanguageVersion.of(JdkMajorVersion.JDK_11_0.majorVersion))
} }
}).get() }).get()
} }
@@ -5,7 +5,6 @@ import org.gradle.kotlin.dsl.support.serviceOf
description = "Shaded Maven dependencies resolver" description = "Shaded Maven dependencies resolver"
val JDK_18: String by rootProject.extra
val jarBaseName = property("archivesBaseName") as String val jarBaseName = property("archivesBaseName") as String
val embedded by configurations val embedded by configurations
+3 -3
View File
@@ -103,7 +103,7 @@ task testJdk6Tests(type: Test) { thisTask ->
} }
} }
[JdkMajorVersion.JDK_9, JdkMajorVersion.JDK_10, JdkMajorVersion.JDK_11].forEach { jvmVersion -> [JdkMajorVersion.JDK_9_0, JdkMajorVersion.JDK_10_0, JdkMajorVersion.JDK_11_0].forEach { jvmVersion ->
check.dependsOn(tasks.register("jdk${jvmVersion.majorVersion}Test", Test) { thisTask -> check.dependsOn(tasks.register("jdk${jvmVersion.majorVersion}Test", Test) { thisTask ->
group = "verification" group = "verification"
thisTask.javaLauncher.set(JvmToolchain.getToolchainLauncherFor(project, jvmVersion)) thisTask.javaLauncher.set(JvmToolchain.getToolchainLauncherFor(project, jvmVersion))
@@ -111,7 +111,7 @@ task testJdk6Tests(type: Test) { thisTask ->
} }
compileModuleTestKotlin { compileModuleTestKotlin {
kotlinJavaToolchain.toolchain.use(JvmToolchain.getToolchainLauncherFor(project, JdkMajorVersion.JDK_9)) kotlinJavaToolchain.toolchain.use(JvmToolchain.getToolchainLauncherFor(project, JdkMajorVersion.JDK_9_0))
} }
check.dependsOn(tasks.register("moduleInfoTest", Test) {test -> check.dependsOn(tasks.register("moduleInfoTest", Test) {test ->
@@ -119,7 +119,7 @@ check.dependsOn(tasks.register("moduleInfoTest", Test) {test ->
test.group = "verification" test.group = "verification"
test.testClassesDirs = sourceSets.moduleTest.output.classesDirs test.testClassesDirs = sourceSets.moduleTest.output.classesDirs
test.classpath = files(sourceSets.moduleTest.runtimeClasspath, tasks.jar) test.classpath = files(sourceSets.moduleTest.runtimeClasspath, tasks.jar)
test.javaLauncher.set(JvmToolchain.getToolchainLauncherFor(project, JdkMajorVersion.JDK_9)) test.javaLauncher.set(JvmToolchain.getToolchainLauncherFor(project, JdkMajorVersion.JDK_9_0))
doFirst { doFirst {
test.systemProperty("stdlibJars", test.classpath.filter { it.name.contains('kotlin-stdlib') }.join(File.pathSeparator)) test.systemProperty("stdlibJars", test.classpath.filter { it.name.contains('kotlin-stdlib') }.join(File.pathSeparator))
} }
@@ -99,7 +99,7 @@ private interface TypeImpl : Type {
// This is a copy of [Type.getTypeName] which is present on JDK 8+. // This is a copy of [Type.getTypeName] which is present on JDK 8+.
@Suppress( @Suppress(
"VIRTUAL_MEMBER_HIDDEN", "NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT" "VIRTUAL_MEMBER_HIDDEN", "NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT"
) // This is needed for cases when environment variable JDK_16 points to JDK 8+. ) // This is needed for cases when environment variable JDK_1_6 points to JDK 8+.
fun getTypeName(): String fun getTypeName(): String
} }
@@ -126,7 +126,7 @@ private class TypeVariableImpl(private val typeParameter: KTypeParameter) : Type
override fun toString(): String = getTypeName() override fun toString(): String = getTypeName()
// [TypeVariable] extends [AnnotatedElement] starting from JDK 8. The following are copies of methods from there. // [TypeVariable] extends [AnnotatedElement] starting from JDK 8. The following are copies of methods from there.
// Suppression of VIRTUAL_MEMBER_HIDDEN is needed for cases when environment variable JDK_16 points to JDK 8+. // Suppression of VIRTUAL_MEMBER_HIDDEN is needed for cases when environment variable JDK_1_6 points to JDK 8+.
@Suppress("VIRTUAL_MEMBER_HIDDEN", "UNUSED_PARAMETER") @Suppress("VIRTUAL_MEMBER_HIDDEN", "UNUSED_PARAMETER")
fun <T : Annotation> getAnnotation(annotationClass: Class<T>): T? = null fun <T : Annotation> getAnnotation(annotationClass: Class<T>): T? = null
@@ -329,10 +329,10 @@ tasks.withType<Test> {
} }
val jdk8Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_8).map { it.metadata.installationPath.asFile.absolutePath } val jdk8Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_8).map { it.metadata.installationPath.asFile.absolutePath }
val jdk9Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_9).map { it.metadata.installationPath.asFile.absolutePath } val jdk9Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_9_0).map { it.metadata.installationPath.asFile.absolutePath }
val jdk10Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_10).map { it.metadata.installationPath.asFile.absolutePath } val jdk10Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_10_0).map { it.metadata.installationPath.asFile.absolutePath }
val jdk11Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_11).map { it.metadata.installationPath.asFile.absolutePath } val jdk11Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_11_0).map { it.metadata.installationPath.asFile.absolutePath }
val jdk16Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_16).map { it.metadata.installationPath.asFile.absolutePath } val jdk16Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_16_0).map { it.metadata.installationPath.asFile.absolutePath }
val mavenLocalRepo = project.providers.systemProperty("maven.repo.local").forUseAtConfigurationTime().orNull val mavenLocalRepo = project.providers.systemProperty("maven.repo.local").forUseAtConfigurationTime().orNull
// Query required JDKs paths only on execution phase to avoid triggering auto-download on project configuration phase // Query required JDKs paths only on execution phase to avoid triggering auto-download on project configuration phase
+2 -2
View File
@@ -5,7 +5,7 @@ plugins {
id("jps-compatible") id("jps-compatible")
} }
project.configureJvmToolchain(JdkMajorVersion.JDK_11) project.configureJvmToolchain(JdkMajorVersion.JDK_11_0)
dependencies { dependencies {
testImplementation(kotlinStdlib()) testImplementation(kotlinStdlib())
@@ -179,6 +179,6 @@ val test by nativeTest("test" /* no tags */).apply {
} }
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt") { val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateNativeTestsKt") {
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_11)) javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_11_0))
dependsOn(":compiler:generateTestData") dependsOn(":compiler:generateTestData")
} }
@@ -127,7 +127,7 @@ abstract class AbstractKaptToolIntegrationTest {
} }
private fun getJdk8Home(): File { private fun getJdk8Home(): File {
val homePath = System.getenv()["JDK_18"] ?: error("Can't find JDK 1.8 home") val homePath = System.getenv()["JDK_1_8"] ?: System.getenv()["JDK_18"] ?: error("Can't find JDK 1.8 home, please define JDK_1_8 variable")
return File(homePath) return File(homePath)
} }
} }