MPP: Use all transitively reachable modules as compilation source sets
#KT-26254 Fixed
This commit is contained in:
+16
-5
@@ -350,6 +350,7 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
||||
?.let { ideModule.findChildModuleByInternalName(it) }
|
||||
?.kotlinSourceSet
|
||||
?.kotlinModule
|
||||
?.toSourceSet(mppModel)
|
||||
if (productionSourceSet != null) {
|
||||
sourceSetGraph.putEdge(sourceSet, productionSourceSet)
|
||||
}
|
||||
@@ -366,6 +367,15 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
||||
val toDataNode = getSiblingKotlinModuleData(dependeeSourceSet, gradleModule, ideModule, resolverCtx) ?: continue
|
||||
addDependency(fromDataNode, toDataNode)
|
||||
}
|
||||
val sourceSetInfo = fromDataNode.kotlinSourceSet
|
||||
if (sourceSetInfo != null && sourceSetInfo.kotlinModule is KotlinCompilation) {
|
||||
val selfName = sourceSetInfo.kotlinModule.fullName()
|
||||
sourceSetInfo.sourceSetIdsByName = dependeeSourceSets
|
||||
.asSequence()
|
||||
.filter { it.fullName() != selfName }
|
||||
.map { it.name to getKotlinModuleId(gradleModule, it, resolverCtx) }
|
||||
.toMap()
|
||||
}
|
||||
if (processedModuleIds.add(getKotlinModuleId(gradleModule, sourceSet, resolverCtx))) {
|
||||
val mergedDependencies = LinkedHashSet<KotlinDependency>().apply {
|
||||
addAll(sourceSet.dependencies)
|
||||
@@ -383,6 +393,12 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun KotlinModule.toSourceSet(mppModel: KotlinMPPGradleModel) = when (this) {
|
||||
is KotlinSourceSet -> this
|
||||
is KotlinCompilation -> mppModel.sourceSets[fullName()]
|
||||
else -> null
|
||||
}
|
||||
|
||||
private fun preprocessDependencies(
|
||||
dependencies: Set<KotlinDependency>,
|
||||
ideProject: DataNode<ProjectData>
|
||||
@@ -613,11 +629,6 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
||||
}
|
||||
it.dependencyClasspath = compilation.dependencyClasspath
|
||||
it.defaultCompilerArguments = createCompilerArguments(compilation.arguments.defaultArguments, compilation.platform)
|
||||
it.sourceSetIdsByName = compilation.sourceSets
|
||||
.asSequence()
|
||||
.filter { it.fullName() != compilation.fullName() }
|
||||
.map { it.name to getKotlinModuleId(gradleModule, it, resolverCtx) }
|
||||
.toMap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user