-
Notifications
You must be signed in to change notification settings - Fork 303
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
Build fails if BUILD_LIBRARY_FOR_DISTRIBUTION is set to YES #94
Comments
This package isn't targeting the BUILD_LIBRARY_FOR_DISTRIBUTION dialect of Swift, so this isn't a supported configuration. In particular:
That said, the errors above reveal some (trivial) inconsistencies that are pretty easy to fix by sprinkling some Note: because the package isn't ABI-stable, |
@lorentey Doesn't this suggest that it would be best to deliberately throw something in the project to prevent compiling with |
@xwu Well, we could add a canary struct that intentionally emits an error in this specific configuration, but it feels a bit rude -- I don't actually see any major reason we would want to actively fight against such configurations. The ABI stable dialect isn't that different from regular Swift, as long as one doesn't care about ABI breaks or minor performance differences. /* non-frozen */ public struct _ResiliencyTrap {
@inlinable init() {}
} Developers working on large apps sometimes like to set up binary artifact caches to speed up builds. By and large I think it's fair to assume they know what they're doing. Personally, I would prefer to make this (quite tricky) process easier -- throwing obstacles in their way seems like a very unproductive use of our collective time. (Although I can't promise that we won't break things accidentally, like we did in 0.0.6.) Ideally such caching would be done with the full cooperation of the package manager, but IIUC sadly that isn't entirely possible yet. So I expect such folks vendor their package dependencies and replace SPM with xcodebuild (or whatever) to produce xcframeworks or whatnot -- which is fine as long as they do not violate the licensing terms, and as long as this doesn't generate an unreasonable maintenance burden upstream. In these setups, upgrading to a new upstream release usually requires some manual labor that hopefully includes triggering a rebuild of all dependents, and preventing old builds from linking with the new version. @danyf90 are you able to tell us a little about your setup? Is this a reasonable description of it? |
Yep, tuist can replace SPM dependencies with xcframework binaries built using xcodebuild. Luckily, looks like we have been able to do that without enabling library evolution, by using the That said, it might be useful to someone else to be able to build with library evolution enabled, so if it's an easy change it might be worth to consider it |
Supporting BUILD_LIBRARY_FOR_DISTRIBUTION would require the package to be ABI stable. This is wouldn't be reasonable at this point -- the whole point of developing these data structures in package form is to prevent us from having to freeze the ABI until we are confident we won't want to change implementation details. (Otherwise we could just propose adding them for the stdlib right now.) |
Thanks for your detailed answers! 🙏 |
Hello,
At Tuist we cache project's frameworks via xcframeworks and thus we add
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
to xcodebuild command when building. This has worked fine but it's a problem when a project depends onswift-collections
as build fails if we specify theBUILD_LIBRARY_FOR_DISTRIBUTION
setting.How hard would it be to make compilation work also with this flag?
Information
Checklist
main
branch of this package.Steps to Reproduce
Run
swift build -Xswiftc -enable-library-evolution
Expected behavior
Build should work fine
Actual behavior
Build fails with error:
The text was updated successfully, but these errors were encountered: