[Gradle] Apply Language Settings in the correct Lifecycle Stages

After introduction of KGP Lifecycle stages the application of
Language Settings to Targets and Compilation (from source set level)
wasn't synchronized. Which led to data flow race. Delaying this
application to correct stages solves the data flow race.

^KT-59063
This commit is contained in:
Anton Lakotka
2023-06-12 09:11:27 +02:00
committed by Space Team
parent b097292ddf
commit 67d933185a
2 changed files with 2 additions and 2 deletions
@@ -241,7 +241,7 @@ open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget> : AbstractKotl
project.syncLanguageSettingsToLinkTask(binary)
}
}
project.runOnceAfterEvaluated("Sync native compilation language settings to compiler options") {
project.launchInStage(KotlinPluginLifecycle.Stage.FinaliseCompilations) {
target.compilations.all { compilation ->
compilation.compilerOptions.syncLanguageSettings(compilation.defaultSourceSet.languageSettings)
}
@@ -48,7 +48,7 @@ internal abstract class AbstractKotlinCompileConfig<TASK : AbstractKotlinCompile
init {
configureTaskProvider { taskProvider ->
project.runOnceAfterEvaluated("apply properties and language settings to ${taskProvider.name}") {
project.launchInStage(KotlinPluginLifecycle.Stage.AfterFinaliseCompilations) {
taskProvider.configure {
// KaptGenerateStubs will receive value from linked KotlinCompile task
if (it is KaptGenerateStubsTask) return@configure