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

Switch static xcframework rule to produce framework #1488

Merged

Conversation

keith
Copy link
Member

@keith keith commented May 28, 2022

Previously the apple_static_xcframework rule produced a xcframework that
wrapped a static library. This change makes it produce a static
framework instead. A static framework has the benefit that headers are
easier to deal with in 2 ways (at least when including with bazel):

  1. You don't need to set any includes on the import, reducing -I
    flags up the tree (since they're covered by the -F instead
  2. Module style imports #import <foo/foo.h> are supported without any
    other infra, with libraries only quoted imports work without
    headermaps or another solution

The reason this wasn't done originally is that Xcode doesn't support
copying resources in static xcframeworks. While this is the same with
libraries and frameworks, the difference is users might expect resources
nested in framework bundles to be copied, but they will not be, and
users may expect that in the static library case, since libraries don't
ever manage resource inclusion. It sounds like CocoaPods handles this
transparently, but Xcode does not FB10026748.

Previously the apple_static_xcframework rule produced a xcframework that
wrapped a static library. This change makes it produce a static
framework instead. A static framework has the benefit that headers are
easier to deal with in 2 ways (at least when including with bazel):

1. You don't need to set any `includes` on the import, reducing `-I`
   flags up the tree (since they're covered by the `-F` instead
2. Module style imports `#import <foo/foo.h>` are supported without any
   other infra, with libraries only quoted imports work without
   headermaps or another solution

The reason this wasn't done originally is that Xcode doesn't support
copying resources in static xcframeworks. While this is the same with
libraries and frameworks, the difference is users might expect resources
nested in framework bundles to be copied, but they will not be, and
users may expect that in the static library case, since libraries don't
ever manage resource inclusion. It sounds like CocoaPods handles this
transparently, but Xcode does not FB10026748.
@keith
Copy link
Member Author

keith commented May 28, 2022

not sure if we should do this or not, at Lyft some of our libraries require this or another solution to imports which we've never had to do before since we don't have much objc, maybe other folks wouldn't be phased by that.

@lyft-lint-bot
Copy link

Lyft integration job started: https://buildkite.com/lyft/rules-apple/builds/632 (must be Lyft employee to view)

@keith keith marked this pull request as ready for review June 7, 2022 21:02
@keith keith merged commit ac43c1e into master Jun 7, 2022
@keith keith deleted the ks/switch-static-xcframework-rule-to-produce-framework branch June 7, 2022 21:02
jpsim added a commit to envoyproxy/envoy-mobile that referenced this pull request Jun 8, 2022
To pull in bazelbuild/rules_apple#1488, which
should fix our CocoaPods integration and allow us to re-add it.

Signed-off-by: JP Simard <jp@jpsim.com>
jpsim added a commit to envoyproxy/envoy-mobile that referenced this pull request Jun 8, 2022
To pull in bazelbuild/rules_apple#1488, which should fix our CocoaPods integration and allow us to re-add it.

Risk Level: Medium for iOS users who use the xcframework, low for everyone else
Testing: There's a recent CI job that validates SwiftPM integration that acts as a good integration test for this
Docs Changes: None for now, this isn't really a user-facing change, as Xcode/SwiftPM handles both the old and new xcframework format/layout transparently
Release Notes: None for now, this isn't really a user-facing change

Signed-off-by: JP Simard <jp@jpsim.com>
Augustyniak pushed a commit to envoyproxy/envoy-mobile that referenced this pull request Jun 28, 2022
To pull in bazelbuild/rules_apple#1488, which should fix our CocoaPods integration and allow us to re-add it.

Risk Level: Medium for iOS users who use the xcframework, low for everyone else
Testing: There's a recent CI job that validates SwiftPM integration that acts as a good integration test for this
Docs Changes: None for now, this isn't really a user-facing change, as Xcode/SwiftPM handles both the old and new xcframework format/layout transparently
Release Notes: None for now, this isn't really a user-facing change

Signed-off-by: JP Simard <jp@jpsim.com>
Signed-off-by: Rafal Augustyniak <raugustyniak@lyft.com>
jpsim added a commit to envoyproxy/envoy that referenced this pull request Nov 29, 2022
To pull in bazelbuild/rules_apple#1488, which should fix our CocoaPods integration and allow us to re-add it.

Risk Level: Medium for iOS users who use the xcframework, low for everyone else
Testing: There's a recent CI job that validates SwiftPM integration that acts as a good integration test for this
Docs Changes: None for now, this isn't really a user-facing change, as Xcode/SwiftPM handles both the old and new xcframework format/layout transparently
Release Notes: None for now, this isn't really a user-facing change

Signed-off-by: JP Simard <jp@jpsim.com>
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.

None yet

3 participants