Fix calculation of target platform for common test modules for NMPP

#KT-34070 Fixed
This commit is contained in:
Andrey Uskov
2019-09-29 22:01:07 +03:00
parent 9af6efcb24
commit c0f2be478f
@@ -614,12 +614,11 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
val platforms = compilations.map { it.platform } val platforms = compilations.map { it.platform }
sourceSet.actualPlatforms.addSimplePlatforms(platforms) sourceSet.actualPlatforms.addSimplePlatforms(platforms)
if (isHMPPEnabled) { sourceSet.dependsOnSourceSets.mapNotNull { sourceSets[it] }.forEach {
sourceSet.dependsOnSourceSets.mapNotNull { sourceSets[it] }.forEach { it?.actualPlatforms?.addSimplePlatforms(platforms)
it?.actualPlatforms?.addSimplePlatforms(platforms)
}
} }
sourceSet.isTestModule = compilations.all { it.isTestModule } sourceSet.isTestModule = compilations.all { it.isTestModule }
} else { } else {
//TODO(auskov): remove this branch as far as import of orphan source sets is dropped //TODO(auskov): remove this branch as far as import of orphan source sets is dropped
@@ -633,6 +632,10 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
continue continue
} }
} }
if ((! isHMPPEnabled) && sourceSet.actualPlatforms.platforms.size > 1) {
sourceSet.actualPlatforms.addSimplePlatforms(listOf(KotlinPlatform.COMMON))
}
} }
} }