Skip to content

Commit 1816af2

Browse files
committed
fix(model): Fix handling of cycles in transitive dependencies
Stop processing transitive dependencies in `DependencyGraphBuilder` if the same dependency already appeared in the same branch. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
1 parent 370fa49 commit 1816af2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

model/src/main/kotlin/utils/DependencyGraphBuilder.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,10 @@ class DependencyGraphBuilder<D>(
377377
processed: Set<D>
378378
): DependencyReference? {
379379
val transitiveDependencies = dependencyHandler.dependenciesFor(dependency).mapNotNullTo(mutableSetOf()) {
380-
addDependencyToGraph(scopeName, it, transitive = true, processed)
380+
if (it in processed) {
381+
return@mapNotNullTo null
382+
}
383+
addDependencyToGraph(scopeName, it, transitive = true, processed + dependency)
381384
}
382385

383386
val fragmentMapping = referenceMappings[index.fragment]

0 commit comments

Comments
 (0)