From 6501b6a4f6aecddff34643104f9adde9baff5346 Mon Sep 17 00:00:00 2001 From: Konstantin Tskhovrebov Date: Tue, 3 Sep 2024 18:51:16 +0200 Subject: [PATCH] [gradle] Migrate to the new compilerOptions API. --- .../org/jetbrains/compose/ComposePlugin.kt | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt index 41e9afd7efc..7a61eeda323 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt @@ -19,17 +19,20 @@ import org.jetbrains.compose.desktop.DesktopExtension import org.jetbrains.compose.desktop.application.internal.configureDesktop import org.jetbrains.compose.desktop.preview.internal.initializePreview import org.jetbrains.compose.experimental.dsl.ExperimentalExtension -import org.jetbrains.compose.experimental.internal.* -import org.jetbrains.compose.internal.* +import org.jetbrains.compose.experimental.internal.configureExperimentalTargetsFlagsCheck +import org.jetbrains.compose.internal.KOTLIN_MPP_PLUGIN_ID +import org.jetbrains.compose.internal.mppExt +import org.jetbrains.compose.internal.mppExtOrNull import org.jetbrains.compose.internal.utils.currentTarget import org.jetbrains.compose.resources.ResourcesExtension import org.jetbrains.compose.resources.configureComposeResources import org.jetbrains.compose.web.WebExtension import org.jetbrains.compose.web.internal.configureWeb -import org.jetbrains.kotlin.com.github.gundy.semver4j.SemVer -import org.jetbrains.kotlin.gradle.dsl.KotlinCompile import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile -import org.jetbrains.kotlin.gradle.plugin.* +import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler +import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType +import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile internal val composeVersion get() = ComposeBuildConfig.composeVersion @@ -63,12 +66,11 @@ abstract class ComposePlugin : Plugin { } project.tasks.withType(KotlinCompile::class.java).configureEach { - it.kotlinOptions.apply { - freeCompilerArgs = freeCompilerArgs + - composeExtension.kotlinCompilerPluginArgs.get().flatMap { arg -> - listOf("-P", "plugin:androidx.compose.compiler.plugins.kotlin:$arg") - } - } + it.compilerOptions.freeCompilerArgs.addAll( + composeExtension.kotlinCompilerPluginArgs.map { arg -> + listOf("-P", "plugin:androidx.compose.compiler.plugins.kotlin:$arg") + } + ) } disableSignatureClashCheck(project) @@ -83,9 +85,7 @@ abstract class ComposePlugin : Plugin { if (hasAnyWebTarget) { // currently k/wasm compile task is covered by KotlinJsCompile type project.tasks.withType(KotlinJsCompile::class.java).configureEach { - it.kotlinOptions.freeCompilerArgs += listOf( - "-Xklib-enable-signature-clash-checks=false", - ) + it.compilerOptions.freeCompilerArgs.add("-Xklib-enable-signature-clash-checks=false") } } }