KAPT3: Use another class in com.sun.tools.javac.main

Instead of CommandLine use Option, since CommandLine was moved or
removed from JDK 21.

 #KT-60507 Fixed
This commit is contained in:
Ilmir Usmanov
2023-08-28 19:21:31 +02:00
committed by Space Team
parent 62effc49fa
commit 6c13250a08
4 changed files with 63 additions and 1 deletions
@@ -1,4 +1,5 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.jvm.toolchain.internal.NoToolchainAvailableException
import org.jetbrains.kotlin.pill.PillExtension
plugins {
@@ -346,6 +347,12 @@ tasks.withType<Test> {
systemProperty("jdk11Home", jdk11Provider.get())
systemProperty("jdk16Home", jdk16Provider.get())
systemProperty("jdk17Home", jdk17Provider.get())
// jdk21Provider.isPresent throws NoToolchainAvailableException, so, we have to check for the exception
// Storing jdk21Provider in a field leads to "Configuration cache state could not be cached" error,
// since it tries to resolve the toolchain as well.
try {
systemProperty("jdk21Home", project.getToolchainJdkHomeFor(JdkMajorVersion.JDK_21_0).get())
} catch (_: NoToolchainAvailableException) {}
if (mavenLocalRepo != null) {
systemProperty("maven.repo.local", mavenLocalRepo)
}