Fix wrong assumption in getHostSpecificSourceSets (KMM-225)

The assumption that each source set is already registered in at least
one compilation would break Android targets which are configured later
on the execution path, and also fail when there are unused source sets.

Issue #KMM-225 Fixed
This commit is contained in:
Sergey Igushkin
2020-03-28 12:36:30 +03:00
parent 67f4b7e2b0
commit a9dd194383
@@ -147,6 +147,8 @@ internal fun getHostSpecificSourceSets(project: Project): List<KotlinSourceSet>
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,