-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 macOS version to Package.swift for newly generated packages #5962
Add macOS version to Package.swift for newly generated packages #5962
Conversation
Previously if you created a new basic Swift package and added a dependency, such as swift-syntax, that requires a minimum version greater than macOS 10.13, you would have to set the platform version to something above that in the Package.swift. With this change newly generated packages on macOS automatically generate the current macOS version as the minimum supported version, and if the developer wants a lower version they can reduce it as usual in the Package.swift.
|
@swift-ci please test |
|
cc @bitjammer |
| func testDefaultPlatform() throws { | ||
| #if !os(macOS) | ||
| // Platform default versions are only set on macOS | ||
| try XCTSkipIf(true, "test is only supported on macOS") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really needed? while its empty now, it may be used in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now it would still be empty if you ran on linux, so i think until that part changes we'd have to skip? is there another way of writing this test that you're suggesting could avoid this?
| @@ -498,3 +499,13 @@ extension SupportedPlatform { | |||
| } | |||
| } | |||
| } | |||
|
|
|||
| private func getDefaultPlatforms() -> [SupportedPlatform] { | |||
| #if os(macOS) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this. most swift developers develop on a fairly recent Mac regardless on what the target deployment platforms are
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you commenting on the functionality in general or the #if here? if you mean the functionality in general should that be discussed on the pitch? https://forums.swift.org/t/pitch-generate-package-swift-files-with-newer-macos-versions/61925
I just don't want to dup the justifications here if that answers some of these
Previously if you created a new basic Swift package and added a dependency, such as swift-syntax, that requires a minimum version greater than macOS 10.13, you would have to set the platform version to something above that in the Package.swift. With this change newly generated packages on macOS automatically generate the current macOS version as the minimum supported version, and if the developer wants a lower version they can reduce it as usual in the Package.swift.