Support multiple artifact dependency aliases to the same package#17067
Open
npmccallum wants to merge 2 commits into
Open
Support multiple artifact dependency aliases to the same package#17067npmccallum wants to merge 2 commits into
npmccallum wants to merge 2 commits into
Conversation
Add regression coverage for the current invariant that multiple dependency declarations to the same package are rejected when they would require distinct dependency names. This makes the existing behavior explicit before relaxing the artifact-dependency cases tracked in rust-lang#12374.
Implement the RFC 3176 model for resolving rust-lang#12374. A package can now be declared multiple times under different dependency names, with each alias selecting its own artifact target. This keeps artifact environment variables scalar and dependency-name-specific, instead of adding target-list syntax or list-valued environment variables. Build graph lowering and cargo metadata share one lib-edge naming helper. All-artifact aliases keep their concrete names, while mixed artifact/non-artifact edges continue to use the existing duplicate-name check. The tests cover build dependencies, normal dependencies, same-target sharing, cargo metadata, unit graph output, and the explicit-alias workflow documented for bindeps. Closes rust-lang#12374.
Collaborator
|
r? @weihanglo rustbot has assigned @weihanglo. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fills in a behavior described by RFC 3176 that was not implemented when
artifact dependencies were initially added.
The RFC allows a package to be declared multiple times under different
dependency names, with each declaration selecting a different artifact target.
Today, Cargo still rejects several of those same-package artifact dependency
forms as duplicate renamed dependencies. This PR closes that gap while keeping
the existing duplicate-name checks for non-artifact dependency cases.
The branch is split into two commits to make the behavior change easier to
review:
test(bindeps): cover same-package duplicate-name behaviorThis commit adds regression tests for the current invariants and does not
change Cargo behavior. In particular, it locks down the cases where ordinary
duplicate renamed dependencies, or mixed artifact/non-artifact dependencies,
must continue to be rejected.
feat(bindeps): support artifact aliases to the same packageThis commit implements the RFC behavior for all-artifact dependency aliases
to the same package, and updates the affected tests to assert the new
intended behavior. It keeps artifact environment variables scalar and
dependency-name-specific, and shares the lib-edge naming logic between build
graph lowering and
cargo metadataso the two paths stay consistent.Validation performed locally on both commits:
cargo fmt --checkcargo test -p cargo --libcargo test -p cargo --test testsuiteCloses #12374
FYI @joshtriplett @Byron