You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**kwargs): # For the other common attributes. Tags, compatible_with, etc. https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes.
# Convert the various, acceptable target shorthands into the dictionary format
80
103
# In Python, `type(x) == y` is an antipattern, but [Starlark doesn't support inheritance](https://bazel.build/rules/language), so `isinstance` doesn't exist, and this is the correct way to switch on type.
81
-
ifnottargets: # Default to all targets in main workspace
104
+
ifnottargetsandlen(target_collection_targets) ==0: # Default to all targets in main workspace
82
105
targets= {"@//...": ""}
106
+
ifnottargets: # In this case, targets were defined only in `target_collections`
# Pass select() to _expand_template to make it work
85
110
# see https://bazel.build/docs/configurable-attributes#faq-select-macro
86
111
pass
87
112
eliftype(targets) =="list": # Allow specifying a list of targets w/o arguments
88
-
targets= {target: ""fortargetintargets}
113
+
# The reason we want the list of target collection targets is that if you specify a target in `target_collections`, you don't have to redundantly specify it in `targets`, *unless* you want to specify build flags too.
114
+
# So we want to cull the list of target collection targets down to only those that *aren't* specified in `targets`.
" {target_file_names}": "\n".join([" '{}': '{}',".format(target, file_name) for (target, file_name) inctx.attr.labels_to_file_names.items()]),
160
+
" {target_collections}": "\n".join([" '{}': '{}',".format(target, collection_name) for (target, collection_name) inctx.attr.labels_to_collections.items()]),
136
161
" {windows_default_include_paths}": "\n".join([" %r,"%pathforpathinfind_cpp_toolchain(ctx).built_in_include_directories]), # find_cpp_toolchain is from https://docs.bazel.build/versions/main/integrating-with-rules-cc.html
0 commit comments