From 395b2119a128dd13c05fa96a60ee26b72ba3cd42 Mon Sep 17 00:00:00 2001 From: Sergey Igushkin Date: Thu, 5 Aug 2021 18:47:12 +0400 Subject: [PATCH] Fixup for the fix of KT-47506 interfering with CInterop changes As the `*Default` configurations are gone, each K/N target now has two consumable configuration, the `*ApiElements` and the `*CInteropApiElements`. They have diverging sets of attributes (both more concrete than `*Default` had). To make their attribute sets non-diverging, we set the local-to-project=public on the `*CInteropApiElements` in order to match the same attribute on the `*ApiElements` configuration Related to the original fix of KT-47506 --- .../gradle/targets/native/internal/CInteropConfigurations.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/CInteropConfigurations.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/CInteropConfigurations.kt index dbd6f791fc2..f36595787aa 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/CInteropConfigurations.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/CInteropConfigurations.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinTarget import org.jetbrains.kotlin.gradle.plugin.mpp.DefaultCInteropSettings import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages +import org.jetbrains.kotlin.gradle.plugin.setupAsPublicConfigurationIfSupported import org.jetbrains.kotlin.gradle.plugin.usesPlatformOf import org.jetbrains.kotlin.gradle.targets.native.internal.CInteropKlibLibraryElements.cinteropKlibLibraryElements import org.jetbrains.kotlin.gradle.tasks.CInteropProcess @@ -63,6 +64,7 @@ internal fun Project.locateOrCreateCInteropApiElementsConfiguration(target: Kotl return configurations.create(configurationName).apply { isCanBeResolved = false isCanBeConsumed = true + setupAsPublicConfigurationIfSupported(target) usesPlatformOf(target) attributes.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, cinteropKlibLibraryElements())