-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Adjust SwiftPM 5.7 to minimum supported deployment target changes #5598
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
Conversation
@swift-ci please smoke test |
Not 100% sure I caught all the tests that need updating since I am still seeing the |
|
Probably an issue with TSC explicitly declaring a 10.10 deployment target: https://github.com/apple/swift-tools-support-core/blob/main/Package.swift#L21 |
swiftlang/swift-tools-support-core#329 |
I wonder whether that means that we have to do something where the raised minimum is for tools-version 5.7 only or we have to adjust these checks to not enforce the minimum? Otherwise I can see a scenario where an existing package declares e.g. macOS 10.12 as its deployment target and depends on a package that doesn't declare one. With the raised deployment target, the dependency will implicitly have a 10.13 minimum deployment target, so the check will fail and prevent building at all where otherwise there may have been a build time warning, but XCBuild would implicitly raise both to 10.13 anyway. |
Right, it sounds as if the comparison should be on the adjusted minimum deployment target. I guess that could make the error confusing if the package claims one thing but then the error is about a higher version. |
A few tests are hitting exactly this situation:
|
35f8ae0
to
88f7808
Compare
@swift-ci please smoke test |
…arget changes) Update minimum supported deployment targets and mark older version constants as deprecated in tools-version 5.7. If a package specifies a custom deployment target older than the minimum, the derived one in the model will be automatically raised, similar to how it was alreaady being done for test targets.
88f7808
to
3f0eb8d
Compare
@swift-ci please smoke test |
Updated change looks reasonable to me and is about all that can be done if the toolchain doesn't support the older minimum deployment target (short of just refusing to build the package, which I think would be unfriendly and probably not what people usually want). SwiftPM could emit a warning but then there wouldn't be a way to get rid of it short of forking the package and adding annotations, so maybe that's not a good idea either. |
Updated now to automatically raise the derived deployment target to the minimum. We could consider emitting a warning if the specified deployment target is lower than the minimum, but I am not sure if that would be annoying in practice. If a package is using the 5.7 tools-version, using an older deployment target will already show a deprecation warning after these changes, so a secondary warning seems redundant. If a package is using an older tools-version, it might be desired to support older deployment targets if older tools are used, so the author would end up with an unfixable warning in 5.7. The only case that actually seems interesting is executables, because the author may want to legitimately deploy to older versions of macOS and may have missed that those are not supported anymore, so the warning could be useful. |
Some good points there about a warning — I think that there are a lot of subtle traps with adding a warning, and we can hold off and see if one should be added later. |
I work on a project that uses a new version of SPM but needs to deploy back to older platforms. I understand that this is no longer officially supported but in practice everything "works"…except for this check, which forces the deployment target up. I'd be interested in seeing if we could turn off this behavior on an opt-in basis. Happy to eat a warning too if need be. What I was thinking was I could specify a target with all my dependencies in it, and explicitly specify a string version (e.g. |
Update minimum supported deployment targets and mark older version constants as deprecated in tools-version 5.7.
If a package specifies a custom deployment target older than the minimum, the derived one in the model will be automatically raised, similar to how it was alreaady being done for test targets.
rdar://93920177
Motivation:
Xcode 14.0 is raising the minimum supported deployment target versions for most platforms.