MPP: Add production module dependencies to the test one (new MPP import)
#KT-25985 In Progress
This commit is contained in:
+17
-6
@@ -337,13 +337,14 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
||||
}
|
||||
}
|
||||
}
|
||||
val sourceSetGraph = GraphBuilder.directed().build<KotlinSourceSet>()
|
||||
val sourceSetGraph = GraphBuilder.directed().build<KotlinModule>()
|
||||
processSourceSets(gradleModule, mppModel, ideModule, resolverCtx) { dataNode, sourceSet ->
|
||||
dataNode.data.productionModuleId?.let {
|
||||
val productionModuleDataNode = ideModule.findChildModuleByInternalName(it)
|
||||
if (productionModuleDataNode != null) {
|
||||
addDependency(dataNode, productionModuleDataNode)
|
||||
}
|
||||
val productionSourceSet = dataNode.data.productionModuleId
|
||||
?.let { ideModule.findChildModuleByInternalName(it) }
|
||||
?.kotlinSourceSet
|
||||
?.kotlinModule
|
||||
if (productionSourceSet != null) {
|
||||
sourceSetGraph.putEdge(sourceSet, productionSourceSet!!)
|
||||
}
|
||||
for (targetSourceSetName in sourceSet.dependsOnSourceSets) {
|
||||
val targetSourceSet = mppModel.sourceSets[targetSourceSetName] ?: continue
|
||||
@@ -358,6 +359,16 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
||||
preprocessDependencies(sourceSet, ideProject),
|
||||
ideProject
|
||||
)
|
||||
if (productionSourceSet != null) {
|
||||
buildDependencies(
|
||||
resolverCtx,
|
||||
sourceSetMap,
|
||||
artifactsMap,
|
||||
dataNode,
|
||||
preprocessDependencies(productionSourceSet, ideProject),
|
||||
ideProject
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (edge in Graphs.transitiveClosure(sourceSetGraph).edges()) {
|
||||
|
||||
@@ -14,4 +14,4 @@ fun DataNode<*>.findChildModuleById(id: String) =
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun DataNode<*>.findChildModuleByInternalName(name: String) =
|
||||
children.firstOrNull { (it.data as? ModuleData)?.internalName == name }
|
||||
children.firstOrNull { (it.data as? ModuleData)?.internalName == name } as? DataNode<out ModuleData>
|
||||
Reference in New Issue
Block a user