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
This commit is contained in:
Mikhail Glukhikh
2018-08-13 17:03:02 +03:00
parent a7b51070a7
commit bc102bf0c6
2 changed files with 18 additions and 8 deletions
@@ -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
}
}
}
@@ -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
}
}
}