From f9ecc7653c09131f33c19884d0ab15e2a3e0a9aa Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 2 Aug 2016 23:14:15 -0800 Subject: [PATCH] Fix transitive closure bug. --- .../main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt index a363d878..5407c647 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt @@ -68,11 +68,12 @@ class DynamicGraph { fun transitiveClosureGraph(root: T, childrenFor: (T) -> List, seen: HashSet = hashSetOf()) : Node { val children = arrayListOf>() + println("TRANSITIVE CLOSURE FOR " + root) childrenFor(root).forEach { child -> if (! seen.contains(child)) { - val c = transitiveClosureGraph(child, childrenFor) - children.add(c) seen.add(child) + val c = transitiveClosureGraph(child, childrenFor, seen) + children.add(c) } } return Node(root, children)