[Gradle] Set the useK2 option in AbstractKotlinCompileConfig

It's a common compiler argument and may be applied to any compile task, there's no reason to set it separately for K/JS and K/JVM, and now it sets the compiler argument for metadata compilation tasks as well
This commit is contained in:
Alexander.Likhachev
2023-03-24 17:39:32 +01:00
committed by Space Team
parent b5e36a3c1b
commit 5baeae3bfd
3 changed files with 3 additions and 8 deletions
@@ -119,6 +119,9 @@ internal abstract class AbstractKotlinCompileConfig<TASK : AbstractKotlinCompile
task.incremental = false task.incremental = false
task.useModuleDetection.convention(false) task.useModuleDetection.convention(false)
if (propertiesProvider.useK2 == true) {
task.compilerOptions.useK2.value(true)
}
} }
} }
@@ -42,10 +42,6 @@ internal open class BaseKotlin2JsCompileConfig<TASK : Kotlin2JsCompile>(
} }
) )
if (propertiesProvider.useK2 == true) {
task.kotlinOptions.useK2 = true
}
task.destinationDirectory task.destinationDirectory
.convention( .convention(
project.objects.directoryProperty().fileProvider( project.objects.directoryProperty().fileProvider(
@@ -40,10 +40,6 @@ internal open class BaseKotlinCompileConfig<TASK : KotlinCompile> : AbstractKotl
taskProvider.configure { task -> taskProvider.configure { task ->
task.incremental = propertiesProvider.incrementalJvm ?: true task.incremental = propertiesProvider.incrementalJvm ?: true
if (propertiesProvider.useK2 == true) {
task.compilerOptions.useK2.value(true)
}
task.usePreciseJavaTracking = propertiesProvider.usePreciseJavaTracking ?: true task.usePreciseJavaTracking = propertiesProvider.usePreciseJavaTracking ?: true
task.jvmTargetValidationMode.set(propertiesProvider.jvmTargetValidationMode) task.jvmTargetValidationMode.set(propertiesProvider.jvmTargetValidationMode)
task.useKotlinAbiSnapshot.value(propertiesProvider.useKotlinAbiSnapshot).disallowChanges() task.useKotlinAbiSnapshot.value(propertiesProvider.useKotlinAbiSnapshot).disallowChanges()