Skip to content

Commit faf7329

Browse files
committed
Only ignore dev-dependencies in dependency order if they have no version
1 parent 54448a1 commit faf7329

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/cargo/ops/cargo_package/mod.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,14 @@ fn local_deps<T>(packages: impl Iterator<Item = (Package, T)>) -> LocalDependenc
406406
for (pkg, _payload) in packages.values() {
407407
graph.add(pkg.package_id());
408408
for dep in pkg.dependencies() {
409-
// Ignore local dev-dependencies because they aren't needed for intra-workspace
410-
// lockfile generation or verification as they get stripped on publish.
411-
if dep.kind() == DepKind::Development || !dep.source_id().is_path() {
409+
// We're only interested in local (i.e. living in this workspace) dependencies.
410+
if !dep.source_id().is_path() {
411+
continue;
412+
}
413+
414+
// If local dev-dependencies don't have a version specified, they get stripped
415+
// on publish so we should ignore them.
416+
if dep.kind() == DepKind::Development && !dep.specified_req() {
412417
continue;
413418
};
414419

tests/testsuite/package.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5865,15 +5865,15 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
58655865
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
58665866
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
58675867
[UPDATING] crates.io index
5868-
[ERROR] failed to prepare local package for uploading
5869-
5870-
Caused by:
5871-
no matching package named `dev_dep` found
5872-
location searched: crates.io index
5873-
required by package `main v0.0.1 ([ROOT]/foo/main)`
5868+
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
5869+
[VERIFYING] dev_dep v0.0.1 ([ROOT]/foo/dev_dep)
5870+
[COMPILING] dev_dep v0.0.1 ([ROOT]/foo/target/package/dev_dep-0.0.1)
5871+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
5872+
[VERIFYING] main v0.0.1 ([ROOT]/foo/main)
5873+
[COMPILING] main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)
5874+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
58745875
58755876
"#]])
5876-
.with_status(101)
58775877
.run();
58785878
}
58795879

0 commit comments

Comments
 (0)