Skip to content

Commit

Permalink
Use getattr for aspect_hints in swift_clang_module_aspect (#1224)
Browse files Browse the repository at this point in the history
To make supporting Bazel 6 easier use `getattr` to conditionally get the
`aspect_hints` attr. This can be removed when we drop support for Bazel
6 as `aspect_hints` are always available as an attr in Bazel 7+
  • Loading branch information
luispadron authored Jun 18, 2024
1 parent d4049f2 commit 874f984
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion swift/internal/swift_clang_module_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,8 @@ def _find_swift_interop_info(target, aspect_ctx):
# We don't break this loop early when we find a matching hint, because we
# want to give an error message if there are two aspect hints that provide
# `_SwiftInteropInfo` (or if both the rule and an aspect hint do).
for hint in aspect_ctx.rule.attr.aspect_hints:
# TODO: remove usage of `getattr` and use `aspect_ctx.rule.attr.aspect_hints` directly when we drop Bazel 6.
for hint in getattr(aspect_ctx.rule.attr, "aspect_hints", []):
if _SwiftInteropInfo in hint:
if interop_target:
if interop_from_rule:
Expand Down

0 comments on commit 874f984

Please sign in to comment.