Skip to content
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

Add support for macos in apple_*_xcframework rules #2459

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luispadron
Copy link
Contributor

@luispadron luispadron commented May 26, 2024

Fixes #1475. Adds a new macos attr to the apple_*_framework rules which allow setting the architectures to build a macOS binary for.

Comment on lines +869 to +871
"macos": attr.string_list(
doc = """
A list of strings indicating which architecture should be built for the macOS platform (for example, `x86_64`, `arm64`).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keeping this a string_list_dict keeps the logic simpler, and maybe we just fail if folks pass simulator?

@luispadron luispadron force-pushed the luis/add-support-for-macos-xcframeworks branch from d8a3282 to 83af71b Compare May 26, 2024 20:39
@luispadron luispadron changed the title Add support for macos in apple_*_xcframework rules Add support for macos in apple_*_xcframework rules May 26, 2024
@luispadron luispadron force-pushed the luis/add-support-for-macos-xcframeworks branch 6 times, most recently from df2c4f8 to a330f7f Compare May 26, 2024 23:56
Comment on lines +35 to +36
if split_deps_key in deps:
all_deps += deps[split_deps_key]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@keith @brentleyjones this fixes an issue introduced by adding the macos attr to apple_static_xcframework:

ERROR: /Users/lpadron/Development/rules_apple/test/starlark_tests/targets_under_test/apple/BUILD:942:25: in apple_static_xcframework rule //test/starlark_tests/targets_under_test/apple:ios_static_xcframework_with_resources: 
Traceback (most recent call last):
        File "/Users/lpadron/Development/rules_apple/apple/internal/xcframework_rules.bzl", line 943, column 83, in _apple_static_xcframework_impl
                link_outputs_by_library_identifier = _group_link_outputs_by_library_identifier(
        File "/Users/lpadron/Development/rules_apple/apple/internal/xcframework_rules.bzl", line 205, column 45, in _group_link_outputs_by_library_identifier
                if swift_support.uses_swift(deps[split_attr_key]):
Error: key "ios_arm64e_device" not found in dictionary

How should we properly fix this? Is the apple_rule_arm64_as_arm64e_transition being applied here for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This still leaves us with:

ERROR: /Users/lpadron/Development/rules_apple/test/starlark_tests/targets_under_test/apple/BUILD:508:8: declared output 'test/starlark_tests/targets_under_test/apple/ios_xcframework_bundling_static_fmwks.xcframework/ios-arm64_x86_64-simulator/ios_xcframework_bundling_static_fmwks.framework/Headers/ios_xcframework_bundling_static_fmwks.h' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAICT adding macos changes the transitions to add arm64e, maybe this is related to #2419 as well since that's a split deps issue as well.

@luispadron luispadron force-pushed the luis/add-support-for-macos-xcframeworks branch from a330f7f to 113bdd4 Compare June 10, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XCFramework for macOS
1 participant