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

Only apply default-members when building root manifest #7270

Merged
merged 2 commits into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/cargo/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,15 @@ impl<'cfg> Workspace<'cfg> {
WorkspaceConfig::Root(ref root_config) => {
members_paths = root_config
.members_paths(root_config.members.as_ref().unwrap_or(&vec![]))?;
default_members_paths = if let Some(ref default) = root_config.default_members {
Some(root_config.members_paths(default)?)
default_members_paths = if root_manifest_path == self.current_manifest {
if let Some(ref default) = root_config.default_members {
Some(root_config.members_paths(default)?)
} else {
None
}
} else {
None
}
};
}
_ => failure::bail!(
"root of a workspace inferred but wasn't a root: {}",
Expand Down
15 changes: 10 additions & 5 deletions src/doc/man/generated/cargo-bench.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@ <h3 id="cargo_bench_benchmark_options">Benchmark Options</h3>
<h3 id="cargo_bench_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
depend on the selected manifest file (based on the current working directory if
<code>--manifest-path</code> is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.</p>
</div>
<div class="paragraph">
<p>The default members of a workspace can be set explicitly with the
<code>workspace.default-members</code> key in the root manifest. If this is not set, a
virtual workspace will include all workspace members (equivalent to passing
<code>--all</code>), and a non-virtual workspace will include only the root crate itself.</p>
</div>
<div class="dlist">
<dl>
Expand Down
15 changes: 10 additions & 5 deletions src/doc/man/generated/cargo-build.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ <h2 id="cargo_build_options">OPTIONS</h2>
<h3 id="cargo_build_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
depend on the selected manifest file (based on the current working directory if
<code>--manifest-path</code> is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.</p>
</div>
<div class="paragraph">
<p>The default members of a workspace can be set explicitly with the
<code>workspace.default-members</code> key in the root manifest. If this is not set, a
virtual workspace will include all workspace members (equivalent to passing
<code>--all</code>), and a non-virtual workspace will include only the root crate itself.</p>
</div>
<div class="dlist">
<dl>
Expand Down
15 changes: 10 additions & 5 deletions src/doc/man/generated/cargo-check.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ <h2 id="cargo_check_options">OPTIONS</h2>
<h3 id="cargo_check_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
depend on the selected manifest file (based on the current working directory if
<code>--manifest-path</code> is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.</p>
</div>
<div class="paragraph">
<p>The default members of a workspace can be set explicitly with the
<code>workspace.default-members</code> key in the root manifest. If this is not set, a
virtual workspace will include all workspace members (equivalent to passing
<code>--all</code>), and a non-virtual workspace will include only the root crate itself.</p>
</div>
<div class="dlist">
<dl>
Expand Down
15 changes: 10 additions & 5 deletions src/doc/man/generated/cargo-doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,16 @@ <h3 id="cargo_doc_documentation_options">Documentation Options</h3>
<h3 id="cargo_doc_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
depend on the selected manifest file (based on the current working directory if
<code>--manifest-path</code> is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.</p>
</div>
<div class="paragraph">
<p>The default members of a workspace can be set explicitly with the
<code>workspace.default-members</code> key in the root manifest. If this is not set, a
virtual workspace will include all workspace members (equivalent to passing
<code>--all</code>), and a non-virtual workspace will include only the root crate itself.</p>
</div>
<div class="dlist">
<dl>
Expand Down
15 changes: 10 additions & 5 deletions src/doc/man/generated/cargo-fix.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,16 @@ <h3 id="cargo_fix_fix_options">Fix options</h3>
<h3 id="cargo_fix_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
depend on the selected manifest file (based on the current working directory if
<code>--manifest-path</code> is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.</p>
</div>
<div class="paragraph">
<p>The default members of a workspace can be set explicitly with the
<code>workspace.default-members</code> key in the root manifest. If this is not set, a
virtual workspace will include all workspace members (equivalent to passing
<code>--all</code>), and a non-virtual workspace will include only the root crate itself.</p>
</div>
<div class="dlist">
<dl>
Expand Down
15 changes: 10 additions & 5 deletions src/doc/man/generated/cargo-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,16 @@ <h3 id="cargo_test_test_options">Test Options</h3>
<h3 id="cargo_test_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
depend on the selected manifest file (based on the current working directory if
<code>--manifest-path</code> is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.</p>
</div>
<div class="paragraph">
<p>The default members of a workspace can be set explicitly with the
<code>workspace.default-members</code> key in the root manifest. If this is not set, a
virtual workspace will include all workspace members (equivalent to passing
<code>--all</code>), and a non-virtual workspace will include only the root crate itself.</p>
</div>
<div class="dlist">
<dl>
Expand Down
14 changes: 9 additions & 5 deletions src/doc/man/options-packages.adoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (`--all` is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the `workspace.default-members` key in the root `Cargo.toml`
manifest.
depend on the selected manifest file (based on the current working directory if
`--manifest-path` is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.

The default members of a workspace can be set explicitly with the
`workspace.default-members` key in the root manifest. If this is not set, a
virtual workspace will include all workspace members (equivalent to passing
`--all`), and a non-virtual workspace will include only the root crate itself.

*-p* _SPEC_...::
*--package* _SPEC_...::
Expand Down
20 changes: 12 additions & 8 deletions src/etc/man/cargo-bench.1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'\" t
.\" Title: cargo-bench
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.8
.\" Date: 2019-06-07
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2019-08-19
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-BENCH" "1" "2019-06-07" "\ \&" "\ \&"
.TH "CARGO\-BENCH" "1" "2019-08-19" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down Expand Up @@ -77,11 +77,15 @@ the executable as a whole.
.SS "Package Selection"
.sp
By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (\fB\-\-all\fP is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the \fBworkspace.default\-members\fP key in the root \fBCargo.toml\fP
manifest.
depend on the selected manifest file (based on the current working directory if
\fB\-\-manifest\-path\fP is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.
.sp
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.
.sp
\fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP...
.RS 4
Expand Down
20 changes: 12 additions & 8 deletions src/etc/man/cargo-build.1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'\" t
.\" Title: cargo-build
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.8
.\" Date: 2019-06-07
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2019-08-19
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-BUILD" "1" "2019-06-07" "\ \&" "\ \&"
.TH "CARGO\-BUILD" "1" "2019-08-19" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down Expand Up @@ -39,11 +39,15 @@ Compile local packages and all of their dependencies.
.SS "Package Selection"
.sp
By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (\fB\-\-all\fP is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the \fBworkspace.default\-members\fP key in the root \fBCargo.toml\fP
manifest.
depend on the selected manifest file (based on the current working directory if
\fB\-\-manifest\-path\fP is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.
.sp
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.
.sp
\fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP...
.RS 4
Expand Down
20 changes: 12 additions & 8 deletions src/etc/man/cargo-check.1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'\" t
.\" Title: cargo-check
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.8
.\" Date: 2019-06-07
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2019-08-19
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-CHECK" "1" "2019-06-07" "\ \&" "\ \&"
.TH "CARGO\-CHECK" "1" "2019-08-19" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down Expand Up @@ -43,11 +43,15 @@ not been modified.
.SS "Package Selection"
.sp
By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (\fB\-\-all\fP is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the \fBworkspace.default\-members\fP key in the root \fBCargo.toml\fP
manifest.
depend on the selected manifest file (based on the current working directory if
\fB\-\-manifest\-path\fP is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.
.sp
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.
.sp
\fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP...
.RS 4
Expand Down
20 changes: 12 additions & 8 deletions src/etc/man/cargo-doc.1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'\" t
.\" Title: cargo-doc
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.8
.\" Date: 2019-06-07
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2019-08-19
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-DOC" "1" "2019-06-07" "\ \&" "\ \&"
.TH "CARGO\-DOC" "1" "2019-08-19" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down Expand Up @@ -56,11 +56,15 @@ Include non\-public items in the documentation.
.SS "Package Selection"
.sp
By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (\fB\-\-all\fP is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the \fBworkspace.default\-members\fP key in the root \fBCargo.toml\fP
manifest.
depend on the selected manifest file (based on the current working directory if
\fB\-\-manifest\-path\fP is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.
.sp
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.
.sp
\fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP...
.RS 4
Expand Down
20 changes: 12 additions & 8 deletions src/etc/man/cargo-fix.1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'\" t
.\" Title: cargo-fix
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.8
.\" Date: 2019-06-07
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2019-08-19
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-FIX" "1" "2019-06-07" "\ \&" "\ \&"
.TH "CARGO\-FIX" "1" "2019-08-19" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down Expand Up @@ -113,11 +113,15 @@ Fix code even if the working directory has staged changes.
.SS "Package Selection"
.sp
By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (\fB\-\-all\fP is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the \fBworkspace.default\-members\fP key in the root \fBCargo.toml\fP
manifest.
depend on the selected manifest file (based on the current working directory if
\fB\-\-manifest\-path\fP is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.
.sp
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.
.sp
\fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP...
.RS 4
Expand Down
20 changes: 12 additions & 8 deletions src/etc/man/cargo-test.1
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'\" t
.\" Title: cargo-test
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.8
.\" Date: 2019-06-07
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2019-08-19
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-TEST" "1" "2019-06-07" "\ \&" "\ \&"
.TH "CARGO\-TEST" "1" "2019-08-19" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down Expand Up @@ -83,11 +83,15 @@ the executable as a whole.
.SS "Package Selection"
.sp
By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (\fB\-\-all\fP is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the \fBworkspace.default\-members\fP key in the root \fBCargo.toml\fP
manifest.
depend on the selected manifest file (based on the current working directory if
\fB\-\-manifest\-path\fP is not given). If the manifest is the root of a workspace then
the workspaces default members are selected, otherwise only the package defined
by the manifest will be selected.
.sp
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.
.sp
\fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP...
.RS 4
Expand Down
Loading