From bc102bf0c6605f9108925bf3597d68b1acd61e28 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 13 Aug 2018 17:03:02 +0300 Subject: [PATCH] MPP new model: temporarily solution for commonTest type identification Now if source set is not included into any compilation target, then it is counted as test source set iff "Test" is in name So #KT-26076 Fixed --- .../src/KotlinMPPGradleModelBuilder.kt | 13 +++++++++---- .../src/KotlinMPPGradleModelBuilder.kt.181 | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt index d8693d2a120..949b97f7885 100644 --- a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt +++ b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt @@ -276,10 +276,15 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService { } } for (sourceSet in sourceSets) { - val compilations = sourceSetToCompilations[sourceSet] ?: continue - sourceSet.platform = compilations.map { it.platform }.distinct().singleOrNull() ?: KotlinPlatform.COMMON - sourceSet.isTestModule = compilations.all { it.isTestModule } - sourceSet.isAndroid = compilations.all { it.isAndroid } + val compilations = sourceSetToCompilations[sourceSet] + if (compilations != null) { + sourceSet.platform = compilations.map { it.platform }.distinct().singleOrNull() ?: KotlinPlatform.COMMON + sourceSet.isTestModule = compilations.all { it.isTestModule } + sourceSet.isAndroid = compilations.all { it.isAndroid } + } else { + // TODO: change me after design about it + sourceSet.isTestModule = "Test" in sourceSet.name + } } } diff --git a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.181 b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.181 index 2cf47ce3799..2f2e88efbda 100644 --- a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.181 +++ b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.181 @@ -276,10 +276,15 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService { } } for (sourceSet in sourceSets) { - val compilations = sourceSetToCompilations[sourceSet] ?: continue - sourceSet.platform = compilations.map { it.platform }.distinct().singleOrNull() ?: KotlinPlatform.COMMON - sourceSet.isTestModule = compilations.all { it.isTestModule } - sourceSet.isAndroid = compilations.all { it.isAndroid } + val compilations = sourceSetToCompilations[sourceSet] + if (compilations != null) { + sourceSet.platform = compilations.map { it.platform }.distinct().singleOrNull() ?: KotlinPlatform.COMMON + sourceSet.isTestModule = compilations.all { it.isTestModule } + sourceSet.isAndroid = compilations.all { it.isAndroid } + } else { + // TODO: change me after design about it + sourceSet.isTestModule = "Test" in sourceSet.name + } } }