Skip to content

[Bazel6] Handle removal of ObjcProvider.direct_headers #620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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", [])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattrobmattrob so the gist is that the previous condition is hit on Bazel 6. LGTM overall

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't confirm that but as far as I can tell, yes. At least for all the cases tested by my code and the CI suite.

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