-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add a workspace.default-members config that overrides implied --all #4743
Conversation
r? @matklad (rust_highfive has picked a reviewer for you, use r? to override) |
r? @rust-lang/cargo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks great to me, let's see what others think!
src/cargo/core/workspace.rs
Outdated
@@ -46,6 +46,9 @@ pub struct Workspace<'cfg> { | |||
// set above. | |||
members: Vec<PathBuf>, | |||
|
|||
// The subset of `members` that are “default”. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's expand this comment a bit, to explain when exactly this field is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote some things.
@@ -370,7 +413,7 @@ impl<'cfg> Workspace<'cfg> { | |||
root_manifest: &Path, | |||
is_path_dep: bool) -> CargoResult<()> { | |||
let manifest_path = paths::normalize_path(manifest_path); | |||
if self.members.iter().any(|p| p == &manifest_path) { | |||
if self.members.contains(&manifest_path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
-> CargoResult<Self> | ||
{ | ||
let all = all || (virtual_ws && package.is_empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bikeshedding: this could be match (all, exclude.is_empty(), package.is_empty())
and (false, true, true)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that at first and found it confusing when it came to writing all the patterns. Both because of boolean overload, and because false
felt like "negative" and so "not present".
@withoutboats ping: could you look at this small addition/nice usability improvement to Cargo.toml format? I'd love to r+ it, but I just want another pair of eyes to look at this feature as a whole :) |
Could this be sure to update the documentation for workspaces as well? I'm not entirely sure what this feature is doing at a first glance and the docs would certainly help me learn! |
Sure. Are the sources for what will become "the cargo book" still at |
Pushed a couple more commits. |
CI had an identical failure on all platforms, but I couldn’t reproduce :/
|
Wait, this is exactly the issue that @nrc was seeing recently! |
Yeah, I saw this failure on the Rust CI, (after updating RLS and Rustfmt and not touching Cargo). I could repro locally inside Rust, but not in Cargo's own repo. I got nowhere trying to investigate. I would love if we could just disable this test for now so I can land the RLS/Rustfmt update. |
c04b304
to
d76c91b
Compare
When no package is selected with `-p`, the default behavior for virtual workspaces is to select every member as if `--all` were used.
d76c91b
to
82d563b
Compare
Sounds reasonable to me from a feature perspective! |
@bors r+ The test should now be fixed in master. Thanks @SimonSapin ! |
📌 Commit 82d563b has been approved by |
Add a workspace.default-members config that overrides implied --all Fixes #4507.
☀️ Test successful - status-appveyor, status-travis |
rust-lang/cargo@5bb478a Pick up `workspace.default-members` support: rust-lang/cargo#4743
Update Cargo to Wed Nov 29 15:19:05 2017 +0000 rust-lang/cargo@5bb478a Pick up `workspace.default-members` support: rust-lang/cargo#4743
@@ -520,8 +520,19 @@ crate will be treated as a normal package, as well as a workspace. If the | |||
manifest*. | |||
|
|||
When working with *virtual manifests*, package-related cargo commands, like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems wrong - an earlier commit makes default-members work for non-virtual manifests too, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I forgot about that when writing the docs. Submitted #4784, thanks.
…ild' … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it.
…ild' … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it.
…ild' … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it.
…ild' … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it.
Use workspace.default-members to specify default crates for cargo build … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19476) <!-- Reviewable:end -->
Use workspace.default-members to specify default crates for cargo build … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19476) <!-- Reviewable:end -->
…ild' … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it.
…ild' … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it.
…ild' … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it.
…ild' … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it.
Use workspace.default-members to specify default crates for cargo build … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19476) <!-- Reviewable:end -->
…ild' … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it.
Use workspace.default-members to specify default crates for cargo build … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19476) <!-- Reviewable:end -->
…t crates for cargo build (from servo:default-members); r=nox … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it. Source-Repo: https://github.com/servo/servo Source-Revision: df68eea3f21cc3bbf24d5bbb66be42c4e3a9e427 --HG-- rename : servo/tests/unit/stylo/Cargo.toml => servo/ports/geckolib/tests/Cargo.toml rename : servo/tests/unit/stylo/build.rs => servo/ports/geckolib/tests/build.rs rename : servo/tests/unit/stylo/lib.rs => servo/ports/geckolib/tests/lib.rs rename : servo/tests/unit/stylo/servo_function_signatures.rs => servo/ports/geckolib/tests/servo_function_signatures.rs rename : servo/tests/unit/stylo/size_of.rs => servo/ports/geckolib/tests/size_of.rs rename : servo/tests/unit/stylo/specified_values.rs => servo/ports/geckolib/tests/specified_values.rs extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 0939a7049dc771e9d1b4f45f6e3ade2866266fa4
…t crates for cargo build (from servo:default-members); r=nox … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it. Source-Repo: https://github.com/servo/servo Source-Revision: df68eea3f21cc3bbf24d5bbb66be42c4e3a9e427
…t crates for cargo build (from servo:default-members); r=nox … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it. Source-Repo: https://github.com/servo/servo Source-Revision: df68eea3f21cc3bbf24d5bbb66be42c4e3a9e427 UltraBlame original commit: d1606d726592e798d5cafba5cbbf0f8326d67243
…t crates for cargo build (from servo:default-members); r=nox … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it. Source-Repo: https://github.com/servo/servo Source-Revision: df68eea3f21cc3bbf24d5bbb66be42c4e3a9e427 UltraBlame original commit: d1606d726592e798d5cafba5cbbf0f8326d67243
…t crates for cargo build (from servo:default-members); r=nox … and 'cargo test', etc. Include Servo and its unit tests, but not Stylo because that would try to compile the style crate with incompatible feature flags: rust-lang/cargo#4463 `workspace.default-members` was added in rust-lang/cargo#4743. Older Cargo versions ignore it. Source-Repo: https://github.com/servo/servo Source-Revision: df68eea3f21cc3bbf24d5bbb66be42c4e3a9e427 UltraBlame original commit: d1606d726592e798d5cafba5cbbf0f8326d67243
Fixes #4507.