From 44edfc37179740c85e9e0fce9a43129c7ff93c39 Mon Sep 17 00:00:00 2001 From: Andrey Uskov Date: Thu, 19 Dec 2019 16:50:56 +0300 Subject: [PATCH] Do not show warnings when some projects are not generated before import #KT-35442 Fixed --- .../src/KotlinMPPGradleModelBuilder.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt index 2dd27f2920c..e1edbaec389 100644 --- a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt +++ b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt @@ -75,9 +75,13 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService { targets: Collection, project: Project ): Map { - if (project.properties["import_orphan_source_sets"]?.toString()?.toBoolean() ?: DEFAULT_IMPORT_ORPHAN_SOURCE_SETS) return sourceSets - val compiledSourceSets: Collection = 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 = 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.") }