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

Do not mask workspace dependencies with a source attribute #247

Merged

Conversation

elliotkennedy
Copy link
Contributor

@elliotkennedy elliotkennedy commented Sep 28, 2023

Workspace dependencies with a source attribute are likely to be transitive and not sourced from the workspace.

Issue #, if available:

None raised.

Description of changes:

Similar to #224.

Given a workspace project:

.
├── project_a
│   └── Cargo.toml
├── project_b
│   └── Cargo.toml
├── Cargo.lock
├── Cargo.toml

project_a/Cargo.toml:

[package]
name = "project_a"
version = "2.2.2"

[dependencies]
either = { version = "=1.8.1" }

project_b/Cargo.toml:

[package]
name = "project_b"
version = "3.3.3"

[dependencies]
# none

The external project, either, depends on a crates.io-published version of project_b.

Therefore project_b is a transitive dependency of project_a, however the transitive project_b is different from the workspace version.

Currently crates.io:project_b is incorrectly masked to version 0.0.1 in Cargo.lock.

This PR identifies transitive dependencies by not masking dependencies with a source attribute. I think this is sensible and cannot think of a scenario where a workspace package would have a source attribute.

[[package]]
name = "either"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
dependencies = [
 "project_b 3.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "project_a"
version = "0.0.1"
dependencies = [
 "either",
]

[[package]]
name = "project_b"
version = "0.0.1"

[[package]]
name = "project_b"
version = "3.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

… transitive and not sourced from the workspace
@elliotkennedy elliotkennedy force-pushed the transitive-workspace-deps branch from 82326c9 to 635646b Compare September 29, 2023 16:25
@LukeMathWalker
Copy link
Owner

Thank you!

@LukeMathWalker LukeMathWalker merged commit 131c052 into LukeMathWalker:main Feb 27, 2024
4 checks passed
@elliotkennedy elliotkennedy deleted the transitive-workspace-deps branch March 2, 2024 19:14
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.

2 participants