Skip to content

Commit

Permalink
fix(rust): Don't update dev-dependencies lacking a version key (#1095) (
Browse files Browse the repository at this point in the history
#1152)

Cherry pick #1095 into v13 and resolve conflicts

Fixes #1094
  • Loading branch information
chingor13 authored Dec 21, 2021
1 parent ae007fe commit 56f37d9
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions __snapshots__/cargo-toml.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ normal-dep = "1.2.3"
[dev-dependencies]
dev-dep = { version = "1.2.3" }
dev-dep-2 = { path = "../dev-dep-2" }
[build-dependencies]
# this is using a private registry
Expand Down Expand Up @@ -44,6 +45,7 @@ normal-dep = "1.2.3"
[dev-dependencies]
dev-dep = { version = "1.2.3" }
dev-dep-2 = { path = "../dev-dep-2" }
[build-dependencies]
# this is using a private registry
Expand Down
7 changes: 6 additions & 1 deletion src/updaters/rust/cargo-toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ export class CargoToml extends DefaultUpdater {
const dep = deps[pkgName];

if (typeof dep === 'string' || typeof dep.path === 'undefined') {
logger.info(`skipping ${depKind}.${pkgName} in`);
logger.info(`skipping ${depKind}.${pkgName} (no path set)`);
continue; // to next depKind
}

if (typeof dep.version === 'undefined') {
logger.info(`skipping ${depKind}.${pkgName} (no version set)`);
continue; // to next depKind
}

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/strategies/rust/Cargo-crate2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name = "crate2"
version = "0.4.321"

[dependencies]
crate1 = { version = "0.123.4", path = "../crate2" }
crate1 = { version = "0.123.4", path = "../crate1" }

2 changes: 1 addition & 1 deletion test/fixtures/strategies/rust/Cargo-workspace.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = [
"crates/crate1",
"crates/crate2",
"crates/crate2"
]

1 change: 1 addition & 0 deletions test/updaters/cargo-toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe('CargoToml', () => {
const versions = new Map();
versions.set('normal-dep', '2.0.0');
versions.set('dev-dep', '2.0.0');
versions.set('dev-dep-2', '2.0.0');
versions.set('build-dep', '2.0.0');
versions.set('windows-dep', '2.0.0');
versions.set('unix-dep', '2.0.0');
Expand Down
2 changes: 1 addition & 1 deletion test/updaters/fixtures/Cargo-workspace.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
members = [
"crates/crate1",
"crates/crate2",
"crates/crate2"
]


1 change: 1 addition & 0 deletions test/updaters/fixtures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ normal-dep = "1.2.3"

[dev-dependencies]
dev-dep = { version = "1.2.3" }
dev-dep-2 = { path = "../dev-dep-2" }

[build-dependencies]
# this is using a private registry
Expand Down

0 comments on commit 56f37d9

Please sign in to comment.