Skip to content

Commit

Permalink
Remove deprecated bevy_dynamic_plugin (#14534)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
BD103 authored Jul 30, 2024
1 parent 9575b20 commit d722fef
Show file tree
Hide file tree
Showing 15 changed files with 2 additions and 219 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ bevy_core_pipeline = [
"bevy_render",
]

# Plugin for dynamic loading (using [libloading](https://crates.io/crates/libloading))
bevy_dynamic_plugin = ["bevy_internal/bevy_dynamic_plugin"]

# Adds gamepad support
bevy_gilrs = ["bevy_internal/bevy_gilrs"]

Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ mod sub_app;
mod terminal_ctrl_c_handler;

pub use app::*;
pub use bevy_derive::DynamicPlugin;
pub use main_schedule::*;
pub use panic_handler::*;
pub use plugin::*;
Expand All @@ -38,6 +37,6 @@ pub mod prelude {
PostStartup, PostUpdate, PreStartup, PreUpdate, SpawnScene, Startup, Update,
},
sub_app::SubApp,
DynamicPlugin, Plugin, PluginGroup,
Plugin, PluginGroup,
};
}
10 changes: 0 additions & 10 deletions crates/bevy_app/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,6 @@ impl Plugin for PlaceholderPlugin {
fn build(&self, _app: &mut App) {}
}

/// A type representing an unsafe function that returns a mutable pointer to a [`Plugin`].
/// It is used for dynamically loading plugins.
///
/// See `bevy_dynamic_plugin/src/loader.rs#dynamically_load_plugin`.
#[deprecated(
since = "0.14.0",
note = "The current dynamic plugin system is unsound and will be removed in 0.15."
)]
pub type CreatePlugin = unsafe fn() -> *mut dyn Plugin;

/// Types that represent a set of [`Plugin`]s.
///
/// This is implemented for all types which implement [`Plugin`],
Expand Down
22 changes: 0 additions & 22 deletions crates/bevy_derive/src/app_plugin.rs

This file was deleted.

14 changes: 0 additions & 14 deletions crates/bevy_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

extern crate proc_macro;

mod app_plugin;
mod bevy_main;
mod derefs;
mod enum_variant_meta;
Expand All @@ -18,19 +17,6 @@ use bevy_macro_utils::{derive_label, BevyManifest};
use proc_macro::TokenStream;
use quote::format_ident;

/// Generates a dynamic plugin entry point function for the given `Plugin` type.
///
/// This is deprecated since 0.14. The current dynamic plugin system is unsound and will be removed in 0.15.
#[proc_macro_derive(DynamicPlugin)]
#[deprecated(
since = "0.14.0",
note = "The current dynamic plugin system is unsound and will be removed in 0.15."
)]
pub fn derive_dynamic_plugin(input: TokenStream) -> TokenStream {
#[allow(deprecated)]
app_plugin::derive_dynamic_plugin(input)
}

/// Implements [`Deref`] for structs. This is especially useful when utilizing the [newtype] pattern.
///
/// For single-field structs, the implementation automatically uses that field.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_diagnostic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sysinfo = { version = "0.30.0", optional = true, default-features = false, featu
"apple-app-store",
] }

# Only include when not bevy_dynamic_plugin and on linux/windows/android
# Only include when on linux/windows/android
[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "android"))'.dependencies]
sysinfo = { version = "0.30.0", optional = true, default-features = false }

Expand Down
24 changes: 0 additions & 24 deletions crates/bevy_dynamic_plugin/Cargo.toml

This file was deleted.

7 changes: 0 additions & 7 deletions crates/bevy_dynamic_plugin/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions crates/bevy_dynamic_plugin/src/lib.rs

This file was deleted.

86 changes: 0 additions & 86 deletions crates/bevy_dynamic_plugin/src/loader.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ bevy_audio = { path = "../bevy_audio", optional = true, version = "0.15.0-dev" }
bevy_color = { path = "../bevy_color", optional = true, version = "0.15.0-dev" }
bevy_core_pipeline = { path = "../bevy_core_pipeline", optional = true, version = "0.15.0-dev" }
bevy_dev_tools = { path = "../bevy_dev_tools", optional = true, version = "0.15.0-dev" }
bevy_dynamic_plugin = { path = "../bevy_dynamic_plugin", optional = true, version = "0.15.0-dev" }
bevy_gilrs = { path = "../bevy_gilrs", optional = true, version = "0.15.0-dev" }
bevy_gizmos = { path = "../bevy_gizmos", optional = true, version = "0.15.0-dev", default-features = false }
bevy_gltf = { path = "../bevy_gltf", optional = true, version = "0.15.0-dev" }
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_internal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ pub use bevy_core_pipeline as core_pipeline;
#[cfg(feature = "bevy_dev_tools")]
pub use bevy_dev_tools as dev_tools;
pub use bevy_diagnostic as diagnostic;
#[cfg(feature = "bevy_dynamic_plugin")]
pub use bevy_dynamic_plugin as dynamic_plugin;
pub use bevy_ecs as ecs;
#[cfg(feature = "bevy_gilrs")]
pub use bevy_gilrs as gilrs;
Expand Down
4 changes: 0 additions & 4 deletions crates/bevy_internal/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ pub use crate::text::prelude::*;
#[cfg(feature = "bevy_ui")]
pub use crate::ui::prelude::*;

#[doc(hidden)]
#[cfg(feature = "bevy_dynamic_plugin")]
pub use crate::dynamic_plugin::*;

#[doc(hidden)]
#[cfg(feature = "bevy_gizmos")]
pub use crate::gizmos::prelude::*;
Expand Down
1 change: 0 additions & 1 deletion docs/cargo_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ The default feature set enables most of the expected features of a game engine,
|bevy_ci_testing|Enable systems that allow for automated testing on CI|
|bevy_debug_stepping|Enable stepping-based debugging of Bevy systems|
|bevy_dev_tools|Provides a collection of developer tools|
|bevy_dynamic_plugin|Plugin for dynamic loading (using [libloading](https://crates.io/crates/libloading))|
|bmp|BMP image format support|
|dds|DDS compressed texture support|
|debug_glam_assert|Enable assertions in debug builds to check the validity of parameters passed to glam|
Expand Down
1 change: 0 additions & 1 deletion tools/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ crates=(
bevy_app
bevy_time
bevy_log
bevy_dynamic_plugin
bevy_asset/macros
bevy_asset
bevy_audio
Expand Down

0 comments on commit d722fef

Please sign in to comment.