Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/bevy_mod_scripting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
RUST_BACKTRACE=1

concurrency:
# Use github.run_id on main branch
Expand Down
51 changes: 37 additions & 14 deletions assets/tests/add_system/added_systems_run_in_parallel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,46 @@ digraph {
node_5 [label="bevy_mod_scripting_core::handler::script_error_logger"];
node_6 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_7 [label="script_integration_test_harness::dummy_post_update_system"];
node_8 [label="on_test_post_update"];
node_9 [label="custom_system_a"];
node_10 [label="custom_system_b"];
node_11 [label="SystemSet AssetEvents"];
node_12 [label="SystemSet GarbageCollection"];
node_13 [label="SystemSet ScriptSystem(custom_system_a)"];
node_14 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_12 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_13 [color=red, label="child of", arrowhead=diamond];
node_10 -> node_14 [color=red, label="child of", arrowhead=diamond];
node_8 [label="bevy_mod_scripting_core::pipeline::start::filter_script_attachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_9 [label="bevy_mod_scripting_core::pipeline::start::filter_script_detachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_10 [label="bevy_mod_scripting_core::pipeline::start::filter_script_modifications<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_11 [label="bevy_mod_scripting_core::pipeline::start::process_attachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_12 [label="bevy_mod_scripting_core::pipeline::start::process_detachments<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_13 [label="bevy_mod_scripting_core::pipeline::start::process_asset_modifications<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_14 [label="bevy_mod_scripting_core::pipeline::automatic_pipeline_runner<bevy_mod_scripting_lua::LuaScriptingPlugin>"];
node_15 [label="on_test_post_update"];
node_16 [label="custom_system_a"];
node_17 [label="custom_system_b"];
node_18 [label="SystemSet AssetEvents"];
node_19 [label="SystemSet GarbageCollection"];
node_20 [label="SystemSet ListeningPhase"];
node_21 [label="SystemSet MachineStartPhase"];
node_22 [label="SystemSet ScriptSystem(custom_system_a)"];
node_23 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_8 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_10 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_11 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_12 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_13 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_16 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_17 -> node_23 [color=red, label="child of", arrowhead=diamond];
node_6 -> node_7 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_9 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_11 -> node_12 [color=blue, label="runs before", arrowhead=normal];
node_12 -> node_13 [color=blue, label="runs before", arrowhead=normal];
node_15 -> node_16 [color=blue, label="runs before", arrowhead=normal];
node_15 -> node_17 [color=blue, label="runs before", arrowhead=normal];
node_20 -> node_21 [color=blue, label="runs before", arrowhead=normal];
node_21 -> node_14 [color=blue, label="runs before", arrowhead=normal];
}
]]
assert_str_eq(dot_graph, expected_dot_graph, "Expected the schedule graph to match the expected graph")
Expand Down
51 changes: 37 additions & 14 deletions assets/tests/add_system/added_systems_run_in_parallel.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,46 @@ digraph {
node_5 [label="bevy_mod_scripting_core::handler::script_error_logger"];
node_6 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_7 [label="script_integration_test_harness::dummy_post_update_system"];
node_8 [label="on_test_post_update"];
node_9 [label="custom_system_a"];
node_10 [label="custom_system_b"];
node_11 [label="SystemSet AssetEvents"];
node_12 [label="SystemSet GarbageCollection"];
node_13 [label="SystemSet ScriptSystem(custom_system_a)"];
node_14 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_12 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_13 [color=red, label="child of", arrowhead=diamond];
node_10 -> node_14 [color=red, label="child of", arrowhead=diamond];
node_8 [label="bevy_mod_scripting_core::pipeline::start::filter_script_attachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_9 [label="bevy_mod_scripting_core::pipeline::start::filter_script_detachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_10 [label="bevy_mod_scripting_core::pipeline::start::filter_script_modifications<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_11 [label="bevy_mod_scripting_core::pipeline::start::process_attachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_12 [label="bevy_mod_scripting_core::pipeline::start::process_detachments<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_13 [label="bevy_mod_scripting_core::pipeline::start::process_asset_modifications<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_14 [label="bevy_mod_scripting_core::pipeline::automatic_pipeline_runner<bevy_mod_scripting_rhai::RhaiScriptingPlugin>"];
node_15 [label="on_test_post_update"];
node_16 [label="custom_system_a"];
node_17 [label="custom_system_b"];
node_18 [label="SystemSet AssetEvents"];
node_19 [label="SystemSet GarbageCollection"];
node_20 [label="SystemSet ListeningPhase"];
node_21 [label="SystemSet MachineStartPhase"];
node_22 [label="SystemSet ScriptSystem(custom_system_a)"];
node_23 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_18 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_19 [color=red, label="child of", arrowhead=diamond];
node_8 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_10 -> node_20 [color=red, label="child of", arrowhead=diamond];
node_11 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_12 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_13 -> node_21 [color=red, label="child of", arrowhead=diamond];
node_16 -> node_22 [color=red, label="child of", arrowhead=diamond];
node_17 -> node_23 [color=red, label="child of", arrowhead=diamond];
node_6 -> node_7 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_8 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_9 -> node_10 [color=blue, label="runs before", arrowhead=normal];
node_11 -> node_12 [color=blue, label="runs before", arrowhead=normal];
node_12 -> node_13 [color=blue, label="runs before", arrowhead=normal];
node_15 -> node_16 [color=blue, label="runs before", arrowhead=normal];
node_15 -> node_17 [color=blue, label="runs before", arrowhead=normal];
node_20 -> node_21 [color=blue, label="runs before", arrowhead=normal];
node_21 -> node_14 [color=blue, label="runs before", arrowhead=normal];
}`;

assert_str_eq.call(dot_graph, expected_dot_graph, "Expected the schedule graph to match the expected graph");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SetCurrentLanguage language="@this_script_language"
InstallPlugin
InstallPlugin miliseconds_budget=999999
SetupHandler OnTest=null, Update=null
SetupHandler OnTestPostUpdate=null, PostUpdate=null
SetupHandler Last=null, OnTestLast=null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SetCurrentLanguage language="@this_script_language"
InstallPlugin
InstallPlugin miliseconds_budget=999999
SetupHandler OnTest=null, Update=null
SetupHandler OnTestPostUpdate=null, PostUpdate=null
SetupHandler Last=null, OnTestLast=null
Expand Down
4 changes: 3 additions & 1 deletion assets/tests/lifecycle/shared/entity_script/scenario.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ AssertCallbackSuccess attachment="EntityScript", label="OnScriptLoaded", script=
AssertCallbackSuccess attachment="EntityScript", label="OnScriptReloaded", script="script_a", entity="test_entity_a", expect_string_value="reloaded with: unloaded!"
AssertNoCallbackResponsesEmitted

// load licecycle_b.lua, which prefixes all outputs with "B"
// load licecycle_b.lua, which prefixes all outputs with "B", the unload callback is called using the old script's state
LoadScriptAs as_name="script_b", path="lifecycle_b.lua"
WaitForScriptLoaded name="script_b"
SpawnEntityWithScript name="test_entity_b", script="script_b"
RunUpdateOnce
AssertCallbackSuccess attachment="EntityScript", label="OnScriptUnloaded", script="script_b", entity="test_entity_b", expect_string_value="unloaded!"
AssertCallbackSuccess attachment="EntityScript", label="OnScriptLoaded", script="script_b", entity="test_entity_b", expect_string_value="B: loaded!"
AssertCallbackSuccess attachment="EntityScript", label="OnScriptReloaded", script="script_b", entity="test_entity_b", expect_string_value="B: reloaded with: unloaded!"
AssertNoCallbackResponsesEmitted

// reload script_b, with the same content
Expand Down
2 changes: 2 additions & 0 deletions assets/tests/lifecycle/shared/static_script/scenario.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ LoadScriptAs as_name="script_b", path="lifecycle_b.lua"
WaitForScriptLoaded name="script_b"
AttachStaticScript script="script_b"
RunUpdateOnce
AssertCallbackSuccess attachment="StaticScript", label="OnScriptUnloaded", script="script_b", expect_string_value="unloaded!"
AssertCallbackSuccess attachment="StaticScript", label="OnScriptLoaded", script="script_b", expect_string_value="B: loaded!"
AssertCallbackSuccess attachment="StaticScript", label="OnScriptReloaded", script="script_b", expect_string_value="B: reloaded with: unloaded!"
AssertNoCallbackResponsesEmitted

// reload script_b, with the same content
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/scenario.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SetCurrentLanguage language="@this_script_language"
InstallPlugin
InstallPlugin miliseconds_budget=999999
SetupHandler OnTest=null, Update=null
SetupHandler OnTestPostUpdate=null, PostUpdate=null
SetupHandler Last=null, OnTestLast=null
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_mod_scripting_asset/src/script_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy_reflect::Reflect;
use crate::Language;

/// Represents a script loaded into memory as an asset
#[derive(Asset, Clone, Reflect)]
#[derive(Asset, Clone, Reflect, Default)]
#[reflect(opaque)]
pub struct ScriptAsset {
/// The body of the script
Expand Down
202 changes: 0 additions & 202 deletions crates/bevy_mod_scripting_core/src/asset.rs

This file was deleted.

Loading
Loading