-
Notifications
You must be signed in to change notification settings - Fork 139
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 a Boolean library_evolution
attribute to swift_library
#1335
Add a Boolean library_evolution
attribute to swift_library
#1335
Conversation
Historically, library evolution has been supported by a global flag that Apple framework rules transition on in order to build all dependencies with library evolution enabled. In retrospect, this is wrong; we shouldn't be automatically applying library evolution to the whole subgraph in this way. Instead, the owner of the framework should explicitly specify library evolution on the client-facing modules that make up their SDK. The goal here is to ensure that framework owners carefully audit their public `deps` vs. implementation-only `private_deps` so that the `.swiftinterface` doesn't attempt to import anything that it shouldn't, especially with Swift 5.7 validating emitted interfaces after compilation by default. This change only adds the new attribute; the flag is still honored while we have clients and rules_apple depending on it. PiperOrigin-RevId: 486750877
8c518e3
to
0843af3
Compare
Historically, library evolution has been supported by a global flag that Apple framework rules transition on in order to build all dependencies with library evolution enabled. In retrospect, this is wrong; we shouldn't be automatically applying library evolution to the whole subgraph in this way. Instead, the owner of the framework should explicitly specify library evolution on the client-facing modules that make up their SDK. The goal here is to ensure that framework owners carefully audit their public `deps` vs. implementation-only `private_deps` so that the `.swiftinterface` doesn't attempt to import anything that it shouldn't, especially with Swift 5.7 validating emitted interfaces after compilation by default. This change only adds the new attribute; the flag is still honored while we have clients and rules_apple depending on it. PiperOrigin-RevId: 486750877 (cherry picked from commit b9175e6) Cherry-pick notes: With this change the private swiftinterface is enabled by `ctx.attr.library_evolution` as well. It can be disabled with `features = ["-swift.emit_private_swiftinterface”]`. Signed-off-by: Brentley Jones <github@brentleyjones.com>
0843af3
to
7e14958
Compare
Hi, I've recently started using Bazel to automate the generation of Now finding this PR from only 4 days ago, it that explains my issue! From your PR description, it seems that library evolution is enabled by default in the current version Thank you for your help! |
@tumata this commit hasn't made it into a release yet. You can enable it via |
Thanks for your help @luispadron. Where do I add this feature you're mentioning? Should I add it to my
Please forgive my ignorance, I'm very fresh with Bazel :) |
Yes, it's a flag, you can read more on it: https://bazel.build/reference/command-line-reference#flag--features You can also add it to a |
Historically, library evolution has been supported by a global flag that Apple framework rules transition on in order to build all dependencies with library evolution enabled. In retrospect, this is wrong; we shouldn't be automatically applying library evolution to the whole subgraph in this way. Instead, the owner of the framework should explicitly specify library evolution on the client-facing modules that make up their SDK.
The goal here is to ensure that framework owners carefully audit their public
deps
vs. implementation-onlyprivate_deps
so that the.swiftinterface
doesn't attempt to import anything that it shouldn't, especially with Swift 5.7 validating emitted interfaces after compilation by default.This change only adds the new attribute; the flag is still honored while we have clients and rules_apple depending on it.
PiperOrigin-RevId: 486750877
(cherry picked from commit b9175e6)
Cherry-pick notes: With this change the private swiftinterface is enabled by
ctx.attr.library_evolution
as well. It can be disabled withfeatures = ["-swift.emit_private_swiftinterface”]
.