KT-33050: Pass source version to KAPT for JDK12+
In JDK 12+ source version should be passed using --source option, instead of -source. This commit uses correct option based on the JDK current build is using. Fixes KT-33050
This commit is contained in:
committed by
Yan Zhulanow
parent
f4c6f57354
commit
3a7deffe2e
+8
-2
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.gradle.internal
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import com.android.build.gradle.api.AndroidSourceSet
|
||||
import com.android.builder.model.SourceProvider
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
@@ -433,8 +434,13 @@ class Kapt3KotlinGradleSubplugin : KotlinGradleSubplugin<KotlinCompile> {
|
||||
}
|
||||
|
||||
val dslJavacOptions = kaptExtension.getJavacOptions().toMutableMap()
|
||||
if (javaCompile != null && "-source" !in dslJavacOptions && "--release" !in dslJavacOptions) {
|
||||
dslJavacOptions["-source"] = javaCompile.sourceCompatibility
|
||||
if (javaCompile != null && "-source" !in dslJavacOptions && "--source" !in dslJavacOptions && "--release" !in dslJavacOptions) {
|
||||
val sourceOptionKey = if (SystemInfo.isJavaVersionAtLeast(12, 0, 0)) {
|
||||
"--source"
|
||||
} else {
|
||||
"-source"
|
||||
}
|
||||
dslJavacOptions[sourceOptionKey] = javaCompile.sourceCompatibility
|
||||
}
|
||||
if (kaptTask is KaptWithKotlincTask) {
|
||||
if (kaptTask.isIncremental) {
|
||||
|
||||
Reference in New Issue
Block a user