```- closure = set() - for root_target in ro...
# general
w
Copy code
-    closure = set()
-    for root_target in root_targets:
-      # If we have already collected a subgraph, skip it.
-      if root_target not in closure:
-        closure.update(root_target.closure(bfs=True))
+    # TODO(stuhood): provide a higher-level way to accomplish a multi-target bfs walk:
+    #   see <https://github.com/pantsbuild/pants/issues/2602>
+    if root_targets:
+      build_graph = iter(root_targets).next()._build_graph
+      addresses = [t.address for t in root_targets]
+      closure = build_graph.transitive_subgraph_of_addresses_bfs(addresses)
+    else:
+      closure = set()