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

Add macOS version to Package.swift for newly generated packages #5962

Conversation

keith
Copy link
Member

@keith keith commented Dec 8, 2022

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.

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.
@keith
Copy link
Member Author

keith commented Dec 8, 2022

@swift-ci please test

@keith
Copy link
Member Author

keith commented Dec 8, 2022

@tomerd
Copy link
Contributor

tomerd commented Dec 21, 2022

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")
Copy link
Contributor

@tomerd tomerd Dec 21, 2022

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

Copy link
Member Author

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)
Copy link
Contributor

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

Copy link
Member Author

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

@keith keith closed this Jul 18, 2023
@keith keith deleted the ks/add-macos-version-to-package.swift-for-newly-generated-packages branch July 18, 2023 00:07
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