-
-
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
Deprecate dynamic plugins #13080
Deprecate dynamic plugins #13080
Conversation
I've added the "needs release notes" label, though I can be convinced otherwise. I don't know how large of an impact this change will make. |
852fc12
to
9b6ef6f
Compare
Previously attempted in #3893 See #3893 (comment) for Cart's opinion at the time. My position remains about the same as it was then:
Given the presence of testing showing indications of UB during reasonable use, I think now's as good a time as any to officially drop support. |
maybe the deprecated comment could redirect to something like "go comment on this pr if you see this message" to encourage potential users to report back |
I'd also like to express my support for this change. Aside from the correctness issues, the current version also effectively blocks some advanced plugin build ordering/order-independence features. |
I added a deprecation notice in 1b97d99. Hopefully if the alternatives listed do not support someone's use-case, they will comment here. (It may help designing a new API!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this makes sense. working with this crate requires a lot of finesse, and from my woes a few years 👀 ago, once you have the conceptual understanding needed to use this crate, its really not very much work to implement it from scratch yourself.
I am sorry, how again is this controversial? I haven't seen any comment indicating such. |
This was controversial the last time it was tried, which makes this sort of controversial-by-default. |
@cart disagreed with this change last time it was attempted. (#3893 (comment)) No one has picked up dynamic plugins and tried to improve it since deprecating it was last attempted. Furthermore, I think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I relent. A bit bummed that we're removing useful baseline functionality, but I agree that using it soundly is hard and that exposes people to risk. I won't fight this anymore :)
# Objective - The current implementation for dynamic plugins is unsound. Please see bevyengine#11969 for background and justification. - Closes bevyengine#11969 and closes bevyengine#13073. ## Solution - Deprecate all dynamic plugin items for Bevy 0.14, with plans to remove them for Bevy 0.15. ## Discussion One thing I want to make clear is that I'm not opposed to dynamic plugins _in general_. I think they can be handy, especially for DLC and modding, but I think the current system is the wrong approach. It's too much of a footgun for the meager benefit is provides. --- ## Changelog - Deprecated the current dynamic plugin system. - Dynamic plugins will be removed in Bevy 0.15. For now you can continue using them by marking your code with `#[allow(deprecated)]`. ## Migration Guide If possible, remove all usage of dynamic plugins. ```rust // Old #[derive(DynamicPlugin)] pub struct MyPlugin; App::new() .load_plugin("path/to/plugin") .run(); // New pub struct MyPlugin; App::new() .add_plugins(MyPlugin) .run(); ``` If you are unable to do that, you may temporarily silence the deprecation warnings. ```rust #[allow(deprecated)] ``` Please note that the current dynamic plugin system will be removed by the next major Bevy release, so you will have to migrate eventually. You may be interested in these safer alternatives: - [Bevy Assets - Scripting]: Scripting and modding libraries for Bevy - [Bevy Assets - Development tools]: Hot reloading and other development functionality - [`stabby`]: Stable Rust ABI [Bevy Assets - Scripting]: https://bevyengine.org/assets/#scripting [Bevy Assets - Development tools]: https://bevyengine.org/assets/#development-tools [`stabby`]: https://github.com/ZettaScaleLabs/stabby
Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to bevyengine/bevy-website#1321 if you'd like to help out. |
# Objective - Dynamic plugins were deprecated in #13080 due to being unsound. The plan was to deprecate them in 0.14 and remove them in 0.15. ## Solution - Remove all dynamic plugin functionality. - Update documentation to reflect this change. --- ## Migration Guide Dynamic plugins were deprecated in 0.14 for being unsound, and they have now been fully removed. Please consider using the alternatives listed in the `bevy_dynamic_plugin` crate documentation, or worst-case scenario you may copy the code from 0.14.
Currently this doesn't work. The TypeIds of things in different binaries are different, so all the bevy reflecty things break. Depends on: - bevyengine/bevy#13080 - bevyengine/bevy#8390 - bevyengine/bevy#32
It is disappointing to see that dynamic plugins are deprecated and unavailable because in my opinion, this is the absolute most important feature we need for a proper bevy editor. Without this, bevy editor plugins need to be hardcoded in the TOML file (correct?) which seems like a bad solution. |
You can still do dynamic plugins. If necessary by literally copying the code that was removed here into your own code.
The code that was removed here doesn't help much for a bevy editor I would think. It fundamentally requires you to link against the exact same libbevy_dynamic.so (and all .rmeta files for all (in)direct dependencies of bevy) compiled by the exact same rustc version, which you can basically only guarantee if you compile the editor yourself, at which point editing Cargo.toml for the editor wouldn't be much worse. Having actually usable editor plugins would require reflection and either something like stabby or wasm, neither of which would be able to benefit from the code that was removed in this PR anyway. Disclaimer: This is my personal opinion and not representing that of any of the Bevy developers. |
Agreed with @bjorn3. If we truly want dynamic plugins for the editor, there are better ways to accomplish that than this removed code. (For example, what if editor plugins were distributed as WASM files? We could load and run them in a safe, sandboxed runtime with greater protections than dynamic linking.) |
Objective
bevy_dynamic_plugin
implementation #11969 for background and justification.bevy_dynamic_plugin
implementation #11969 and closes User-mode data execution prevention (DEP) violation when loading Dynamic Plugins #13073 and closes Unloading/reloading dynamic plugins #4843.Solution
Discussion
One thing I want to make clear is that I'm not opposed to dynamic plugins in general. I think they can be handy, especially for DLC and modding, but I think the current system is the wrong approach. It's too much of a footgun for the meager benefit is provides.
Changelog
#[allow(deprecated)]
.Migration Guide
If possible, remove all usage of dynamic plugins.
If you are unable to do that, you may temporarily silence the deprecation warnings.
#[allow(deprecated)]
Please note that the current dynamic plugin system will be removed by the next major Bevy release, so you will have to migrate eventually. You may be interested in these safer alternatives:
stabby
: Stable Rust ABI