From ef04ae041e8bf17e7ff5ff27f78f5bc446f1f856 Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Wed, 13 Jan 2021 11:33:02 +0300 Subject: [PATCH] Minor: swap receiver and parameter for shouldCoerceToCommon Otherwise, it reads as if KotlinSourceSet coerces ImportingContext, which is in fact the other way around --- .../src/KotlinMPPGradleModelBuilder.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt index 14385dd789d..f606ade930e 100644 --- a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt +++ b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt @@ -745,19 +745,19 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService { sourceSet.actualPlatforms.addSimplePlatforms(platforms) } - if (sourceSet.shouldCoerceToCommon(importingContext)) { + if (importingContext.shouldCoerceToCommon(sourceSet)) { sourceSet.actualPlatforms.addSimplePlatforms(listOf(KotlinPlatform.COMMON)) } } } - private fun KotlinSourceSetImpl.shouldCoerceToCommon(importingContext: MultiplatformModelImportingContext): Boolean { - val isHMPPEnabled = importingContext.getProperty(IS_HMPP_ENABLED) - val coerceRootSourceSetsToCommon = importingContext.getProperty(COERCE_ROOT_SOURCE_SETS_TO_COMMON) - val isRoot = name == COMMON_MAIN_SOURCE_SET_NAME || name == COMMON_TEST_SOURCE_SET_NAME + private fun MultiplatformModelImportingContext.shouldCoerceToCommon(sourceSet: KotlinSourceSetImpl): Boolean { + val isHMPPEnabled = getProperty(IS_HMPP_ENABLED) + val coerceRootSourceSetsToCommon = getProperty(COERCE_ROOT_SOURCE_SETS_TO_COMMON) + val isRoot = sourceSet.name == COMMON_MAIN_SOURCE_SET_NAME || sourceSet.name == COMMON_TEST_SOURCE_SET_NAME // never makes sense to coerce single-targeted source-sets - if (actualPlatforms.platforms.size == 1) return false + if (sourceSet.actualPlatforms.platforms.size == 1) return false return when { // pre-HMPP has only single-targeted source sets and COMMON