diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/KotlinNativeTarget.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/KotlinNativeTarget.kt index c363a80e3dc..08cb41578c3 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/KotlinNativeTarget.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/KotlinNativeTarget.kt @@ -147,6 +147,8 @@ internal fun getHostSpecificSourceSets(project: Project): List fun canBeBuiltOnHosts(konanTarget: KonanTarget) = enabledByHost.filterValues { konanTarget in it }.keys return project.kotlinExtension.sourceSets.filter { sourceSet -> + if (sourceSet !in compilationsBySourceSet) return@filter false + // If the source set participates in compilations such that some host can't run either of them, then on that host, // we can't analyze the source set, so the source set's metadata can't be published from that host, and therefore // we consider it platform-specific and publish as a part of the Native targets where the source set takes part,