Skip to content

Commit f478cb3

Browse files
authored
Detailed Feature List for Collections (#22506)
# Objective - Make it easier to understand what each feature collection is enabling. ## Solution - Added the list of features that a collection will enable on its description. These are located in the "cargo_features" templated doc page. ## Testing - Running the templated page generator for "features" and checking the resulting markdown. --- ## Showcase <img width="996" height="373" alt="image" src="https://github.com/user-attachments/assets/9b31de60-ef33-4291-bd5f-2d1583467447" />
1 parent 1b1458c commit f478cb3

File tree

3 files changed

+35
-17
lines changed

3 files changed

+35
-17
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ audio = ["bevy_audio", "vorbis"]
178178
# COLLECTION: Features used to compose Bevy scenes.
179179
scene = ["bevy_scene"]
180180

181-
# COLLECTION: Enables picking functionality
181+
# COLLECTION: Enables picking functionality.
182182
picking = ["bevy_picking", "mesh_picking", "sprite_picking", "ui_picking"]
183183

184184
# COLLECTION: The core pieces that most apps need. This serves as a baseline feature set for other higher level feature collections (such as "2d" and "3d"). It is also useful as a baseline feature set for scenarios like headless apps that require no rendering (ex: command line tools, servers, etc).
@@ -273,7 +273,7 @@ ui_bevy_render = [
273273
"bevy_ui_render",
274274
]
275275

276-
# COLLECTION: Recommended defaults for no_std applications
276+
# COLLECTION: Recommended defaults for no_std applications.
277277
default_no_std = ["libm", "critical-section", "bevy_color", "bevy_state"]
278278

279279
# Provides an implementation for picking meshes

docs/cargo_features.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ collections to build your own "profile" equivalent, without needing to manually
3636

3737
|Collection|Description|
3838
|-|-|
39-
|dev|Enable this feature during development to improve the development experience. This adds features like asset hot-reloading and debugging tools. This should not be enabled for published apps!|
40-
|audio|Features used to build audio Bevy apps.|
41-
|scene|Features used to compose Bevy scenes.|
42-
|picking|Enables picking functionality|
43-
|default_app|The core pieces that most apps need. This serves as a baseline feature set for other higher level feature collections (such as "2d" and "3d"). It is also useful as a baseline feature set for scenarios like headless apps that require no rendering (ex: command line tools, servers, etc).|
44-
|default_platform|These are platform support features, such as OS support/features, windowing and input backends, etc.|
45-
|common_api|Default scene definition features. Note that this does not include an actual renderer, such as bevy_render (Bevy's default render backend).|
46-
|2d_api|Features used to build 2D Bevy apps (does not include a render backend). You generally don't need to worry about this unless you are using a custom renderer.|
47-
|2d_bevy_render|Bevy's built-in 2D renderer, built on top of `bevy_render`.|
48-
|3d_api|Features used to build 3D Bevy apps (does not include a render backend). You generally don't need to worry about this unless you are using a custom renderer.|
49-
|3d_bevy_render|Bevy's built-in 3D renderer, built on top of `bevy_render`.|
50-
|ui_api|Features used to build UI Bevy apps (does not include a render backend). You generally don't need to worry about this unless you are using a custom renderer.|
51-
|ui_bevy_render|Bevy's built-in UI renderer, built on top of `bevy_render`.|
52-
|default_no_std|Recommended defaults for no_std applications|
39+
|dev|Enable this feature during development to improve the development experience. This adds features like asset hot-reloading and debugging tools. This should not be enabled for published apps! **Feature set:** `debug`, `bevy_dev_tools`, `file_watcher`.|
40+
|audio|Features used to build audio Bevy apps. **Feature set:** `bevy_audio`, `vorbis`.|
41+
|scene|Features used to compose Bevy scenes. **Feature set:** `bevy_scene`.|
42+
|picking|Enables picking functionality. **Feature set:** `bevy_picking`, `mesh_picking`, `sprite_picking`, `ui_picking`.|
43+
|default_app|The core pieces that most apps need. This serves as a baseline feature set for other higher level feature collections (such as "2d" and "3d"). It is also useful as a baseline feature set for scenarios like headless apps that require no rendering (ex: command line tools, servers, etc). **Feature set:** `async_executor`, `bevy_asset`, `bevy_input_focus`, `bevy_log`, `bevy_state`, `bevy_window`, `custom_cursor`, `reflect_auto_register`.|
44+
|default_platform|These are platform support features, such as OS support/features, windowing and input backends, etc. **Feature set:** `std`, `android-game-activity`, `android_shared_stdcxx`, `bevy_gilrs`, `bevy_winit`, `default_font`, `multi_threaded`, `webgl2`, `x11`, `wayland`, `sysinfo_plugin`.|
45+
|common_api|Default scene definition features. Note that this does not include an actual renderer, such as bevy_render (Bevy's default render backend). **Feature set:** `bevy_animation`, `bevy_camera`, `bevy_color`, `bevy_gizmos`, `bevy_image`, `bevy_mesh`, `bevy_shader`, `bevy_material`, `bevy_text`, `hdr`, `png`.|
46+
|2d_api|Features used to build 2D Bevy apps (does not include a render backend). You generally don't need to worry about this unless you are using a custom renderer. **Feature set:** `common_api`, `bevy_sprite`.|
47+
|2d_bevy_render|Bevy's built-in 2D renderer, built on top of `bevy_render`. **Feature set:** `2d_api`, `bevy_render`, `bevy_core_pipeline`, `bevy_post_process`, `bevy_sprite_render`, `bevy_gizmos_render`.|
48+
|3d_api|Features used to build 3D Bevy apps (does not include a render backend). You generally don't need to worry about this unless you are using a custom renderer. **Feature set:** `common_api`, `bevy_light`, `bevy_mikktspace`, `ktx2`, `morph_animation`, `morph`, `smaa_luts`, `tonemapping_luts`, `zstd_rust`.|
49+
|3d_bevy_render|Bevy's built-in 3D renderer, built on top of `bevy_render`. **Feature set:** `3d_api`, `bevy_render`, `bevy_core_pipeline`, `bevy_gizmos_render`, `bevy_anti_alias`, `bevy_gltf`, `bevy_pbr`, `bevy_post_process`, `gltf_animation`.|
50+
|ui_api|Features used to build UI Bevy apps (does not include a render backend). You generally don't need to worry about this unless you are using a custom renderer. **Feature set:** `default_app`, `common_api`, `bevy_ui`.|
51+
|ui_bevy_render|Bevy's built-in UI renderer, built on top of `bevy_render`. **Feature set:** `ui_api`, `bevy_render`, `bevy_core_pipeline`, `bevy_ui_render`.|
52+
|default_no_std|Recommended defaults for no_std applications. **Feature set:** `libm`, `critical-section`, `bevy_color`, `bevy_state`.|
5353

5454
### Feature List
5555

tools/build-templated-pages/src/features.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ fn parse_features(panic_on_missing: bool) -> Vec<Feature> {
4040
let key = key[0];
4141

4242
if key == "default" {
43-
let values = value.as_array().unwrap().iter().flat_map(|v| v.as_str()).collect::<Vec<_>>().join(", ");
43+
let values = value
44+
.as_array()
45+
.unwrap()
46+
.iter()
47+
.flat_map(|v| v.as_str())
48+
.collect::<Vec<_>>()
49+
.join(", ");
4450
let description = format!("The full default Bevy experience. This is a combination of the following profiles: {values}");
4551

4652
Some(Feature {
@@ -81,6 +87,18 @@ fn parse_features(panic_on_missing: bool) -> Vec<Feature> {
8187
} else {
8288
false
8389
};
90+
91+
if is_collection {
92+
let features = value
93+
.as_array()
94+
.unwrap()
95+
.iter()
96+
.flat_map(|v| v.as_str().map(|s| format!("`{}`", s)))
97+
.collect::<Vec<_>>()
98+
.join(", ");
99+
description.push_str(&format!(" **Feature set:** {}.", &features));
100+
}
101+
84102
Some(Feature {
85103
is_profile,
86104
is_collection,

0 commit comments

Comments
 (0)