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

Add --all-features flag to cargo #3038

Merged
merged 1 commit into from Aug 31, 2016
Merged

Add --all-features flag to cargo #3038

merged 1 commit into from Aug 31, 2016

Conversation

@esclear
Copy link
Contributor

esclear commented Aug 24, 2016

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.

@rust-highfive
Copy link

rust-highfive commented Aug 24, 2016

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.

@alexcrichton
Copy link
Member

alexcrichton commented Aug 25, 2016

Thanks for the PR @esclear! Looking pretty good to me, but the println! may want to get converted into actually enabling all features? Can you also be sure to add some tests for this functionality as well?

cc @rust-lang/tools, a new flag to cargo

@esclear
Copy link
Contributor Author

esclear commented Aug 26, 2016

Well…
It does enable all featues, since it overwrites the features vec.
But you're right, one wouldn't want to see this kind of debugging information 😳.

I'll try to think of some test and get back to this PR.

@esclear
Copy link
Contributor Author

esclear commented Aug 26, 2016

@alexcrichton Removed the println! and added a simple test.

@brson
Copy link
Contributor

brson commented Aug 29, 2016

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.

@sfackler
Copy link
Member

sfackler commented Aug 29, 2016

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 openssl to feature with-openssl): https://github.com/sfackler/rust-postgres/blob/breaks/src/feature_check.rs

@esclear
Copy link
Contributor Author

esclear commented Aug 29, 2016

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.
I think in that case you'd still want all features to be built.

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.
In case one uses the --all-features flag when building a crate with exclusive features, cargo should warn the user and stop.

@alexcrichton
Copy link
Member

alexcrichton commented Aug 30, 2016

Looking good! I think though that this'll also need to enable any optional dependencies as well as [feature]-style features. Perhaps this could look into using Method::Everything as that should enable all features by default as well?

@alexcrichton
Copy link
Member

alexcrichton commented Aug 30, 2016

Could you also add a test for an optional dependency getting activated as well?

@alexcrichton
Copy link
Member

alexcrichton commented Aug 30, 2016

(other than that though looks good to me)

[features]
foo = []
bar = ["baz"]

This comment has been minimized.

Copy link
@alexcrichton

alexcrichton Aug 31, 2016

Member

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])

This comment has been minimized.

Copy link
@esclear

esclear Aug 31, 2016

Author Contributor

Okay, now I get what you meant by that.

@alexcrichton
Copy link
Member

alexcrichton commented Aug 31, 2016

Thanks! Could you squash the commits down as well?

@esclear
Copy link
Contributor Author

esclear commented Aug 31, 2016

I'll try, even though I merged multiple times now.

@esclear esclear closed this Aug 31, 2016
@esclear esclear force-pushed the esclear:master branch from 75f3f76 to 3e41b6b Aug 31, 2016
@esclear esclear reopened this Aug 31, 2016
@esclear
Copy link
Contributor Author

esclear commented Aug 31, 2016

After some manual rebasing it should be fine now.

[features]
foo = []
bar = []

This comment has been minimized.

Copy link
@esclear

esclear Aug 31, 2016

Author Contributor

I removed baz from the feature dependencies of bar.

@alexcrichton
Copy link
Member

alexcrichton commented Aug 31, 2016

@bors: r+ 1f8b398

Thanks!

bors added a commit that referenced this pull request Aug 31, 2016
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.
@bors
Copy link
Contributor

bors commented Aug 31, 2016

Testing commit 1f8b398 with merge e713e7f...

@bors
Copy link
Contributor

bors commented Aug 31, 2016

@bors bors merged commit 1f8b398 into rust-lang:master Aug 31, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@bors bors mentioned this pull request Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.