[Gradle] Read the kotlin.useK2 gradle property value for K/N tasks
This commit is contained in:
committed by
Space Team
parent
f44d82ce6d
commit
ca59092318
+5
@@ -392,6 +392,11 @@ open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget> : AbstractKotl
|
|||||||
|
|
||||||
it.destinationDirectory.set(project.klibOutputDirectory(compilationInfo).resolve("klib"))
|
it.destinationDirectory.set(project.klibOutputDirectory(compilationInfo).resolve("klib"))
|
||||||
it.compilerOptions.moduleName.set(project.klibModuleName(it.baseName))
|
it.compilerOptions.moduleName.set(project.klibModuleName(it.baseName))
|
||||||
|
val propertiesProvider = PropertiesProvider(project)
|
||||||
|
if (propertiesProvider.useK2 == true) {
|
||||||
|
it.compilerOptions.useK2.set(true)
|
||||||
|
}
|
||||||
|
it.compilerOptions.useK2.disallowChanges()
|
||||||
}
|
}
|
||||||
|
|
||||||
compilationInfo.classesDirs.from(compileTaskProvider.map { it.outputFile })
|
compilationInfo.classesDirs.from(compileTaskProvider.map { it.outputFile })
|
||||||
|
|||||||
-3
@@ -17,9 +17,6 @@ class NativeCompilerOptions(project: Project) : HasCompilerOptions<KotlinCommonC
|
|||||||
|
|
||||||
override val options: KotlinNativeCompilerOptions = project.objects
|
override val options: KotlinNativeCompilerOptions = project.objects
|
||||||
.newInstance(KotlinNativeCompilerOptionsDefault::class.java)
|
.newInstance(KotlinNativeCompilerOptionsDefault::class.java)
|
||||||
.apply {
|
|
||||||
useK2.finalizeValue()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun syncLanguageSettings(languageSettings: LanguageSettings) {
|
internal fun syncLanguageSettings(languageSettings: LanguageSettings) {
|
||||||
applyLanguageSettingsToCompilerOptions(languageSettings, options)
|
applyLanguageSettingsToCompilerOptions(languageSettings, options)
|
||||||
|
|||||||
+3
@@ -187,6 +187,9 @@ internal fun buildKotlinNativeCompileCommonArgs(
|
|||||||
addKey("-nowarn", compilerOptions.suppressWarnings.get())
|
addKey("-nowarn", compilerOptions.suppressWarnings.get())
|
||||||
addKey("-verbose", compilerOptions.verbose.get())
|
addKey("-verbose", compilerOptions.verbose.get())
|
||||||
addKey("-progressive", compilerOptions.progressiveMode.get())
|
addKey("-progressive", compilerOptions.progressiveMode.get())
|
||||||
|
if (compilerOptions.useK2.get()) {
|
||||||
|
add("-Xuse-k2")
|
||||||
|
}
|
||||||
compilerOptions.optIn.get().forEach { add("-opt-in=$it") }
|
compilerOptions.optIn.get().forEach { add("-opt-in=$it") }
|
||||||
|
|
||||||
addAll(compilerOptions.freeCompilerArgs.get())
|
addAll(compilerOptions.freeCompilerArgs.get())
|
||||||
|
|||||||
Reference in New Issue
Block a user