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 ->
|
processSourceSets(gradleModule, mppModel, ideModule, resolverCtx) { dataNode, sourceSet ->
|
||||||
dataNode.data.productionModuleId?.let {
|
val productionSourceSet = dataNode.data.productionModuleId
|
||||||
val productionModuleDataNode = ideModule.findChildModuleByInternalName(it)
|
?.let { ideModule.findChildModuleByInternalName(it) }
|
||||||
if (productionModuleDataNode != null) {
|
?.kotlinSourceSet
|
||||||
addDependency(dataNode, productionModuleDataNode)
|
?.kotlinModule
|
||||||
}
|
if (productionSourceSet != null) {
|
||||||
|
sourceSetGraph.putEdge(sourceSet, productionSourceSet!!)
|
||||||
}
|
}
|
||||||
for (targetSourceSetName in sourceSet.dependsOnSourceSets) {
|
for (targetSourceSetName in sourceSet.dependsOnSourceSets) {
|
||||||
val targetSourceSet = mppModel.sourceSets[targetSourceSetName] ?: continue
|
val targetSourceSet = mppModel.sourceSets[targetSourceSetName] ?: continue
|
||||||
@@ -358,6 +359,16 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
|||||||
preprocessDependencies(sourceSet, ideProject),
|
preprocessDependencies(sourceSet, ideProject),
|
||||||
ideProject
|
ideProject
|
||||||
)
|
)
|
||||||
|
if (productionSourceSet != null) {
|
||||||
|
buildDependencies(
|
||||||
|
resolverCtx,
|
||||||
|
sourceSetMap,
|
||||||
|
artifactsMap,
|
||||||
|
dataNode,
|
||||||
|
preprocessDependencies(productionSourceSet, ideProject),
|
||||||
|
ideProject
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (edge in Graphs.transitiveClosure(sourceSetGraph).edges()) {
|
for (edge in Graphs.transitiveClosure(sourceSetGraph).edges()) {
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ fun DataNode<*>.findChildModuleById(id: String) =
|
|||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun DataNode<*>.findChildModuleByInternalName(name: String) =
|
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