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

[SR-14588] SwiftPM does not validate minimum deployment targets for all platforms when developing libraries #4427

Open
Lukasa opened this issue May 4, 2021 · 1 comment
Labels

Comments

@Lukasa
Copy link
Contributor

Lukasa commented May 4, 2021

Previous ID SR-14588
Radar rdar://problem/77497775
Original Reporter @Lukasa
Type Bug
Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 60ae44531c0a6c377e7e6fd5afdf6726

Issue Description:

Vapor's PostgresNIO currently expresses the following platforms stanza:

    platforms: [
       .macOS(.v10_15)
    ],

However, PostgresNIO also depends on Swift Crypto, which expresses the following platforms stanza:

    platforms: [
        .macOS(.v10_15),
        .iOS(.v13),
        .watchOS(.v6),
        .tvOS(.v13),
    ],

SwiftPM's documentation says the following about this platforms stanza, with two sections highlighted:

By default, the Swift Package Manager assigns a predefined minimum deployment version for each supported platforms unless you configure supported platforms using the platforms API. This predefined deployment version is the oldest deployment target version that the installed SDK supports for a given platform.

The Swift Package Manager will emit an error if a dependency is not compatible with the top-level package's deployment version. The deployment target of a package's dependencies must be lower than or equal to the top-level package's deployment target version for a particular platform.

What SwiftPM is apparently not saying is that it will only perform this check for the specific platform being built at any given time. This means that SwiftPM does not notice that the platforms stanzas are incompatible until you actually try to build for the given platform.

I think this is invalid behaviour for SwiftPM, at least when developing a library (that is, if you type swift build or swift test in a library package). It would be extremely useful for it to inform developers that they have invalid package constraints.

Note that this needs to be filtered through the lens of also needing to fix https://bugs.swift.org/browse/SR-11489.

@Lukasa
Copy link
Contributor Author

Lukasa commented May 4, 2021

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants