Skip to content

Commit cb02e96

Browse files
Seliksialice-i-cecilecart
authored
Move bevy_window, bevy_input_focus, custom_cursor features to alternate feature collections (#22488)
Related: Cargo Feature Collections #21472 ## Context: > If `default_app` is meant to be > > 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). > > why should `bevy_window` / `custom_cursor` be there? I would expect these to be in `common_api`. \- Me, https://discord.com/channels/691052431525675048/692572690833473578/1460424003486224517 > Imo this is a mistake. Can you open a PR with a migration guide please? \- Alice, https://discord.com/channels/691052431525675048/692572690833473578/1460429142376845404 ## Solution - <strike>Move `bevy_window`, `bevy_input_focus`, `custom_cursor` features from `default_app` collection to `common_api`</strike> - From `default_app` collection move: `bevy_window` to `common_api`, `bevy_input_focus` to `ui_api`, and `custom_cursor` to `default_platform`. ## Testing - Did you test these changes? If so, how? Confirmed that `default_app` collection no longer introduces the crates to the dependency tree: ```sh $ git checkout bevy/main -q $ cargo tree --no-default-features -Fdefault_app -e normal | grep -e bevy_window -e bevy_input_focus -e custom_cursor ├── bevy_input_focus v0.18.0-dev │ ├── bevy_window v0.18.0-dev ├── bevy_window v0.18.0-dev (*) ├── bevy_input_focus v0.18.0-dev (*) ├── bevy_window v0.18.0-dev (*) $ git checkout reduced-feature-group Previous HEAD position was f8ea309 Add support for reflected math operations ➕➖✖️➗ (#22478) Switched to branch 'reduced-feature-group' $ cargo tree --no-default-features -Fdefault_app -e normal | grep -e bevy_window -e bevy_input_focus -e custom_cursor $ ``` - How can other people (reviewers) test your changes? Is there anything specific they need to know? I'm not sure how cross-cutting changes to features have to be since I haven't worked with such a complicated feature set before, so it's possible I've omitted a change to some place that needs to be updated. Please point it out to me, thank you. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
1 parent 9e85b05 commit cb02e96

3 files changed

Lines changed: 46 additions & 8 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,8 @@ picking = ["bevy_picking", "mesh_picking", "sprite_picking", "ui_picking"]
173173
default_app = [
174174
"async_executor",
175175
"bevy_asset",
176-
"bevy_input_focus",
177176
"bevy_log",
178177
"bevy_state",
179-
"bevy_window",
180-
"custom_cursor",
181178
"reflect_auto_register",
182179
]
183180

@@ -194,6 +191,7 @@ default_platform = [
194191
"webgl2",
195192
"x11",
196193
"wayland",
194+
"custom_cursor",
197195
"sysinfo_plugin",
198196
]
199197

@@ -208,6 +206,7 @@ common_api = [
208206
"bevy_shader",
209207
"bevy_material",
210208
"bevy_text",
209+
"bevy_window",
211210
"hdr",
212211
"png",
213212
]
@@ -252,7 +251,7 @@ common_api = [
252251
]
253252

254253
# COLLECTION: 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.
255-
ui_api = ["default_app", "common_api", "bevy_ui"]
254+
ui_api = ["default_app", "common_api", "bevy_input_focus", "bevy_ui"]
256255

257256
# COLLECTION: Bevy's built-in UI renderer, built on top of `bevy_render`.
258257
ui_bevy_render = [

docs/cargo_features.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ collections to build your own "profile" equivalent, without needing to manually
4141
|audio-all-formats|Enables audio features and all supported formats. **Feature set:** `bevy_audio`, `aac`, `flac`, `mp3`, `mp4`, `vorbis`, `wav`.|
4242
|scene|Features used to compose Bevy scenes. **Feature set:** `bevy_world_serialization`, `bevy_scene`.|
4343
|picking|Enables picking with all backends. **Feature set:** `bevy_picking`, `mesh_picking`, `sprite_picking`, `ui_picking`.|
44-
|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`.|
45-
|default_platform|These are platform support features, such as OS support/features, windowing and input backends, etc. **Feature set:** `std`, `bevy_gilrs`, `bevy_winit`, `bevy_clipboard`, `default_font`, `multi_threaded`, `webgl2`, `x11`, `wayland`, `sysinfo_plugin`.|
46-
|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`.|
44+
|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_log`, `bevy_state`, `reflect_auto_register`.|
45+
|default_platform|These are platform support features, such as OS support/features, windowing and input backends, etc. **Feature set:** `std`, `bevy_gilrs`, `bevy_winit`, `bevy_clipboard`, `default_font`, `multi_threaded`, `webgl2`, `x11`, `wayland`, `custom_cursor`, `sysinfo_plugin`.|
46+
|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`, `bevy_window`, `hdr`, `png`.|
4747
|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`.|
4848
|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`.|
4949
|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`.|
5050
|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`.|
51-
|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_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_input_focus`, `bevy_ui`.|
5252
|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`.|
5353
|default_no_std|Recommended defaults for no_std applications. **Feature set:** `libm`, `critical-section`, `bevy_color`, `bevy_state`.|
5454

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "`bevy_window`, `bevy_input_focus`, `custom_cursor` features moved to alternate feature collections"
3+
pull_requests: [22488]
4+
---
5+
6+
In Bevy 0.18, [feature collections were introduced](https://bevy.org/learn/migration-guides/0-17-to-0-18/#cargo-feature-collections). The `bevy_window`, `bevy_input_focus`, & `custom_cursor` features were included in the `default_app` collection.
7+
8+
In Bevy 0.19, these have been moved from `default_app`:
9+
10+
|Feature |is included in... |
11+
|:----------------:|:-----------------|
12+
|`bevy_window` |`common_api` |
13+
|`bevy_input_focus`|`ui_api` |
14+
|`custom_cursor` |`default_platform`|
15+
16+
This change was made because:
17+
18+
- the `default_app` collection is for core functionality that most apps will need. Scene definition for windowing is not usually required, and
19+
- apps that don't use windowing (ex: command line tools, servers, etc) can compile fewer dependencies.
20+
21+
If you were relying on these being included in `default_app`, you can cherry-pick them into your `Cargo.toml` feature list:
22+
23+
```toml
24+
# 0.18
25+
bevy = { version = "0.18", default-features = false, features = [ "default_app" ] }
26+
27+
# 0.19
28+
bevy = { version = "0.19", default-features = false, features = [
29+
"default_app",
30+
"bevy_window",
31+
"bevy_input_focus",
32+
"custom_cursor"
33+
] }
34+
```
35+
36+
If you already depend on a high-level profile (`2d`, `3d`, `ui`), or a mid-level collection ending in '`_render`' or '`_api`', then you do not need to make any changes.
37+
38+
---
39+
I've erred on the side of hopefully-longer-than-it-needs-to-be.

0 commit comments

Comments
 (0)