-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-using transform in other apps requires a lot of deps #13529
Labels
A-Transform
Translations, rotations and scales
C-Usability
A simple quality-of-life change that makes Bevy easier to use
S-Needs-Review
Needs reviewer attention (from anyone!) to move forward
Comments
torsteingrindvik
added
C-Enhancement
A new feature
S-Needs-Triage
This issue needs to be labelled
labels
May 27, 2024
Made a proof of concept PR which reduces the deps, but not entirely sure about the strategy. Waiting until some feedback arrives. |
I'm on board with making |
alice-i-cecile
added
C-Usability
A simple quality-of-life change that makes Bevy easier to use
A-Transform
Translations, rotations and scales
S-Needs-Review
Needs reviewer attention (from anyone!) to move forward
and removed
C-Enhancement
A new feature
S-Needs-Triage
This issue needs to be labelled
labels
May 28, 2024
github-merge-queue bot
pushed a commit
that referenced
this issue
May 31, 2024
# Objective Part of #13529 Helps #13533 Splitting up `bevy_transform` makes it easier to selectively include or exclude parts of it in such a way that it's possible to include only a small part with a small dependency tree. ## Solution Make the crate more modular. --------- Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com> Co-authored-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
github-merge-queue bot
pushed a commit
that referenced
this issue
Jun 1, 2024
# Objective Fixes #13529 Allow using the `bevy_transform` crate for its definitions of `Transform` (and `GlobalTransform`) which are re-usable in many contexts, including ones where other parts of Bevy (ECS, reflection, etc.) are not necessarily needed or wanted due to the big dependency tree. ## Solution Introduce a feature flag "bevy-support" in the `bevy_transform` crate which makes the dependency tree small when default features are off. ## Testing Both `cargo b` and `cargo b --no-default-features` builds. The dependency tree **before**: ```text bevy_transform v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_transform) ├── bevy_app v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_app) │ ├── bevy_derive v0.14.0-dev (proc-macro) (/home/togr/repos/bevy/crates/bevy_derive) │ │ ├── bevy_macro_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_macro_utils) │ │ │ ├── proc-macro2 v1.0.83 │ │ │ │ └── unicode-ident v1.0.12 │ │ │ ├── quote v1.0.36 │ │ │ │ └── proc-macro2 v1.0.83 (*) │ │ │ ├── syn v2.0.65 │ │ │ │ ├── proc-macro2 v1.0.83 (*) │ │ │ │ ├── quote v1.0.36 (*) │ │ │ │ └── unicode-ident v1.0.12 │ │ │ └── toml_edit v0.22.13 │ │ │ ├── indexmap v2.2.6 │ │ │ │ ├── equivalent v1.0.1 │ │ │ │ └── hashbrown v0.14.5 │ │ │ ├── toml_datetime v0.6.6 │ │ │ └── winnow v0.6.8 │ │ ├── quote v1.0.36 (*) │ │ └── syn v2.0.65 (*) │ ├── bevy_ecs v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_ecs) │ │ ├── bevy_ecs_macros v0.14.0-dev (proc-macro) (/home/togr/repos/bevy/crates/bevy_ecs/macros) │ │ │ ├── bevy_macro_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_macro_utils) (*) │ │ │ ├── proc-macro2 v1.0.83 (*) │ │ │ ├── quote v1.0.36 (*) │ │ │ └── syn v2.0.65 (*) │ │ ├── bevy_ptr v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_ptr) │ │ ├── bevy_reflect v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_reflect) │ │ │ ├── bevy_math v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_math) │ │ │ │ ├── approx v0.5.1 │ │ │ │ │ └── num-traits v0.2.19 │ │ │ │ │ [build-dependencies] │ │ │ │ │ └── autocfg v1.3.0 │ │ │ │ ├── glam v0.27.0 │ │ │ │ │ ├── approx v0.5.1 (*) │ │ │ │ │ ├── bytemuck v1.16.0 │ │ │ │ │ ├── rand v0.8.5 │ │ │ │ │ │ └── rand_core v0.6.4 │ │ │ │ │ └── serde v1.0.202 │ │ │ │ │ └── serde_derive v1.0.202 (proc-macro) │ │ │ │ │ ├── proc-macro2 v1.0.83 (*) │ │ │ │ │ ├── quote v1.0.36 (*) │ │ │ │ │ └── syn v2.0.65 (*) │ │ │ │ ├── rand v0.8.5 (*) │ │ │ │ ├── serde v1.0.202 (*) │ │ │ │ ├── smallvec v1.13.2 │ │ │ │ └── thiserror v1.0.61 │ │ │ │ └── thiserror-impl v1.0.61 (proc-macro) │ │ │ │ ├── proc-macro2 v1.0.83 (*) │ │ │ │ ├── quote v1.0.36 (*) │ │ │ │ └── syn v2.0.65 (*) │ │ │ ├── bevy_ptr v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_ptr) │ │ │ ├── bevy_reflect_derive v0.14.0-dev (proc-macro) (/home/togr/repos/bevy/crates/bevy_reflect/derive) │ │ │ │ ├── bevy_macro_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_macro_utils) (*) │ │ │ │ ├── proc-macro2 v1.0.83 (*) │ │ │ │ ├── quote v1.0.36 (*) │ │ │ │ ├── syn v2.0.65 (*) │ │ │ │ └── uuid v1.8.0 │ │ │ │ └── getrandom v0.2.15 │ │ │ │ ├── cfg-if v1.0.0 │ │ │ │ └── libc v0.2.155 │ │ │ ├── bevy_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_utils) │ │ │ │ ├── ahash v0.8.11 │ │ │ │ │ ├── cfg-if v1.0.0 │ │ │ │ │ ├── getrandom v0.2.15 (*) │ │ │ │ │ ├── once_cell v1.19.0 │ │ │ │ │ └── zerocopy v0.7.34 │ │ │ │ │ [build-dependencies] │ │ │ │ │ └── version_check v0.9.4 │ │ │ │ ├── bevy_utils_proc_macros v0.14.0-dev (proc-macro) (/home/togr/repos/bevy/crates/bevy_utils/macros) │ │ │ │ │ ├── proc-macro2 v1.0.83 (*) │ │ │ │ │ ├── quote v1.0.36 (*) │ │ │ │ │ └── syn v2.0.65 (*) │ │ │ │ ├── hashbrown v0.14.5 │ │ │ │ │ ├── ahash v0.8.11 (*) │ │ │ │ │ ├── allocator-api2 v0.2.18 │ │ │ │ │ └── serde v1.0.202 (*) │ │ │ │ ├── thread_local v1.1.8 │ │ │ │ │ ├── cfg-if v1.0.0 │ │ │ │ │ └── once_cell v1.19.0 │ │ │ │ ├── tracing v0.1.40 │ │ │ │ │ ├── pin-project-lite v0.2.14 │ │ │ │ │ └── tracing-core v0.1.32 │ │ │ │ │ └── once_cell v1.19.0 │ │ │ │ └── web-time v0.2.4 │ │ │ ├── downcast-rs v1.2.1 │ │ │ ├── erased-serde v0.4.5 │ │ │ │ ├── serde v1.0.202 (*) │ │ │ │ └── typeid v1.0.0 │ │ │ ├── glam v0.27.0 (*) │ │ │ ├── serde v1.0.202 (*) │ │ │ ├── smallvec v1.13.2 │ │ │ ├── smol_str v0.2.2 │ │ │ └── thiserror v1.0.61 (*) │ │ ├── bevy_tasks v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_tasks) │ │ │ ├── async-executor v1.11.0 │ │ │ │ ├── async-task v4.7.1 │ │ │ │ ├── concurrent-queue v2.5.0 │ │ │ │ │ └── crossbeam-utils v0.8.20 │ │ │ │ ├── fastrand v2.1.0 │ │ │ │ ├── futures-lite v2.3.0 │ │ │ │ │ ├── fastrand v2.1.0 │ │ │ │ │ ├── futures-core v0.3.30 │ │ │ │ │ ├── futures-io v0.3.30 │ │ │ │ │ ├── parking v2.2.0 │ │ │ │ │ └── pin-project-lite v0.2.14 │ │ │ │ └── slab v0.4.9 │ │ │ │ [build-dependencies] │ │ │ │ └── autocfg v1.3.0 │ │ │ └── futures-lite v2.3.0 (*) │ │ ├── bevy_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_utils) (*) │ │ ├── bitflags v2.5.0 │ │ ├── concurrent-queue v2.5.0 (*) │ │ ├── fixedbitset v0.5.7 │ │ ├── nonmax v0.5.5 │ │ ├── petgraph v0.6.5 │ │ │ ├── fixedbitset v0.4.2 │ │ │ └── indexmap v2.2.6 (*) │ │ └── thiserror v1.0.61 (*) │ ├── bevy_reflect v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_reflect) (*) │ ├── bevy_state v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_state) │ │ ├── bevy_ecs v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_ecs) (*) │ │ ├── bevy_reflect v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_reflect) (*) │ │ ├── bevy_state_macros v0.14.0-dev (proc-macro) (/home/togr/repos/bevy/crates/bevy_state/macros) │ │ │ ├── bevy_macro_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_macro_utils) (*) │ │ │ ├── proc-macro2 v1.0.83 (*) │ │ │ ├── quote v1.0.36 (*) │ │ │ └── syn v2.0.65 (*) │ │ └── bevy_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_utils) (*) │ ├── bevy_tasks v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_tasks) (*) │ ├── bevy_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_utils) (*) │ ├── downcast-rs v1.2.1 │ └── thiserror v1.0.61 (*) ├── bevy_ecs v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_ecs) (*) ├── bevy_hierarchy v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_hierarchy) │ ├── bevy_app v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_app) (*) │ ├── bevy_core v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_core) │ │ ├── bevy_app v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_app) (*) │ │ ├── bevy_ecs v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_ecs) (*) │ │ ├── bevy_reflect v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_reflect) (*) │ │ ├── bevy_tasks v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_tasks) (*) │ │ ├── bevy_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_utils) (*) │ │ └── uuid v1.8.0 │ ├── bevy_ecs v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_ecs) (*) │ ├── bevy_reflect v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_reflect) (*) │ ├── bevy_utils v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_utils) (*) │ └── smallvec v1.13.2 ├── bevy_math v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_math) (*) ├── bevy_reflect v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_reflect) (*) └── thiserror v1.0.61 (*) ``` The dependency tree **after** (no default features): ```text bevy_transform v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_transform) ├── bevy_math v0.14.0-dev (/home/togr/repos/bevy/crates/bevy_math) │ ├── approx v0.5.1 │ │ └── num-traits v0.2.19 │ │ [build-dependencies] │ │ └── autocfg v1.3.0 │ ├── glam v0.27.0 │ │ ├── approx v0.5.1 (*) │ │ ├── bytemuck v1.16.0 │ │ └── rand v0.8.5 │ │ └── rand_core v0.6.4 │ ├── rand v0.8.5 (*) │ ├── smallvec v1.13.2 │ └── thiserror v1.0.61 │ └── thiserror-impl v1.0.61 (proc-macro) │ ├── proc-macro2 v1.0.83 │ │ └── unicode-ident v1.0.12 │ ├── quote v1.0.36 │ │ └── proc-macro2 v1.0.83 (*) │ └── syn v2.0.65 │ ├── proc-macro2 v1.0.83 (*) │ ├── quote v1.0.36 (*) │ └── unicode-ident v1.0.12 └── thiserror v1.0.61 (*) ``` Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com> Co-authored-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Transform
Translations, rotations and scales
C-Usability
A simple quality-of-life change that makes Bevy easier to use
S-Needs-Review
Needs reviewer attention (from anyone!) to move forward
What problem does this solve or what need does it fill?
I like
Transform
and its API and I'd like to re-use it in an app where the users don't care about the rest of Bevy.In other words that app would only have
bevy_transform
from Bevy's crates as a dep.However that means getting a lot of other deps: https://github.com/bevyengine/bevy/blob/main/crates/bevy_transform/Cargo.toml#L13-L21
I feel the glam types are a nice common denominator in the Rust ecosystem for matrices and vectors, and I would love
Transform
to be available in a similar way.What solution would you like?
From the definition of transform:
it might be feasible to hide the
bevy_ecs
parts (Component
) andbevy_reflect
parts (Reflect
and#[reflect(...)]
) behind#[cfg_attr(...)]
like for serde.This then would allow those deps to be optional.
To not make too much noise those could be enabled by default features.
What alternative(s) have you considered?
Just keeping things as-is and having too many deps.
The text was updated successfully, but these errors were encountered: