Browse Source

Disable signature clash checks for web targets (#3445)

Compose compiler plugin produces symbols with identical signatures. k/jvm and k/native do not check for clashes, while k/js does. We disable the checker in our gradle plugin, so our users do not need to add extra workaround on their side.
pull/3449/head
Oleksandr Karpovich 1 year ago committed by GitHub
parent
commit
a947c5efcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt

20
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt

@ -24,11 +24,14 @@ import org.jetbrains.compose.experimental.internal.configureExperimental
import org.jetbrains.compose.experimental.uikit.internal.resources.configureSyncTask
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.web.WebExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
internal val composeVersion get() = ComposeBuildConfig.composeVersion
@ -67,6 +70,23 @@ class ComposePlugin : Plugin<Project> {
}
}
}
disableSignatureClashCheck(project)
}
}
private fun disableSignatureClashCheck(project: Project) {
val hasAnyWebTarget = project.mppExtOrNull?.targets?.firstOrNull {
it.platformType == KotlinPlatformType.js ||
it.platformType == KotlinPlatformType.wasm
} != null
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",
)
}
}
}

Loading…
Cancel
Save