-
-
Notifications
You must be signed in to change notification settings - Fork 41
feat!: Add BMSPlugin group, feature flag for bindings per bevy crate & global registration options #408
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
Conversation
…e & global registration options
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.
Pull Request Overview
This PR refactors the BMS plugin system by introducing a new meta plugin (BMSPlugin) that manages individual scripting plugins based on feature flags and global options while updating several integration points and tests.
- Introduce a new plugin group (BMSPlugin) for simplified plugin registration
- Update test harnesses and integration examples to use the new plugin system
- Expand Cargo.toml default features to include sub-feature flags for Bevy bindings
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/lib.rs | Adds the BMSPlugin group using a plugin_group! macro; review syntax |
examples/game_of_life.rs, examples/docgen.rs | Simplifies plugin registration with BMSPlugin |
crates/xtask/src/main.rs | Updates feature flags handling and renames/reorders variants |
crates/testing_crates/script_integration_test_harness/src/lib.rs | Adjusts integration tests to use the new plugin configuration |
crates/bevy_mod_scripting_functions/src/lib.rs and core.rs | Adds default implementation and cleans up plugin finalization code |
crates/bevy_mod_scripting_core and its submodules | Refactors binding registration and globals configuration |
Cargo.toml | Updates default features to include the expanded set of binding flags |
Files not reviewed (1)
- crates/bevy_api_gen/templates/mod.tera: Language not supported
Comments suppressed due to low confidence (1)
crates/bevy_mod_scripting_functions/src/core.rs:239
- The function name 'pre_register_componnents' appears to have a spelling error; consider changing it to 'pre_register_components'.
fn pre_register_componnents(app: &mut App) {
|
Branch | feat/configurable-plugins |
Testbed | linux-gha |
Click to view all benchmark results
Benchmark | Latency | Benchmark Result nanoseconds (ns) (Result Δ%) | Upper Boundary nanoseconds (ns) (Limit %) |
---|---|---|---|
component/access Lua | 📈 view plot 🚷 view threshold | 3,440.80 ns(-30.39%)Baseline: 4,943.12 ns | 6,412.84 ns (53.65%) |
component/access Rhai | 📈 view plot 🚷 view threshold | 5,239.50 ns(-22.37%)Baseline: 6,749.27 ns | 8,127.30 ns (64.47%) |
component/get Lua | 📈 view plot 🚷 view threshold | 2,100.60 ns(-27.64%)Baseline: 2,902.96 ns | 3,590.80 ns (58.50%) |
component/get Rhai | 📈 view plot 🚷 view threshold | 4,006.80 ns(-18.55%)Baseline: 4,919.08 ns | 6,057.24 ns (66.15%) |
conversions/Mut::from | 📈 view plot 🚷 view threshold | 84.39 ns(-38.78%)Baseline: 137.84 ns | 252.64 ns (33.40%) |
conversions/Ref::from | 📈 view plot 🚷 view threshold | 79.90 ns(-41.18%)Baseline: 135.84 ns | 250.68 ns (31.87%) |
conversions/ScriptValue::List | 📈 view plot 🚷 view threshold | 296.25 ns(-54.96%)Baseline: 657.70 ns | 1,093.58 ns (27.09%) |
conversions/ScriptValue::Map | 📈 view plot 🚷 view threshold | 1,199.00 ns(-28.73%)Baseline: 1,682.42 ns | 2,234.27 ns (53.66%) |
conversions/ScriptValue::Reference::from_into | 📈 view plot 🚷 view threshold | 26.25 ns(-36.74%)Baseline: 41.49 ns | 58.57 ns (44.81%) |
conversions/Val::from_into | 📈 view plot 🚷 view threshold | 267.82 ns(-20.98%)Baseline: 338.91 ns | 458.36 ns (58.43%) |
function/call 4 args Lua | 📈 view plot 🚷 view threshold | 1,569.80 ns(-25.50%)Baseline: 2,107.19 ns | 2,537.86 ns (61.86%) |
function/call 4 args Rhai | 📈 view plot 🚷 view threshold | 1,422.50 ns(-22.31%)Baseline: 1,831.05 ns | 2,217.53 ns (64.15%) |
function/call Lua | 📈 view plot 🚷 view threshold | 223.57 ns(-20.55%)Baseline: 281.40 ns | 338.66 ns (66.02%) |
function/call Rhai | 📈 view plot 🚷 view threshold | 422.01 ns(-20.98%)Baseline: 534.06 ns | 667.22 ns (63.25%) |
math/vec mat ops Lua | 📈 view plot 🚷 view threshold | 6,379.70 ns(-18.32%)Baseline: 7,810.30 ns | 9,293.66 ns (68.65%) |
math/vec mat ops Rhai | 📈 view plot 🚷 view threshold | 6,069.70 ns(-18.85%)Baseline: 7,479.73 ns | 8,630.01 ns (70.33%) |
query/10 entities Lua | 📈 view plot 🚷 view threshold | 17,982.00 ns(-27.83%)Baseline: 24,914.78 ns | 30,767.80 ns (58.44%) |
query/10 entities Rhai | 📈 view plot 🚷 view threshold | 18,014.00 ns(-25.76%)Baseline: 24,263.28 ns | 29,237.84 ns (61.61%) |
query/100 entities Lua | 📈 view plot 🚷 view threshold | 38,708.00 ns(-23.01%)Baseline: 50,276.75 ns | 61,717.23 ns (62.72%) |
query/100 entities Rhai | 📈 view plot 🚷 view threshold | 30,821.00 ns(-21.63%)Baseline: 39,327.47 ns | 48,289.46 ns (63.83%) |
query/1000 entities Lua | 📈 view plot 🚷 view threshold | 250,300.00 ns(-19.98%)Baseline: 312,810.00 ns | 388,388.25 ns (64.45%) |
query/1000 entities Rhai | 📈 view plot 🚷 view threshold | 162,860.00 ns(-26.73%)Baseline: 222,271.25 ns | 302,469.49 ns (53.84%) |
reflection/10 Lua | 📈 view plot 🚷 view threshold | 5,387.80 ns(-17.95%)Baseline: 6,566.47 ns | 7,631.85 ns (70.60%) |
reflection/10 Rhai | 📈 view plot 🚷 view threshold | 14,875.00 ns(-9.58%)Baseline: 16,450.47 ns | 18,072.14 ns (82.31%) |
reflection/100 Lua | 📈 view plot 🚷 view threshold | 46,161.00 ns(-13.59%)Baseline: 53,418.22 ns | 60,490.75 ns (76.31%) |
reflection/100 Rhai | 📈 view plot 🚷 view threshold | 720,700.00 ns(-1.79%)Baseline: 733,829.38 ns | 863,908.53 ns (83.42%) |
resource/access Lua | 📈 view plot 🚷 view threshold | 3,108.20 ns(-28.61%)Baseline: 4,353.57 ns | 5,556.15 ns (55.94%) |
resource/access Rhai | 📈 view plot 🚷 view threshold | 4,476.70 ns(-25.79%)Baseline: 6,032.73 ns | 7,568.83 ns (59.15%) |
resource/get Lua | 📈 view plot 🚷 view threshold | 1,709.80 ns(-29.41%)Baseline: 2,422.08 ns | 3,034.01 ns (56.35%) |
resource/get Rhai | 📈 view plot 🚷 view threshold | 3,323.30 ns(-22.18%)Baseline: 4,270.40 ns | 5,392.57 ns (61.63%) |
Summary
Refactors the plugin system for BMS.
BMSPlugin
A meta plugin
BMSPlugin
now manages all of the rest:bevy::plugin_group!
each plugin within is customizableGlobal options
the
CoreScriptGlobalsPlugin
now supports a filter argument for specifying which globals are going to be registeredFeature Flags
a set of sub-feature flags within
bevy_bindings
flag:has been added, which will decide which functions are compiled into the script functions plugin.
Migration Guide
Stop registering individual plugins like
ScriptFunctionsPlugin
andLuaScriptingPlugin
and instead registerBMSPlugin
.If you did not want to include bevy bindings, make sure to disable the
bevy_bindings
feature flag by using BMS without default features, similarly for the core functions.Any customisations to sub-plugins can be performed as usual through the plugin group's
.set(PluginName::default()...)
.The feature flag
bevy_bindings
is replaced by the fine grained feature flags for each bevy module, replace usages of this flag with all the modules you expect to use in scripts.