Fixed import of MPP project with single Android target

#KT-34639 Fixed
This commit is contained in:
Andrey Uskov
2019-10-28 19:43:43 +03:00
parent 5c3b00cd0c
commit fd2b75e39b
7 changed files with 175 additions and 5 deletions
@@ -668,6 +668,18 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
}
for (sourceSet in sourceSets.values) {
if (!isHMPPEnabled) {
val name = sourceSet.name
if (name == KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME) {
sourceSet.isTestModule = false
continue
}
if (name == KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME) {
sourceSet.isTestModule = true
continue
}
}
(allSourceSetToCompilations[sourceSet]?.all { it.isTestModule }
?: if (!isHMPPEnabled && sourceSet.name == KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME) true else null)?.let { isTest ->
sourceSet.isTestModule = isTest
@@ -242,7 +242,13 @@ class KotlinPlatformContainerImpl() : KotlinPlatformContainer {
override fun supports(simplePlatform: KotlinPlatform): Boolean = platforms.contains(simplePlatform)
override fun addSimplePlatforms(platforms: Collection<KotlinPlatform>) {
(myPlatforms ?: HashSet<KotlinPlatform>().apply { myPlatforms = this }).addAll(platforms)
(myPlatforms ?: HashSet<KotlinPlatform>().apply { myPlatforms = this }).let {
it.addAll(platforms)
if (it.contains(KotlinPlatform.COMMON)) {
it.clear()
it.addAll(defaultCommonPlatform)
}
}
}
}