-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #11242 - cassaundra:remove-workspace, r=epage
Clean up workspace dependencies after cargo remove ### What does this PR try to resolve? After successful removal of an inherited dependency from a workspace member, clean up the root workspace manifest. This PR is part of the continued working on cargo remove (#11099, see deferred work). ### How should we test and review this PR? Make sure the tests cover all possible use cases. After posting this PR, I will post a short self-review regarding some design concerns. ### Additional information #11194 is currently blocked on this feature.
- Loading branch information
Showing
34 changed files
with
361 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[workspace] | ||
members = [ "my-package" ] | ||
|
||
[workspace.dependencies] | ||
semver = "0.1.0" |
24 changes: 24 additions & 0 deletions
24
tests/testsuite/cargo_remove/workspace/in/my-package/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "my-package" | ||
version = "0.1.0" | ||
|
||
[[bin]] | ||
name = "main" | ||
path = "src/main.rs" | ||
|
||
[build-dependencies] | ||
semver = { workspace = true } | ||
|
||
[dependencies] | ||
docopt = "0.6" | ||
rustc-serialize = "0.4" | ||
semver = "0.1" | ||
toml = "0.1" | ||
clippy = "0.4" | ||
|
||
[dev-dependencies] | ||
regex = "0.1.1" | ||
serde = "1.0.90" | ||
|
||
[features] | ||
std = ["serde/std", "semver/std"] |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_remove/workspace/in/my-package/src/main.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use cargo_test_support::compare::assert_ui; | ||
use cargo_test_support::curr_dir; | ||
use cargo_test_support::CargoCommand; | ||
use cargo_test_support::Project; | ||
|
||
use crate::cargo_remove::init_registry; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
init_registry(); | ||
let project = Project::from_template(curr_dir!().join("in")); | ||
let project_root = project.root(); | ||
let cwd = &project_root; | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("remove") | ||
.args(["--package", "my-package", "--build", "semver"]) | ||
.current_dir(cwd) | ||
.assert() | ||
.success() | ||
.stdout_matches_path(curr_dir!().join("stdout.log")) | ||
.stderr_matches_path(curr_dir!().join("stderr.log")); | ||
|
||
assert_ui().subset_matches(curr_dir!().join("out"), &project_root); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[workspace] | ||
members = [ "my-package" ] |
21 changes: 21 additions & 0 deletions
21
tests/testsuite/cargo_remove/workspace/out/my-package/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "my-package" | ||
version = "0.1.0" | ||
|
||
[[bin]] | ||
name = "main" | ||
path = "src/main.rs" | ||
|
||
[dependencies] | ||
docopt = "0.6" | ||
rustc-serialize = "0.4" | ||
semver = "0.1" | ||
toml = "0.1" | ||
clippy = "0.4" | ||
|
||
[dev-dependencies] | ||
regex = "0.1.1" | ||
serde = "1.0.90" | ||
|
||
[features] | ||
std = ["serde/std", "semver/std"] |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_remove/workspace/out/my-package/src/main.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Removing semver from build-dependencies | ||
Updating `dummy-registry` index |
Empty file.
30 changes: 30 additions & 0 deletions
30
tests/testsuite/cargo_remove/workspace_non_virtual/in/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[workspace] | ||
members = [ "my-member" ] | ||
|
||
[workspace.dependencies] | ||
semver = "0.1.0" | ||
|
||
[package] | ||
name = "my-package" | ||
version = "0.1.0" | ||
|
||
[[bin]] | ||
name = "main" | ||
path = "src/main.rs" | ||
|
||
[build-dependencies] | ||
semver = { workspace = true } | ||
|
||
[dependencies] | ||
docopt = "0.6" | ||
rustc-serialize = "0.4" | ||
semver = "0.1" | ||
toml = "0.1" | ||
clippy = "0.4" | ||
|
||
[dev-dependencies] | ||
regex = "0.1.1" | ||
serde = "1.0.90" | ||
|
||
[features] | ||
std = ["serde/std", "semver/std"] |
6 changes: 6 additions & 0 deletions
6
tests/testsuite/cargo_remove/workspace_non_virtual/in/my-member/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "my-member" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use cargo_test_support::compare::assert_ui; | ||
use cargo_test_support::curr_dir; | ||
use cargo_test_support::CargoCommand; | ||
use cargo_test_support::Project; | ||
|
||
use crate::cargo_remove::init_registry; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
init_registry(); | ||
let project = Project::from_template(curr_dir!().join("in")); | ||
let project_root = project.root(); | ||
let cwd = &project_root; | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("remove") | ||
.args(["--package", "my-package", "--build", "semver"]) | ||
.current_dir(cwd) | ||
.assert() | ||
.success() | ||
.stdout_matches_path(curr_dir!().join("stdout.log")) | ||
.stderr_matches_path(curr_dir!().join("stderr.log")); | ||
|
||
assert_ui().subset_matches(curr_dir!().join("out"), &project_root); | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/testsuite/cargo_remove/workspace_non_virtual/out/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[workspace] | ||
members = [ "my-member" ] | ||
|
||
[package] | ||
name = "my-package" | ||
version = "0.1.0" | ||
|
||
[[bin]] | ||
name = "main" | ||
path = "src/main.rs" | ||
|
||
[dependencies] | ||
docopt = "0.6" | ||
rustc-serialize = "0.4" | ||
semver = "0.1" | ||
toml = "0.1" | ||
clippy = "0.4" | ||
|
||
[dev-dependencies] | ||
regex = "0.1.1" | ||
serde = "1.0.90" | ||
|
||
[features] | ||
std = ["serde/std", "semver/std"] |
6 changes: 6 additions & 0 deletions
6
tests/testsuite/cargo_remove/workspace_non_virtual/out/my-member/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "my-member" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
Empty file.
2 changes: 2 additions & 0 deletions
2
tests/testsuite/cargo_remove/workspace_non_virtual/stderr.log
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Removing semver from build-dependencies | ||
Updating `dummy-registry` index |
Empty file.
5 changes: 5 additions & 0 deletions
5
tests/testsuite/cargo_remove/workspace_preserved/in/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[workspace] | ||
members = [ "my-package", "my-other-package" ] | ||
|
||
[workspace.dependencies] | ||
semver = "0.1.0" |
22 changes: 22 additions & 0 deletions
22
tests/testsuite/cargo_remove/workspace_preserved/in/my-other-package/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "my-other-package" | ||
version = "0.1.0" | ||
|
||
[[bin]] | ||
name = "main" | ||
path = "src/main.rs" | ||
|
||
[dependencies] | ||
docopt = "0.6" | ||
rustc-serialize = "0.4" | ||
semver = "0.1" | ||
toml = "0.1" | ||
clippy = "0.4" | ||
|
||
[dev-dependencies] | ||
regex = "0.1.1" | ||
semver = { workspace = true } | ||
serde = "1.0.90" | ||
|
||
[features] | ||
std = ["serde/std", "semver/std"] |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_remove/workspace_preserved/in/my-other-package/src/main.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
24 changes: 24 additions & 0 deletions
24
tests/testsuite/cargo_remove/workspace_preserved/in/my-package/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "my-package" | ||
version = "0.1.0" | ||
|
||
[[bin]] | ||
name = "main" | ||
path = "src/main.rs" | ||
|
||
[build-dependencies] | ||
semver = { workspace = true } | ||
|
||
[dependencies] | ||
docopt = "0.6" | ||
rustc-serialize = "0.4" | ||
semver = "0.1" | ||
toml = "0.1" | ||
clippy = "0.4" | ||
|
||
[dev-dependencies] | ||
regex = "0.1.1" | ||
serde = "1.0.90" | ||
|
||
[features] | ||
std = ["serde/std", "semver/std"] |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_remove/workspace_preserved/in/my-package/src/main.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use cargo_test_support::compare::assert_ui; | ||
use cargo_test_support::curr_dir; | ||
use cargo_test_support::CargoCommand; | ||
use cargo_test_support::Project; | ||
|
||
use crate::cargo_remove::init_registry; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
init_registry(); | ||
let project = Project::from_template(curr_dir!().join("in")); | ||
let project_root = project.root(); | ||
let cwd = &project_root; | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.arg("remove") | ||
.args(["--package", "my-package", "--build", "semver"]) | ||
.current_dir(cwd) | ||
.assert() | ||
.success() | ||
.stdout_matches_path(curr_dir!().join("stdout.log")) | ||
.stderr_matches_path(curr_dir!().join("stderr.log")); | ||
|
||
assert_ui().subset_matches(curr_dir!().join("out"), &project_root); | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/testsuite/cargo_remove/workspace_preserved/out/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[workspace] | ||
members = [ "my-package", "my-other-package" ] | ||
|
||
[workspace.dependencies] | ||
semver = "0.1.0" |
22 changes: 22 additions & 0 deletions
22
tests/testsuite/cargo_remove/workspace_preserved/out/my-other-package/Cargo.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "my-other-package" | ||
version = "0.1.0" | ||
|
||
[[bin]] | ||
name = "main" | ||
path = "src/main.rs" | ||
|
||
[dependencies] | ||
docopt = "0.6" | ||
rustc-serialize = "0.4" | ||
semver = "0.1" | ||
toml = "0.1" | ||
clippy = "0.4" | ||
|
||
[dev-dependencies] | ||
regex = "0.1.1" | ||
semver = { workspace = true } | ||
serde = "1.0.90" | ||
|
||
[features] | ||
std = ["serde/std", "semver/std"] |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_remove/workspace_preserved/out/my-other-package/src/main.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Oops, something went wrong.