diff --git a/src/bin/cargo/commands/doc.rs b/src/bin/cargo/commands/doc.rs index 8405015dfbb..6e880ba9245 100644 --- a/src/bin/cargo/commands/doc.rs +++ b/src/bin/cargo/commands/doc.rs @@ -34,9 +34,10 @@ pub fn cli() -> App { By default the documentation for the local package and all dependencies is built. The output is all placed in `target/doc` in rustdoc's usual format. -All packages in the workspace are documented if the `--all` flag is supplied. The -`--all` flag is automatically assumed for a virtual manifest. -Note that `--exclude` has to be specified in conjunction with the `--all` flag. +All packages in the workspace are documented if the `--workspace` flag is +supplied. The `--workspace` flag is automatically assumed for a virtual +manifest. Note that `--exclude` has to be specified in conjunction with the +`--workspace` flag. If the `--package` argument is given, then SPEC is a package ID specification which indicates which package should be documented. If it is not given, then the diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index 56c25b040a6..16e65987d55 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -56,13 +56,13 @@ pub struct Workspace<'cfg> { // The subset of `members` that are used by the // `build`, `check`, `test`, and `bench` subcommands - // when no package is selected with `--package` / `-p` and `--all` + // when no package is selected with `--package` / `-p` and `--workspace` // is not used. // // This is set by the `default-members` config // in the `[workspace]` section. // When unset, this is the same as `members` for virtual workspaces - // (`--all` is implied) + // (`--workspace` is implied) // or only the root package for non-virtual workspaces. default_members: Vec, diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 76e885b01bc..cc49ef72204 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -106,7 +106,7 @@ impl Packages { Ok(match (all, exclude.len(), package.len()) { (false, 0, 0) => Packages::Default, (false, 0, _) => Packages::Packages(package), - (false, _, _) => failure::bail!("--exclude can only be used together with --all"), + (false, _, _) => failure::bail!("--exclude can only be used together with --workspace"), (true, 0, _) => Packages::All, (true, _, _) => Packages::OptOut(exclude), }) diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index 4a1450b3c2f..a5e42dbe438 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -31,10 +31,7 @@ pub trait AppExt: Sized { exclude: &'static str, ) -> Self { self.arg_package_spec_simple(package) - ._arg(opt( - "all", - "Will be changed to 'workspace' option (deprecated)", - )) + ._arg(opt("all", "Alias for --workspace (deprecated)")) ._arg(opt("workspace", all)) ._arg(multi_opt("exclude", "SPEC", exclude)) } diff --git a/src/doc/man/generated/cargo-bench.html b/src/doc/man/generated/cargo-bench.html index 4326901ae19..e7572f8c86d 100644 --- a/src/doc/man/generated/cargo-bench.html +++ b/src/doc/man/generated/cargo-bench.html @@ -92,6 +92,10 @@

Package Selection

Benchmark all members in the workspace.

+
--all
+
+

Deprecated alias for --workspace.

+
--exclude SPEC…​

Exclude the specified packages. Must be used in conjunction with the @@ -501,4 +505,4 @@

SEE ALSO

cargo(1), cargo-test(1)

- + \ No newline at end of file diff --git a/src/doc/man/generated/cargo-build.html b/src/doc/man/generated/cargo-build.html index 4f88c0e1449..f22b828c071 100644 --- a/src/doc/man/generated/cargo-build.html +++ b/src/doc/man/generated/cargo-build.html @@ -48,6 +48,10 @@

Package Selection

Build all members in the workspace.

+
--all
+
+

Deprecated alias for --workspace.

+
--exclude SPEC…​

Exclude the specified packages. Must be used in conjunction with the @@ -464,4 +468,4 @@

SEE ALSO

cargo(1), cargo-rustc(1)

- + \ No newline at end of file diff --git a/src/doc/man/generated/cargo-check.html b/src/doc/man/generated/cargo-check.html index 6e3722b1dad..6884205be20 100644 --- a/src/doc/man/generated/cargo-check.html +++ b/src/doc/man/generated/cargo-check.html @@ -52,6 +52,10 @@

Package Selection

Check all members in the workspace.

+
--all
+
+

Deprecated alias for --workspace.

+
--exclude SPEC…​

Exclude the specified packages. Must be used in conjunction with the @@ -455,4 +459,4 @@

SEE ALSO

cargo(1), cargo-build(1)

- + \ No newline at end of file diff --git a/src/doc/man/generated/cargo-doc.html b/src/doc/man/generated/cargo-doc.html index eb0393eafce..ecb19795ffd 100644 --- a/src/doc/man/generated/cargo-doc.html +++ b/src/doc/man/generated/cargo-doc.html @@ -68,6 +68,10 @@

Package Selection

Document all members in the workspace.

+
--all
+
+

Deprecated alias for --workspace.

+
--exclude SPEC…​

Exclude the specified packages. Must be used in conjunction with the @@ -416,4 +420,4 @@

SEE ALSO

cargo(1), cargo-rustdoc(1), rustdoc(1)

- + \ No newline at end of file diff --git a/src/doc/man/generated/cargo-fix.html b/src/doc/man/generated/cargo-fix.html index 6fd1e2c0fa1..9d1bca8823d 100644 --- a/src/doc/man/generated/cargo-fix.html +++ b/src/doc/man/generated/cargo-fix.html @@ -123,6 +123,10 @@

Package Selection

Fix all members in the workspace.

+
--all
+
+

Deprecated alias for --workspace.

+
--exclude SPEC…​

Exclude the specified packages. Must be used in conjunction with the @@ -534,4 +538,4 @@

SEE ALSO

cargo(1), cargo-check(1)

- + \ No newline at end of file diff --git a/src/doc/man/generated/cargo-test.html b/src/doc/man/generated/cargo-test.html index f4593674614..101c2433824 100644 --- a/src/doc/man/generated/cargo-test.html +++ b/src/doc/man/generated/cargo-test.html @@ -98,6 +98,10 @@

Package Selection

Test all members in the workspace.

+
--all
+
+

Deprecated alias for --workspace.

+
--exclude SPEC…​

Exclude the specified packages. Must be used in conjunction with the @@ -563,4 +567,4 @@

SEE ALSO

cargo(1), cargo-bench(1)

- + \ No newline at end of file diff --git a/src/doc/man/options-packages.adoc b/src/doc/man/options-packages.adoc index cf287fd5e93..19e11be557f 100644 --- a/src/doc/man/options-packages.adoc +++ b/src/doc/man/options-packages.adoc @@ -17,6 +17,9 @@ virtual workspace will include all workspace members (equivalent to passing *--workspace*:: {actionverb} all members in the workspace. +*--all*:: + Deprecated alias for `--workspace`. + *--exclude* _SPEC_...:: Exclude the specified packages. Must be used in conjunction with the `--workspace` flag. This flag may be specified multiple times. diff --git a/src/etc/cargo.bashcomp.sh b/src/etc/cargo.bashcomp.sh index 793c5c0f21e..bd04dfc22a8 100644 --- a/src/etc/cargo.bashcomp.sh +++ b/src/etc/cargo.bashcomp.sh @@ -37,7 +37,7 @@ _cargo() local opt_quiet='-q --quiet' local opt_color='--color' local opt_common="$opt_help $opt_verbose $opt_quiet $opt_color" - local opt_pkg_spec='-p --package --all --exclude' + local opt_pkg_spec='-p --package --all --exclude --workspace' local opt_pkg='-p --package' local opt_feat='--features --all-features --no-default-features' local opt_mani='--manifest-path' diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1 index 2d8d7541172..0d890c679ed 100644 --- a/src/etc/man/cargo-bench.1 +++ b/src/etc/man/cargo-bench.1 @@ -85,7 +85,7 @@ by the manifest will be selected. The default members of a workspace can be set explicitly with the \fBworkspace.default\-members\fP key in the root manifest. If this is not set, a virtual workspace will include all workspace members (equivalent to passing -\fB\-\-all\fP), and a non\-virtual workspace will include only the root crate itself. +\fB\-\-workspace\fP), and a non\-virtual workspace will include only the root crate itself. .sp \fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP... .RS 4 @@ -93,15 +93,20 @@ Benchmark only the specified packages. See \fBcargo\-pkgid\fP(1) for the SPEC format. This flag may be specified multiple times. .RE .sp -\fB\-\-all\fP +\fB\-\-workspace\fP .RS 4 Benchmark all members in the workspace. .RE .sp +\fB\-\-all\fP +.RS 4 +Deprecated alias for \fB\-\-workspace\fP. +.RE +.sp \fB\-\-exclude\fP \fISPEC\fP... .RS 4 Exclude the specified packages. Must be used in conjunction with the -\fB\-\-all\fP flag. This flag may be specified multiple times. +\fB\-\-workspace\fP flag. This flag may be specified multiple times. .RE .SS "Target Selection" .sp diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1 index 7ccbc561256..bbf14f906be 100644 --- a/src/etc/man/cargo-build.1 +++ b/src/etc/man/cargo-build.1 @@ -47,7 +47,7 @@ by the manifest will be selected. The default members of a workspace can be set explicitly with the \fBworkspace.default\-members\fP key in the root manifest. If this is not set, a virtual workspace will include all workspace members (equivalent to passing -\fB\-\-all\fP), and a non\-virtual workspace will include only the root crate itself. +\fB\-\-workspace\fP), and a non\-virtual workspace will include only the root crate itself. .sp \fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP... .RS 4 @@ -55,15 +55,20 @@ Build only the specified packages. See \fBcargo\-pkgid\fP(1) for the SPEC format. This flag may be specified multiple times. .RE .sp -\fB\-\-all\fP +\fB\-\-workspace\fP .RS 4 Build all members in the workspace. .RE .sp +\fB\-\-all\fP +.RS 4 +Deprecated alias for \fB\-\-workspace\fP. +.RE +.sp \fB\-\-exclude\fP \fISPEC\fP... .RS 4 Exclude the specified packages. Must be used in conjunction with the -\fB\-\-all\fP flag. This flag may be specified multiple times. +\fB\-\-workspace\fP flag. This flag may be specified multiple times. .RE .SS "Target Selection" .sp diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1 index 149c1382ef1..0924bc0b7d1 100644 --- a/src/etc/man/cargo-check.1 +++ b/src/etc/man/cargo-check.1 @@ -51,7 +51,7 @@ by the manifest will be selected. The default members of a workspace can be set explicitly with the \fBworkspace.default\-members\fP key in the root manifest. If this is not set, a virtual workspace will include all workspace members (equivalent to passing -\fB\-\-all\fP), and a non\-virtual workspace will include only the root crate itself. +\fB\-\-workspace\fP), and a non\-virtual workspace will include only the root crate itself. .sp \fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP... .RS 4 @@ -59,15 +59,20 @@ Check only the specified packages. See \fBcargo\-pkgid\fP(1) for the SPEC format. This flag may be specified multiple times. .RE .sp -\fB\-\-all\fP +\fB\-\-workspace\fP .RS 4 Check all members in the workspace. .RE .sp +\fB\-\-all\fP +.RS 4 +Deprecated alias for \fB\-\-workspace\fP. +.RE +.sp \fB\-\-exclude\fP \fISPEC\fP... .RS 4 Exclude the specified packages. Must be used in conjunction with the -\fB\-\-all\fP flag. This flag may be specified multiple times. +\fB\-\-workspace\fP flag. This flag may be specified multiple times. .RE .SS "Target Selection" .sp diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1 index d8d6b2fb9af..a6c83ac5909 100644 --- a/src/etc/man/cargo-doc.1 +++ b/src/etc/man/cargo-doc.1 @@ -64,7 +64,7 @@ by the manifest will be selected. The default members of a workspace can be set explicitly with the \fBworkspace.default\-members\fP key in the root manifest. If this is not set, a virtual workspace will include all workspace members (equivalent to passing -\fB\-\-all\fP), and a non\-virtual workspace will include only the root crate itself. +\fB\-\-workspace\fP), and a non\-virtual workspace will include only the root crate itself. .sp \fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP... .RS 4 @@ -72,15 +72,20 @@ Document only the specified packages. See \fBcargo\-pkgid\fP(1) for the SPEC format. This flag may be specified multiple times. .RE .sp -\fB\-\-all\fP +\fB\-\-workspace\fP .RS 4 Document all members in the workspace. .RE .sp +\fB\-\-all\fP +.RS 4 +Deprecated alias for \fB\-\-workspace\fP. +.RE +.sp \fB\-\-exclude\fP \fISPEC\fP... .RS 4 Exclude the specified packages. Must be used in conjunction with the -\fB\-\-all\fP flag. This flag may be specified multiple times. +\fB\-\-workspace\fP flag. This flag may be specified multiple times. .RE .SS "Target Selection" .sp diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1 index 0cfb9d555d9..e917e6a5bcc 100644 --- a/src/etc/man/cargo-fix.1 +++ b/src/etc/man/cargo-fix.1 @@ -121,7 +121,7 @@ by the manifest will be selected. The default members of a workspace can be set explicitly with the \fBworkspace.default\-members\fP key in the root manifest. If this is not set, a virtual workspace will include all workspace members (equivalent to passing -\fB\-\-all\fP), and a non\-virtual workspace will include only the root crate itself. +\fB\-\-workspace\fP), and a non\-virtual workspace will include only the root crate itself. .sp \fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP... .RS 4 @@ -129,15 +129,20 @@ Fix only the specified packages. See \fBcargo\-pkgid\fP(1) for the SPEC format. This flag may be specified multiple times. .RE .sp -\fB\-\-all\fP +\fB\-\-workspace\fP .RS 4 Fix all members in the workspace. .RE .sp +\fB\-\-all\fP +.RS 4 +Deprecated alias for \fB\-\-workspace\fP. +.RE +.sp \fB\-\-exclude\fP \fISPEC\fP... .RS 4 Exclude the specified packages. Must be used in conjunction with the -\fB\-\-all\fP flag. This flag may be specified multiple times. +\fB\-\-workspace\fP flag. This flag may be specified multiple times. .RE .SS "Target Selection" .sp diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1 index e067c4b73a2..0ea98ad5605 100644 --- a/src/etc/man/cargo-test.1 +++ b/src/etc/man/cargo-test.1 @@ -91,7 +91,7 @@ by the manifest will be selected. The default members of a workspace can be set explicitly with the \fBworkspace.default\-members\fP key in the root manifest. If this is not set, a virtual workspace will include all workspace members (equivalent to passing -\fB\-\-all\fP), and a non\-virtual workspace will include only the root crate itself. +\fB\-\-workspace\fP), and a non\-virtual workspace will include only the root crate itself. .sp \fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP... .RS 4 @@ -99,15 +99,20 @@ Test only the specified packages. See \fBcargo\-pkgid\fP(1) for the SPEC format. This flag may be specified multiple times. .RE .sp -\fB\-\-all\fP +\fB\-\-workspace\fP .RS 4 Test all members in the workspace. .RE .sp +\fB\-\-all\fP +.RS 4 +Deprecated alias for \fB\-\-workspace\fP. +.RE +.sp \fB\-\-exclude\fP \fISPEC\fP... .RS 4 Exclude the specified packages. Must be used in conjunction with the -\fB\-\-all\fP flag. This flag may be specified multiple times. +\fB\-\-workspace\fP flag. This flag may be specified multiple times. .RE .SS "Target Selection" .sp diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index 3324640392a..f2909b1321f 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -220,7 +220,7 @@ fn doc_multiple_targets_same_name_lib() { .file("bar/src/lib.rs", "") .build(); - p.cargo("doc --all") + p.cargo("doc --workspace") .with_status(101) .with_stderr_contains("[..] library `foo_lib` is specified [..]") .with_stderr_contains("[..] `foo v0.1.0[..]` [..]") @@ -263,7 +263,7 @@ fn doc_multiple_targets_same_name() { .file("bar/src/lib.rs", "") .build(); - p.cargo("doc --all") + p.cargo("doc --workspace") .with_stderr_contains("[DOCUMENTING] foo v0.1.0 ([CWD]/foo)") .with_stderr_contains("[DOCUMENTING] bar v0.1.0 ([CWD]/bar)") .with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") @@ -307,7 +307,7 @@ fn doc_multiple_targets_same_name_bin() { .file("bar/src/foo-cli.rs", "") .build(); - p.cargo("doc --all") + p.cargo("doc --workspace") .with_status(101) .with_stderr_contains("[..] binary `foo_cli` is specified [..]") .with_stderr_contains("[..] `foo v0.1.0[..]` [..]") @@ -350,7 +350,7 @@ fn doc_multiple_targets_same_name_undoced() { .file("bar/src/foo-cli.rs", "") .build(); - p.cargo("doc --all").run(); + p.cargo("doc --workspace").run(); } #[cargo_test] @@ -926,7 +926,7 @@ fn doc_all_workspace() { .build(); // The order in which bar is compiled or documented is not deterministic - p.cargo("doc --all") + p.cargo("doc --workspace") .with_stderr_contains("[..] Documenting bar v0.1.0 ([..])") .with_stderr_contains("[..] Checking bar v0.1.0 ([..])") .with_stderr_contains("[..] Documenting foo v0.1.0 ([..])") @@ -950,7 +950,7 @@ fn doc_all_virtual_manifest() { .build(); // The order in which bar and baz are documented is not guaranteed - p.cargo("doc --all") + p.cargo("doc --workspace") .with_stderr_contains("[..] Documenting baz v0.1.0 ([..])") .with_stderr_contains("[..] Documenting bar v0.1.0 ([..])") .run(); @@ -1005,7 +1005,7 @@ fn doc_all_member_dependency_same_name() { Package::new("bar", "0.1.0").publish(); - p.cargo("doc --all") + p.cargo("doc --workspace") .with_stderr_contains("[..] Updating `[..]` index") .with_stderr_contains("[..] Documenting bar v0.1.0 ([..])") .run(); @@ -1029,7 +1029,7 @@ fn doc_workspace_open_help_message() { .build(); // The order in which bar is compiled or documented is not deterministic - p.cargo("doc --all --open") + p.cargo("doc --workspace --open") .env("BROWSER", "echo") .with_stderr_contains("[..] Documenting bar v0.1.0 ([..])") .with_stderr_contains("[..] Documenting foo v0.1.0 ([..])") @@ -1246,7 +1246,7 @@ fn doc_private_ws() { .file("b/src/lib.rs", "fn p2() {}") .file("b/src/main.rs", "fn main() {}") .build(); - p.cargo("doc --all --bins --lib --document-private-items -v") + p.cargo("doc --workspace --bins --lib --document-private-items -v") .with_stderr_contains( "[RUNNING] `rustdoc [..] a/src/lib.rs [..]--document-private-items[..]", ) diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index c1753f5e2fc..fae985c3a4e 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -1764,7 +1764,7 @@ fn all_features_all_crates() { .file("bar/src/main.rs", "#[cfg(feature = \"foo\")] fn main() {}") .build(); - p.cargo("build --all-features --all").run(); + p.cargo("build --all-features --workspace").run(); } #[cargo_test]