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

Allow dependency resolution with multiple incompatible major versions #80258

Open
tachyonics opened this issue Mar 25, 2025 · 0 comments
Open
Labels
feature A feature request or implementation triage needed This issue needs more specific labels

Comments

@tachyonics
Copy link

Motivation

The immediate motivation for this change is to enable greater flexibility for Swift Macros. Currently a library that uses Swift Macros depends on a Swift-version-specific major version of swift-syntax. This results in library combinations that are impossible to use together even though they would be compatible with each other at a public API level (that is they are not exposing types from any conflicting major versions, particularly in this case as swift-syntax is effectively a build dependency).

Although Swift Macros are the immediate motivation for such a feature, as the Swift ecosystem evolves and the number of major versions for libraries increases, the likelihood of library and application developers running into artificial limitations caused by the single-major-version-per-dependency-graph rule also increases.

There is prior-art in this space. The Rust language cargo’s resolver will attempt to unify the version of dependencies where possible but allow for conflicting private dependencies.

https://doc.rust-lang.org/cargo/reference/resolver.html

Introducing the concept of public and private dependencies is also a mechanism that could be used to introduce this feature is a understandable way

https://rust-lang.github.io/rfcs/3516-public-private-dependencies.html#dependency-visibility-and-the-resolver-1

"Cargo will specifically reject graphs that contain two different versions of the same crate being publicly depended upon and reachable from each other."

Proposed solution

No firm proposed solution but I (as part of the Swift Server Work Group) will raise it in the forum to get feedback on possible approaches.

Alternatives considered

No response

Additional information

No response

@tachyonics tachyonics added feature A feature request or implementation triage needed This issue needs more specific labels labels Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request or implementation triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant