-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 --all-features flag to cargo #3038
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (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. |
Thanks for the PR @esclear! Looking pretty good to me, but the cc @rust-lang/tools, a new flag to cargo |
Well… I'll try to think of some test and get back to this PR. |
@alexcrichton Removed the |
Seems reasonable to me given the current design of features. It might be worth considering how this plays out with any future changes to cargo features. For example, some features may be mutually-incompatible. Cargo has no way to encode that today, but maybe not forever. |
This shouldn't impact this PR from landing, but here's one example of me forcing incompatible traits to help ease a rename (of e.g. feature |
Given that exclusive features are already being discussed in #2980 this should be considered. My main intent behind this flag was to simplify enabling all features while building crate documentation or testing. On the other hand, there might be problems when testing with exclusive features enabled. In my opinion, the user would have to enable all of the needed features manually if there are any exclusive features. |
Looking good! I think though that this'll also need to enable any optional dependencies as well as |
Could you also add a test for an optional dependency getting activated as well? |
(other than that though looks good to me) |
|
||
[features] | ||
foo = [] | ||
bar = ["baz"] |
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 dependency on "baz"
may want to be removed because otherwise activating bar
is the same as activating baz
(e.g. --all-features
should activate optional dependencies that aren't listed in [features]
)
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.
Okay, now I get what you meant by that.
Thanks! Could you squash the commits down as well? |
I'll try, even though I merged multiple times now. |
After some manual rebasing it should be fine now. |
|
||
[features] | ||
foo = [] | ||
bar = [] |
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 removed baz
from the feature dependencies of bar
.
Add --all-features flag to cargo As (more or less) requested in #1173 I added a `--all-features` flag to cargo that builds all available features. I hope I documented it in all the right places. If there's something weird or wrong, please give me a heads up.
☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
As (more or less) requested in #1173 I added a
--all-features
flag to cargo that builds all available features.I hope I documented it in all the right places.
If there's something weird or wrong, please give me a heads up.