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-11489] Swift Package Manager is not consistent on whether constraints affect package resolution #4664

Open
Lukasa opened this issue Sep 19, 2019 · 1 comment
Labels

Comments

@Lukasa
Copy link
Contributor

Lukasa commented Sep 19, 2019

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

md5: 42fc37ca0a84cbae51249c02cdd89102

Issue Description:

Swift Package manifests contain three things that may be thought of as "constraints" on package compatibility:

1. Package version number
2. Swift tools version
3. Minimum deployment targets

These are "constraints" in the sense that mismatches of these things in a dependency chain may lead to an inability to build.

Example

Consider an ecosystem with a leaf package L and a dependency D.

If package L has a dependency on D that is expressed as upToNextMinor("1.1.0"), the package manager will exclude version 1.2.0 from the space of valid resolutions for the version of D.

If package L uses Swift tools version 5.0, and dependency D uses tools version 5.0 in version 1.1.0 and 1.1.1 and tools version 5.1 only in version 1.1.2, the package manager will exclude version 1.1.2 from the space of valid resolutions for the version of D.

However, if package L expresses a minimum macOS deployment target of 10.12, and package D expresses a minimum deployment target of 10.12 in 1.1.0 and increases that to 10.13 in 1.1.1 (and on), the package manager does not exclude version 1.1.1 from the space of valid resolutions for D. Instead, it will resolve 1.1.1 (with the above constraints), and then fail the build.

Explanation

This is a very inconsistent behaviour. The observed behaviour is that the package manager appears to consider the tools target of the leaf package as an implicit constraint on the space of allowed dependency versions. Each dependency version will be checked to see whether it has a manifest suitable for the appropriate tools version, and if it isn't it will be excluded.

This can be observed with the attached Swift project: blowing away the .build directory and building with swift 5.0 checks out 1.0.2 of the dependency project. Building with Swift 5.1 checks out 1.0.3. This does not happen if you change the tools version mismatch into a minimum deployment target mismatch.

We should attempt to make this consistent. My view would be that the only signal to dependency resolution should be version number, but I suspect people may argue for the alternative.

@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