File tree 1 file changed +15
-5
lines changed
src/main/starlark/builtins_bzl/common/cc
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -546,11 +546,21 @@ def _cc_shared_library_impl(ctx):
546
546
def _graph_structure_aspect_impl (target , ctx ):
547
547
children = []
548
548
549
- # For now ignore cases when deps is of type label instead of label_list.
550
- if hasattr (ctx .rule .attr , "deps" ) and type (ctx .rule .attr .deps ) != "Target" :
551
- for dep in ctx .rule .attr .deps :
552
- if GraphNodeInfo in dep :
553
- children .append (dep [GraphNodeInfo ])
549
+ # Collect graph structure info from any possible deplike attribute. The aspect
550
+ # itself applies across every deplike attribute (attr_aspects is *), so enumerate
551
+ # over all attributes and consume GraphNodeInfo if available.
552
+ for fieldname in dir (ctx .rule .attr ):
553
+ if fieldname == "_cc_toolchain" or fieldname == "target_compatible_with" :
554
+ continue
555
+ deps = getattr (ctx .rule .attr , fieldname , None )
556
+ if type (deps ) == "list" :
557
+ for dep in deps :
558
+ if type (dep ) == "Target" and GraphNodeInfo in dep :
559
+ children .append (dep [GraphNodeInfo ])
560
+
561
+ # Single dep.
562
+ elif type (deps ) == "Target" and GraphNodeInfo in deps :
563
+ children .append (deps [GraphNodeInfo ])
554
564
555
565
# TODO(bazel-team): Add flag to Bazel that can toggle the initialization of
556
566
# linkable_more_than_once.
You can’t perform that action at this time.
0 commit comments