Enabled required features from examples automatically#636
Conversation
|
Yay! That's very nice. |
BD103
left a comment
There was a problem hiding this comment.
I haven't had a chance to look over the code yet, but could you please add some basic docs on this feature? I don't want to diverge from Cargo without documenting it :)
yea good point! Alice mentioned she would like a yes/no prompt i think that would be self documenting and no longer silently diverge from cargo what do you think? |
While I think a prompt would be good with users who are unaware of the feature, I think it would also be really annoying for users who are aware and actively want the example's required features to be enabled. Maybe a good alternative would be switching the But I also don't think that replaces having documentation on our website. A user shouldn't have to install the CLI or read the changelog to see all the features supported by a program. I can draft up something if you want me to! |
I added a section but I always appreciate your docs/writing style, so feel free to delete it ^^ |
| args.cargo_args | ||
| .feature_args | ||
| .features | ||
| .push("--all-features".to_owned()); | ||
|
|
||
| info!("automatically added `--all-features` to build examples with all features enabled"); |
There was a problem hiding this comment.
I'm not sure we should always enable --all-features when --examples is passed. When I run cargo build --examples --all-features in Bevy's repo, it fails with a compile error. That's not a great user experience, especially when the primary use of this feature will be by Bevy devs.
In @alice-i-cecile's original comment when I asked how to deal with --examples and --all-targets, she said:
Based on the design proposed in the linked issue, I would build these with
--all-features(uh, except where mutually incompatible features exist) and diverge fromcargo. Or at least warn users that they probably want to enable all the features and try again.
I think we either need to be more intelligent with how we handle mutually incompatible features, or just cut this for now. The alternative is Bevy devs being unable to compile the Bevy workspace with bevy build --examples, having to switch to cargo build --examples, which I don't think is acceptable.
There was a problem hiding this comment.
If we update this, make sure to also update the section in examples.md and lint/mod.rs.
There was a problem hiding this comment.
Eh i think this is just because im dumb ^^ Imo you should try to avoid having mutually incompatible features (on a compiler level), that would kinda break what features are used for.
Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com>
Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com>
BD103
left a comment
There was a problem hiding this comment.
Thank you! Looking forward to using this in the next release :)
Objective
Enable the required features from examples automatically. If all examples should be built/checked, enable
--all-features.Testing
Note
Building and lining all examples does not work until #629
Closes #622