Remove unused KotlinSourceSetImpl.defaultIsTestModule; simplify logic of test modules detection
^KT-37127
This commit is contained in:
@@ -785,16 +785,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO DISCUSS AT REVIEW: can we simplify it to:
|
||||
// sourceSet.isTestModule = importingContext.compilationsBySourceSet(sourceSet)?.all { it.isTestModule} ?: false
|
||||
// ^
|
||||
// |
|
||||
// sic!
|
||||
// The difference from the current behaviour would be in case if source set is not included into any compilation AND
|
||||
// KotlinSourceSetImpl.defaultIsTestModule is set to 'true'. Though I don't know who and why would do that.
|
||||
importingContext.compilationsBySourceSet(sourceSet)?.all { it.isTestModule }?.let { isTest ->
|
||||
sourceSet.isTestModule = isTest
|
||||
}
|
||||
sourceSet.isTestModule = importingContext.compilationsBySourceSet(sourceSet)?.all { it.isTestModule } ?: false
|
||||
|
||||
importingContext.compilationsBySourceSet(sourceSet)?.let { compilations ->
|
||||
val platforms = compilations.map { it.platform }
|
||||
|
||||
@@ -36,7 +36,6 @@ class KotlinSourceSetImpl(
|
||||
override val dependencies: Array<KotlinDependencyId>,
|
||||
override val dependsOnSourceSets: Set<String>,
|
||||
val defaultPlatform: KotlinPlatformContainerImpl = KotlinPlatformContainerImpl(),
|
||||
val defaultIsTestModule: Boolean = false
|
||||
) : KotlinSourceSet {
|
||||
|
||||
constructor(kotlinSourceSet: KotlinSourceSet, cloningCache: MutableMap<Any, Any>) : this(
|
||||
@@ -46,14 +45,15 @@ class KotlinSourceSetImpl(
|
||||
HashSet(kotlinSourceSet.resourceDirs),
|
||||
kotlinSourceSet.dependencies,
|
||||
HashSet(kotlinSourceSet.dependsOnSourceSets),
|
||||
KotlinPlatformContainerImpl(kotlinSourceSet.actualPlatforms),
|
||||
kotlinSourceSet.isTestModule
|
||||
)
|
||||
KotlinPlatformContainerImpl(kotlinSourceSet.actualPlatforms)
|
||||
) {
|
||||
this.isTestModule = kotlinSourceSet.isTestModule
|
||||
}
|
||||
|
||||
override var actualPlatforms: KotlinPlatformContainer = defaultPlatform
|
||||
internal set
|
||||
|
||||
override var isTestModule: Boolean = defaultIsTestModule
|
||||
override var isTestModule: Boolean = false
|
||||
internal set
|
||||
|
||||
override fun toString() = name
|
||||
|
||||
Reference in New Issue
Block a user