mirror of
https://github.com/bevyengine/bevy.git
synced 2026-05-06 06:06:42 -04:00
Move bevy_window, bevy_input_focus, custom_cursor features to alternate feature collections (#22488)
Related: Cargo Feature Collections
https://github.com/bevyengine/bevy/pull/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 f8ea30965 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>
This commit is contained in:
+3
-4
@@ -173,11 +173,8 @@ picking = ["bevy_picking", "mesh_picking", "sprite_picking", "ui_picking"]
|
||||
default_app = [
|
||||
"async_executor",
|
||||
"bevy_asset",
|
||||
"bevy_input_focus",
|
||||
"bevy_log",
|
||||
"bevy_state",
|
||||
"bevy_window",
|
||||
"custom_cursor",
|
||||
"reflect_auto_register",
|
||||
]
|
||||
|
||||
@@ -194,6 +191,7 @@ default_platform = [
|
||||
"webgl2",
|
||||
"x11",
|
||||
"wayland",
|
||||
"custom_cursor",
|
||||
"sysinfo_plugin",
|
||||
]
|
||||
|
||||
@@ -208,6 +206,7 @@ common_api = [
|
||||
"bevy_shader",
|
||||
"bevy_material",
|
||||
"bevy_text",
|
||||
"bevy_window",
|
||||
"hdr",
|
||||
"png",
|
||||
]
|
||||
@@ -252,7 +251,7 @@ common_api = [
|
||||
]
|
||||
|
||||
# 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.
|
||||
ui_api = ["default_app", "common_api", "bevy_ui"]
|
||||
ui_api = ["default_app", "common_api", "bevy_input_focus", "bevy_ui"]
|
||||
|
||||
# COLLECTION: Bevy's built-in UI renderer, built on top of `bevy_render`.
|
||||
ui_bevy_render = [
|
||||
|
||||
@@ -41,14 +41,14 @@ collections to build your own "profile" equivalent, without needing to manually
|
||||
|audio-all-formats|Enables audio features and all supported formats. **Feature set:** `bevy_audio`, `aac`, `flac`, `mp3`, `mp4`, `vorbis`, `wav`.|
|
||||
|scene|Features used to compose Bevy scenes. **Feature set:** `bevy_world_serialization`, `bevy_scene`.|
|
||||
|picking|Enables picking with all backends. **Feature set:** `bevy_picking`, `mesh_picking`, `sprite_picking`, `ui_picking`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|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`.|
|
||||
|default_no_std|Recommended defaults for no_std applications. **Feature set:** `libm`, `critical-section`, `bevy_color`, `bevy_state`.|
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: "`bevy_window`, `bevy_input_focus`, `custom_cursor` features moved to alternate feature collections"
|
||||
pull_requests: [22488]
|
||||
---
|
||||
|
||||
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.
|
||||
|
||||
In Bevy 0.19, these have been moved from `default_app`:
|
||||
|
||||
|Feature |is included in... |
|
||||
|:----------------:|:-----------------|
|
||||
|`bevy_window` |`common_api` |
|
||||
|`bevy_input_focus`|`ui_api` |
|
||||
|`custom_cursor` |`default_platform`|
|
||||
|
||||
This change was made because:
|
||||
|
||||
- the `default_app` collection is for core functionality that most apps will need. Scene definition for windowing is not usually required, and
|
||||
- apps that don't use windowing (ex: command line tools, servers, etc) can compile fewer dependencies.
|
||||
|
||||
If you were relying on these being included in `default_app`, you can cherry-pick them into your `Cargo.toml` feature list:
|
||||
|
||||
```toml
|
||||
# 0.18
|
||||
bevy = { version = "0.18", default-features = false, features = [ "default_app" ] }
|
||||
|
||||
# 0.19
|
||||
bevy = { version = "0.19", default-features = false, features = [
|
||||
"default_app",
|
||||
"bevy_window",
|
||||
"bevy_input_focus",
|
||||
"custom_cursor"
|
||||
] }
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
---
|
||||
I've erred on the side of hopefully-longer-than-it-needs-to-be.
|
||||
Reference in New Issue
Block a user