Add --all-features flag to cargo #3038

Merged
merged 1 commit into from Aug 31, 2016

Conversation

Projects
None yet
6 participants
@esclear
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

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive 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.

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

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Aug 25, 2016

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@esclear

esclear Aug 26, 2016

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@esclear

esclear Aug 26, 2016

Contributor

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

Contributor

esclear commented Aug 26, 2016

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

@brson

This comment has been minimized.

Show comment
Hide comment
@brson

brson Aug 29, 2016

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@sfackler

sfackler Aug 29, 2016

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@esclear

esclear Aug 29, 2016

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Aug 30, 2016

Member

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?

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

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Aug 30, 2016

Member

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

Member

alexcrichton commented Aug 30, 2016

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

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Aug 30, 2016

Member

(other than that though looks good to me)

Member

alexcrichton commented Aug 30, 2016

(other than that though looks good to me)

tests/features.rs
+
+ [features]
+ foo = []
+ bar = ["baz"]

This comment has been minimized.

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

@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.

@esclear

esclear Aug 31, 2016

Contributor

Okay, now I get what you meant by that.

@esclear

esclear Aug 31, 2016

Contributor

Okay, now I get what you meant by that.

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Aug 31, 2016

Member

Thanks! Could you squash the commits down as well?

Member

alexcrichton commented Aug 31, 2016

Thanks! Could you squash the commits down as well?

@esclear

This comment has been minimized.

Show comment
Hide comment
@esclear

esclear Aug 31, 2016

Contributor

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

Contributor

esclear commented Aug 31, 2016

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

@esclear esclear closed this Aug 31, 2016

@esclear esclear reopened this Aug 31, 2016

@esclear

This comment has been minimized.

Show comment
Hide comment
@esclear

esclear Aug 31, 2016

Contributor

After some manual rebasing it should be fine now.

Contributor

esclear commented Aug 31, 2016

After some manual rebasing it should be fine now.

+
+ [features]
+ foo = []
+ bar = []

This comment has been minimized.

@esclear

esclear Aug 31, 2016

Contributor

I removed baz from the feature dependencies of bar.

@esclear

esclear Aug 31, 2016

Contributor

I removed baz from the feature dependencies of bar.

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Aug 31, 2016

Member

@bors: r+ 1f8b398

Thanks!

Member

alexcrichton commented Aug 31, 2016

@bors: r+ 1f8b398

Thanks!

bors added a commit that referenced this pull request Aug 31, 2016

Auto merge of #3038 - esclear:master, r=alexcrichton
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

This comment has been minimized.

Show comment
Hide comment
@bors

bors Aug 31, 2016

Contributor

⌛️ Testing commit 1f8b398 with merge e713e7f...

Contributor

bors commented Aug 31, 2016

⌛️ Testing commit 1f8b398 with merge e713e7f...

@bors

This comment has been minimized.

Show comment
Hide comment
Contributor

bors commented Aug 31, 2016

@bors bors merged commit 1f8b398 into rust-lang:master Aug 31, 2016

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 referenced this pull request Aug 31, 2016

Merged

Add --message-format flag. #3000

@matklad matklad referenced this pull request in intellij-rust/intellij-rust Sep 2, 2016

Closed

Optional dependencies aren't shown in External Libraries #651

@dtretyakov dtretyakov referenced this pull request in JetBrains/teamcity-rust-plugin Jan 10, 2017

Closed

Update cargo support to 1.14 version #30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment