Skip to content

Commit

Permalink
[Bazel6] Handle removal of ObjcProvider.direct_headers
Browse files Browse the repository at this point in the history
Handle bazelbuild/bazel#14559 (bazelbuild/bazel@8a2b711) to prepare for Bazel 6 but still work in Bazel 5.
  • Loading branch information
mattrobmattrob committed Dec 3, 2022
1 parent c500b34 commit f21e508
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rules/framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def _get_direct_public_headers(provider, dep):
return []
return dep[provider].compilation_context.direct_public_headers
elif provider == apple_common.Objc:
return dep[provider].direct_headers
return getattr(dep[provider], "direct_headers", [])
else:
fail("Unknown provider " + provider + " only CcInfo and Objc supported")

Expand Down
2 changes: 1 addition & 1 deletion rules/hmap.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _make_headermap_impl(ctx):

for provider in ctx.attr.direct_hdr_providers:
if apple_common.Objc in provider:
hdrs_lists.append(provider[apple_common.Objc].direct_headers)
hdrs_lists.append(getattr(provider[apple_common.Objc], "direct_headers", []))
if CcInfo in provider:
hdrs_lists.append(provider[CcInfo].compilation_context.direct_headers)

Expand Down
2 changes: 1 addition & 1 deletion rules/legacy_xcodeproj.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _xcodeproj_aspect_impl(target, ctx):
if AppleBundleInfo in target:
swift_objc_header_path = None
if SwiftInfo in target:
for h in target[apple_common.Objc].direct_headers:
for h in getattr(target[apple_common.Objc], "direct_headers", []):
if h.path.endswith("-Swift.h"):
swift_objc_header_path = h.path

Expand Down

0 comments on commit f21e508

Please sign in to comment.