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

Implementation and CLI-support for --all-$KIND flags #3901

Merged
merged 7 commits into from
Apr 24, 2017
Merged

Implementation and CLI-support for --all-$KIND flags #3901

merged 7 commits into from
Apr 24, 2017

Conversation

BenWiederhake
Copy link
Contributor

This implements #3112.

This means all of the following commands are now possible and meaningful:

cargo build --all-bins
cargo build --all-tests
cargo test --all-tests
cargo test --all-bins
cargo check --all-bins --all-examples --all-tests --all-benches

The commits try to represent the incremental "propagation" of the new feature:

  • core functionality (cargo check --lib passes)
  • CLI suport (cargo build passes)
  • additional tests (cargo test covers new functionality)

Note that --all is already reserved to mean "all packages of the workspace", so it can't be used to mean --all-bins --all-examples --all-tests --all-benches.

I intend to follow this up by some other PRs, so please do tell me where I could improve.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

Awesome thanks for the PR @BenWiederhake!

I'm currently traveling but I should be back next week, I'll try to review then.

@BenWiederhake
Copy link
Contributor Author

Thanks for the heads-up, and no hurry :)

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fantastic to me, thanks so much @BenWiederhake! All I really have is a stylistic nit and a bikeshed :)

@wycats, @carols10cents, @matklad, @brson, thoughts about the flag names here? I might lean toward --tests instead of --all-tests, but I'm curious what others think.

bins.iter().chain(examples)
.filter_map(|t| check(t))
.collect()
let all_bins: Vec<String> = bins.try_collect().unwrap_or_else(||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this use {} to delimit the closure?

@alexcrichton alexcrichton added the relnotes Release-note worthy label Apr 10, 2017
@matklad
Copy link
Member

matklad commented Apr 10, 2017

I'll second --tests, --bins etc, because we already have the --all flag, which controls an orthogonal feature, which packages in the workspace are build. It would be prudent to add a test with combination of both features, like cargo build --all --tests

@BenWiederhake
Copy link
Contributor Author

@alexcrichton, re: stylistic nit: ah, yes, those braces belong there. Added.

@alexcrichton, @matklad, re: rename: ehh, I personally find --all-tests more intuitive, especially since it disables the usually automatic filtering for feature-compatible targets. But whatever, I changed it, it's only a string anyway.

@matklad, re: cargo build --all --tests: I added tests for the two scenarios in which cargo build --all --examples can occur. I thought that building examples is slightly more interesting because building the tests can already be done with cargo test --all --no-run.

re: readability of diffs: all my new commits can be found at the tip of my branch incremental, in case you want to see differences to the previous version of this PR. For all other purposes, the currently selected branch all-kinds contains appropriately squashed stuff that is freshly rebased on top of master. Have fun reading.

@alexcrichton
Copy link
Member

Looks great to me from a technical perspective, thanks again @BenWiederhake! I'll give others some time to weigh in and then we can see how to move forward.

@alexcrichton
Copy link
Member

Ok looks like we don't have too many more opinions, so I'll merge regardless :)

Thanks again for the PR @BenWiederhake!

@bors: r+

@bors
Copy link
Collaborator

bors commented Apr 24, 2017

📌 Commit 01782fe has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Apr 24, 2017

⌛ Testing commit 01782fe with merge b987ce4...

bors added a commit that referenced this pull request Apr 24, 2017
Implementation and CLI-support for `--all-$KIND` flags

This implements #3112.

This means all of the following commands are now possible and meaningful:
```
cargo build --all-bins
cargo build --all-tests
cargo test --all-tests
cargo test --all-bins
cargo check --all-bins --all-examples --all-tests --all-benches
```

The commits try to represent the incremental "propagation" of the new feature:
- core functionality (`cargo check --lib` passes)
- CLI suport (`cargo build` passes)
- additional tests (`cargo test` covers new functionality)

Note that `--all` is already reserved to mean "all packages of the workspace", so it can't be used to mean `--all-bins --all-examples --all-tests --all-benches`.

I intend to follow this up by some other PRs, so please do tell me where I could improve.
@bors
Copy link
Collaborator

bors commented Apr 24, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing b987ce4 to master...

@bors bors merged commit 01782fe into rust-lang:master Apr 24, 2017
@BenWiederhake BenWiederhake deleted the all-kinds branch April 24, 2017 19:20
@matklad matklad mentioned this pull request Mar 6, 2018
bors added a commit that referenced this pull request Mar 6, 2018
Drop ignored tests

r? @alexcrichton

These tests are ignored, so its better to remove them. `run` does not supports `--bins` argument, so I've left a single test that checks specifically for this.

cc #3901
@ehuss ehuss added this to the 1.19.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Release-note worthy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants