Skip to content

Commit

Permalink
Make bevy_reflect feature of bevy_math non-default (bevyengine#16938
Browse files Browse the repository at this point in the history
)

# Objective

bevy_reflect is a big part of bevy_math's dependency footprint, and is
often not useful when using bevy_math standalone (as I often do). The
goal with this PR is to avoid pulling in those dependencies by default
without compromising the usability of bevy_math types within Bevy
proper.

## Solution

`bevy_reflect` has been removed from default features of `bevy_math`.
However, the feature is enabled by `bevy_internal`, so that
`bevy_reflect` is enabled when `bevy_math` is used through `bevy`.

Philosophically, if there were a feature flag toggling reflection on
`bevy` globally, then whether `bevy_math` enabled `bevy_reflect` itself
would depend on that, but that doesn't exist for the time being.

## Testing

It compiles :)

## Migration Guide

`bevy_reflect` has been made a non-default feature of `bevy_math`. (It
is still enabled when `bevy_math` is used through `bevy`.) You may need
to enable this feature if you are using `bevy_math` on its own and
desire for the types it exports to implement `Reflect` and other
reflection traits.
  • Loading branch information
mweatherley authored and pcwalton committed Dec 25, 2024
1 parent cd8d3ef commit b27681d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.15.0-dev" }
bevy_input = { path = "../bevy_input", version = "0.15.0-dev" }
bevy_input_focus = { path = "../bevy_input_focus", version = "0.15.0-dev" }
bevy_log = { path = "../bevy_log", version = "0.15.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.15.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.15.0-dev", features = [
"bevy_reflect",
] }
bevy_ptr = { path = "../bevy_ptr", version = "0.15.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [
"bevy",
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bevy_math = { path = ".", version = "0.15.0-dev", default-features = false, feat
glam = { version = "0.29", default-features = false, features = ["approx"] }

[features]
default = ["std", "rand", "bevy_reflect", "curve"]
default = ["std", "rand", "curve"]
std = [
"alloc",
"glam/std",
Expand Down

0 comments on commit b27681d

Please sign in to comment.