Do not show warnings when some projects are not generated before import

#KT-35442 Fixed
This commit is contained in:
Andrey Uskov
2019-12-19 16:50:56 +03:00
parent 76759d3a5f
commit 44edfc3717
@@ -75,9 +75,13 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
targets: Collection<KotlinTarget>,
project: Project
): Map<String, KotlinSourceSetImpl> {
if (project.properties["import_orphan_source_sets"]?.toString()?.toBoolean() ?: DEFAULT_IMPORT_ORPHAN_SOURCE_SETS) return sourceSets
val compiledSourceSets: Collection<String> = targets.flatMap { it.compilations }
.flatMap { it.sourceSets }.flatMap { it.dependsOnSourceSets.union(listOf(it.name)) }.distinct()
if (try {
project.properties["import_orphan_source_sets"]
} catch (e: Exception) {
null
}?.toString()?.toBoolean() ?: DEFAULT_IMPORT_ORPHAN_SOURCE_SETS
) return sourceSets
val compiledSourceSets: Collection<String> = targets.flatMap { it.compilations }.flatMap { it.sourceSets }.flatMap { it.dependsOnSourceSets.union(listOf(it.name)) }.distinct()
sourceSets.filter { !compiledSourceSets.contains(it.key) }.forEach {
logger.warn("[sync warning] Source set \"${it.key}\" is not compiled with any compilation. This source set is not imported in the IDE.")
}