Skip to content

Commit 778e2d3

Browse files
Adam Cozzettemkruskal-google
authored andcommitted
Update cc_file_list_aspect to handle targets with missing hdrs/textual_hdrs
Our stale file regeneration logic broke with Bazel 6.4.0, and I suspect it was caused by this change: bazelbuild/bazel#19534 Our logic assumed that any target with a `CcInfo` provider must have `hdrs` and `textual_hdrs` attributes, but it seems that this is no longer true for `cc_proto_library` starting with Bazel 6.4.0. The fix is just to use `getattr` and treat the item as an empty list if it's missing. PiperOrigin-RevId: 575473886
1 parent 72946d7 commit 778e2d3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pkg/cc_dist_library.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,12 @@ def _cc_file_list_aspect_impl(target, ctx):
170170

171171
return [CcFileList(
172172
hdrs = _get_transitive_sources(
173-
_flatten_target_files(rule_attr.hdrs).to_list(),
173+
_flatten_target_files(getattr(rule_attr, "hdrs", [])).to_list(),
174174
"hdrs",
175175
rule_attr.deps,
176176
),
177177
textual_hdrs = _get_transitive_sources(
178-
_flatten_target_files(rule_attr.textual_hdrs).to_list(),
178+
_flatten_target_files(getattr(rule_attr, "textual_hdrs", [])).to_list(),
179179
"textual_hdrs",
180180
rule_attr.deps,
181181
),

0 commit comments

Comments
 (0)