From a417630c24a902586ece640a97d7b644258a22a9 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Mon, 10 Sep 2018 18:51:24 +0300 Subject: [PATCH] MPP: Force COMMON platform for commonMain/commonTest source sets Follow-up for 172/AS3.1 bunches --- .../src/KotlinMPPGradleModelBuilder.kt.173 | 12 ++++++++++++ .../src/KotlinMPPGradleModelBuilder.kt.as31 | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.173 b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.173 index 45cd6e292e2..f2b479137cf 100644 --- a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.173 +++ b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.173 @@ -297,6 +297,18 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService { } } for (sourceSet in sourceSets) { + val name = sourceSet.name + if (name == KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME) { + sourceSet.platform = KotlinPlatform.COMMON + sourceSet.isTestModule = false + continue + } + if (name == KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME) { + sourceSet.platform = KotlinPlatform.COMMON + sourceSet.isTestModule = true + continue + } + val compilations = sourceSetToCompilations[sourceSet] if (compilations != null) { sourceSet.platform = compilations.map { it.platform }.distinct().singleOrNull() ?: KotlinPlatform.COMMON diff --git a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.as31 b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.as31 index 45cd6e292e2..f2b479137cf 100644 --- a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.as31 +++ b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.as31 @@ -297,6 +297,18 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService { } } for (sourceSet in sourceSets) { + val name = sourceSet.name + if (name == KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME) { + sourceSet.platform = KotlinPlatform.COMMON + sourceSet.isTestModule = false + continue + } + if (name == KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME) { + sourceSet.platform = KotlinPlatform.COMMON + sourceSet.isTestModule = true + continue + } + val compilations = sourceSetToCompilations[sourceSet] if (compilations != null) { sourceSet.platform = compilations.map { it.platform }.distinct().singleOrNull() ?: KotlinPlatform.COMMON