Skip to content

Conversation

DaAlbrecht
Copy link
Collaborator

@DaAlbrecht DaAlbrecht commented Oct 6, 2025

Objective

Enable the required features from examples automatically. If all examples should be built/checked, enable --all-features.

Testing

❯ bevy run --example web_asset -v
debug: running: `cargo metadata --format-version 1`
debug: enabling required_features: ["https"], for example: web_asset
debug: running: `cargo run --example web_asset --features https --profile dev`
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
❯ bevy build --example web_asset -v
debug: running: `cargo metadata --format-version 1`
debug: enabling required_features: ["https"], for example: web_asset
debug: running: `cargo build --example web_asset --features https --profile dev`
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s

Note

Building and lining all examples does not work until #629

Closes #622

@DaAlbrecht DaAlbrecht added A-Run Related to the bevy run command A-Build Related to the bevy build command D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review The PR needs to be reviewed before it can be merged labels Oct 6, 2025
@alice-i-cecile
Copy link
Member

Yay! That's very nice.

Copy link
Member

@BD103 BD103 left a comment

Choose a reason for hiding this comment

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

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

@DaAlbrecht
Copy link
Collaborator Author

DaAlbrecht commented Oct 6, 2025

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?

@BD103
Copy link
Member

BD103 commented Oct 7, 2025

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 enabling required_features log message from debug!() to info!()?

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!

@DaAlbrecht
Copy link
Collaborator Author

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 ^^

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

Labels

A-Build Related to the bevy build command A-Run Related to the bevy run command D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review The PR needs to be reviewed before it can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bevy run --example should enable required features of examples

3 participants