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 #6755

Closed
wants to merge 2 commits into from
Closed
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 @@ -427,11 +427,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
18 changes: 11 additions & 7 deletions src/etc/man/cargo-bench.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: cargo-bench
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-23
.\" Date: 2019-03-16
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-BENCH" "1" "2018-12-23" "\ \&" "\ \&"
.TH "CARGO\-BENCH" "1" "2019-03-16" "\ \&" "\ \&"
.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
18 changes: 11 additions & 7 deletions src/etc/man/cargo-build.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: cargo-build
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-20
.\" Date: 2019-01-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-BUILD" "1" "2018-12-20" "\ \&" "\ \&"
.TH "CARGO\-BUILD" "1" "2019-01-09" "\ \&" "\ \&"
.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
18 changes: 11 additions & 7 deletions src/etc/man/cargo-check.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: cargo-check
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-20
.\" Date: 2019-01-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-CHECK" "1" "2018-12-20" "\ \&" "\ \&"
.TH "CARGO\-CHECK" "1" "2019-01-09" "\ \&" "\ \&"
.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
4 changes: 2 additions & 2 deletions src/etc/man/cargo-clean.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: cargo-clean
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-20
.\" Date: 2019-01-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-CLEAN" "1" "2018-12-20" "\ \&" "\ \&"
.TH "CARGO\-CLEAN" "1" "2019-01-09" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down
18 changes: 11 additions & 7 deletions src/etc/man/cargo-doc.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: cargo-doc
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-20
.\" Date: 2019-01-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-DOC" "1" "2018-12-20" "\ \&" "\ \&"
.TH "CARGO\-DOC" "1" "2019-01-09" "\ \&" "\ \&"
.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
4 changes: 2 additions & 2 deletions src/etc/man/cargo-fetch.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: cargo-fetch
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-20
.\" Date: 2019-01-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-FETCH" "1" "2018-12-20" "\ \&" "\ \&"
.TH "CARGO\-FETCH" "1" "2019-01-09" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down
18 changes: 11 additions & 7 deletions src/etc/man/cargo-fix.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: cargo-fix
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-20
.\" Date: 2019-01-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-FIX" "1" "2018-12-20" "\ \&" "\ \&"
.TH "CARGO\-FIX" "1" "2019-01-09" "\ \&" "\ \&"
.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
4 changes: 2 additions & 2 deletions src/etc/man/cargo-generate-lockfile.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: cargo-generate-lockfile
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-20
.\" Date: 2019-01-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-GENERATE\-LOCKFILE" "1" "2018-12-20" "\ \&" "\ \&"
.TH "CARGO\-GENERATE\-LOCKFILE" "1" "2019-01-09" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand Down
Loading