-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Third-party plugin docs should encourage more granular dependencies #6913
Comments
I'm on board with this strategy.
This is a good compromise, and something I do for my examples and integration tests already. |
depending on sub crates in plugins makes patching Bevy a lot more painful instead of [patch.crates-io]
bevy = { git = "https://github.com/bevyengine/bevy" } you end up with [patch.crates-io]
# still patch the global crate for your own dependency on Bevy as a game
bevy = { git = "https://github.com/bevyengine/bevy" }
# also patch all subcrates to patch plugins
bevy_animation = { git = "https://github.com/bevyengine/bevy" }
bevy_app = { git = "https://github.com/bevyengine/bevy" }
bevy_asset = { git = "https://github.com/bevyengine/bevy" }
bevy_audio = { git = "https://github.com/bevyengine/bevy" }
bevy_core = { git = "https://github.com/bevyengine/bevy" }
bevy_core_pipeline = { git = "https://github.com/bevyengine/bevy" }
bevy_derive = { git = "https://github.com/bevyengine/bevy" }
bevy_diagnostic = { git = "https://github.com/bevyengine/bevy" }
bevy_ecs = { git = "https://github.com/bevyengine/bevy" }
bevy_encase_derive = { git = "https://github.com/bevyengine/bevy" }
bevy_gilrs = { git = "https://github.com/bevyengine/bevy" }
bevy_gltf = { git = "https://github.com/bevyengine/bevy" }
bevy_hierarchy = { git = "https://github.com/bevyengine/bevy" }
bevy_input = { git = "https://github.com/bevyengine/bevy" }
bevy_internal = { git = "https://github.com/bevyengine/bevy" }
bevy_log = { git = "https://github.com/bevyengine/bevy" }
bevy_macro_utils = { git = "https://github.com/bevyengine/bevy" }
bevy_math = { git = "https://github.com/bevyengine/bevy" }
bevy_mikktspace = { git = "https://github.com/bevyengine/bevy" }
bevy_pbr = { git = "https://github.com/bevyengine/bevy" }
bevy_ptr = { git = "https://github.com/bevyengine/bevy" }
bevy_reflect = { git = "https://github.com/bevyengine/bevy" }
bevy_render = { git = "https://github.com/bevyengine/bevy" }
bevy_scene = { git = "https://github.com/bevyengine/bevy" }
bevy_sprite = { git = "https://github.com/bevyengine/bevy" }
bevy_tasks = { git = "https://github.com/bevyengine/bevy" }
bevy_text = { git = "https://github.com/bevyengine/bevy" }
bevy_time = { git = "https://github.com/bevyengine/bevy" }
bevy_transform = { git = "https://github.com/bevyengine/bevy" }
bevy_ui = { git = "https://github.com/bevyengine/bevy" }
bevy_utils = { git = "https://github.com/bevyengine/bevy" }
bevy_window = { git = "https://github.com/bevyengine/bevy" }
bevy_winit = { git = "https://github.com/bevyengine/bevy" } We currently don't have a place to document that. Patching Bevy comes up often enough that it would be nice to have somewhere. |
This cost is only on clean compile |
How does this interact with |
@mockersf not every third party crate requires access to the full breadth of the engine. In practice, most of the ones I've seen only use a handful of first party crates. Even the rendering focused ones usually only need 3-5 first party dependencies. Doesn't seem all that impractical to me.
The clean compile is the first experience users have with the engine right now, and also vital for fully auditable/reproducible builds. I wouldn't discount the importance of optimizing the collective dependency tree on that alone.
That's a good point. It would lose meaning as the plugin would compile against the static versions of crates and end up incompatible or invoke UB after a reload of some kind. Not sure how to reconcile that. |
Ha then that's actually worse, to patch Bevy you'll need to go check in each of your plugins on which sub crates they really depend. |
I'd say it's better than blanket patching every crate in the workspace, not worse. If you're patching first party crates, you're already diving deep into the internals for the third party plugin, bevy itself, or both, and will dig for what you need. This is typically done as a temporary measure to test a change or prep a plugin crate update, and not a permanent feed-forward patch users are maintaining. I was also under the impression that we were already breaking patching first party crates with |
I don't think blanket patching is nice, but having to pick up manually all the dependencies of your plugins is worse.
Or as permanent vendored dependency.
It doesn't break patching, it makes creating a patchable version more involved. Once someone created a patchable version, patching is as easy as ever. Also, please note I'm not saying this is a blocker if we want to go down that path, but it needs to be documented somewhere. |
How can Bevy's documentation be improved?
The current third-party plugin guidelines suggest using
bevy
as the core dependency. This potentially introduces a heavy compile time bottleneck on the top level crate, which is exacerbated as there are some heavy dependencies in tree (i.e.serde
andwgpu
). This is likely to get progressively worse as the size and complexity of first party crates grows along with the ecosystem. Likewise, it also encourages plugin developers to target features onbevy
instead of individual crates, leading to issues like #5753. To avoid this bottleneck, we should encourage plugin developers to directly depend on lower levelbevy_*
crates instead.As @mockersf has noted here, this does break potential discoverability via https://lib.rs/crates/bevy/rev. This is, however, potentially mitigated by encouraging plugin developers to take
bevy
on as a dev-dependency instead, for ease of use when making examples and tests.The text was updated successfully, but these errors were encountered: