Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6bae518
Upgrade to bevy 0.16
alexparlett May 22, 2025
922ab68
Merge branch 'main' into bevy_0.16
alexparlett May 25, 2025
f1a200b
Fix compile issues not seen when using as branch
alexparlett May 26, 2025
802c864
Update bevy_console
alexparlett May 29, 2025
616fc89
Merge remote-tracking branch 'origin/main' into bevy_0.16
makspll Jul 3, 2025
5f9fb52
make codegen work
makspll Jul 5, 2025
82f8e94
small refactor
makspll Jul 5, 2025
22a41b8
actually skip functions with generics that don't appear as types
makspll Jul 5, 2025
6f8a0f3
try make xtask work properly again
makspll Jul 6, 2025
63c6b01
cargo fmt
makspll Jul 6, 2025
2515b5e
remove xtask changes from PR
makspll Jul 6, 2025
65f8fb5
Merge remote-tracking branch 'origin/main' into bevy_0.16
makspll Jul 6, 2025
400cc47
clippy
makspll Jul 6, 2025
d1019fb
Merge branch 'main' into bevy_0.16
makspll Jul 6, 2025
f37f3b2
make api gen work with no_std crates better
makspll Jul 6, 2025
c60b849
Merge branch 'bevy_0.16' of https://github.com/alexparlett/bevy_mod_s…
makspll Jul 6, 2025
0b38370
correct collection code not to try to collect old crates
makspll Jul 7, 2025
ecd3550
remove deprecated bindings flags
makspll Jul 7, 2025
716c5b0
remove leftover references
makspll Jul 7, 2025
c5903bd
fix xtask
makspll Jul 7, 2025
ae956ba
remove unneeded imports
makspll Jul 7, 2025
7b77f93
they were in fact needed
makspll Jul 8, 2025
a862d25
fix issue with commands dispatched during a callback being run before…
makspll Aug 2, 2025
9641e89
manually flush command for entity spawning
makspll Aug 3, 2025
22a7820
add build_scripts.sh
makspll Aug 12, 2025
04b2691
change template
makspll Aug 12, 2025
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ assets/scripts/tlconfig.lua
**.log
**build/
.html
.idea/

/assets/**/*.lad.json
/docs/src/ladfiles/*.lad.json
/docs/src/ladfiles/*.lad.json
18 changes: 8 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ features = ["lua54", "rhai"]
[features]
default = [
"core_functions",
"bevy_core_bindings",
"bevy_ecs_bindings",
"bevy_hierarchy_bindings",
"bevy_input_bindings",
"bevy_math_bindings",
"bevy_reflect_bindings",
Expand All @@ -48,9 +46,7 @@ luau = ["bevy_mod_scripting_lua/luau", "lua"]

# bindings
core_functions = ["bevy_mod_scripting_functions/core_functions"]
bevy_core_bindings = ["bevy_mod_scripting_functions/bevy_core"]
bevy_ecs_bindings = ["bevy_mod_scripting_functions/bevy_ecs"]
bevy_hierarchy_bindings = ["bevy_mod_scripting_functions/bevy_hierarchy"]
bevy_input_bindings = ["bevy_mod_scripting_functions/bevy_input"]
bevy_math_bindings = ["bevy_mod_scripting_functions/bevy_math"]
bevy_reflect_bindings = ["bevy_mod_scripting_functions/bevy_reflect"]
Expand All @@ -75,6 +71,8 @@ profile_with_tracy = ["bevy/trace_tracy"]

[dependencies]
bevy = { workspace = true }
bevy_math = { workspace = true }
bevy_reflect = { workspace = true }
bevy_mod_scripting_core = { workspace = true }
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.13.0", optional = true }
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.13.0", optional = true }
Expand All @@ -84,7 +82,9 @@ bevy_mod_scripting_derive = { workspace = true }

[workspace.dependencies]
profiling = { version = "1.0" }
bevy = { version = "0.15.3", default-features = false }
bevy = { version = "0.16.0", default-features = false }
bevy_math = { version = "0.16.0" }
bevy_reflect = { version = "0.16.0" }
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.13.0" }
bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.13.0", default-features = false }
bevy_mod_scripting_derive = { path = "crates/bevy_mod_scripting_derive", version = "0.13.0" }
Expand All @@ -94,19 +94,17 @@ script_integration_test_harness = { path = "crates/testing_crates/script_integra
test_utils = { path = "crates/testing_crates/test_utils" }

[dev-dependencies]
bevy = { workspace = true, default-features = true }
bevy = { workspace = true, default-features = true, features = ["std"] }
clap = { version = "4.1", features = ["derive"] }
rand = "0.8.5"
bevy_console = "0.13"
# rhai-rand = "0.1"
rand = "0.9.1"
criterion = { version = "0.5" }
ansi-parser = "0.9"
ladfile_builder = { path = "crates/ladfile_builder", version = "0.3.3" }
script_integration_test_harness = { workspace = true }
test_utils = { workspace = true }
libtest-mimic = "0.8"
tracing-tracy = "0.11"
regex = "1.11"
bevy_console = "0.14"

[workspace]
members = [
Expand Down
39 changes: 24 additions & 15 deletions assets/tests/add_system/added_systems_run_in_parallel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,30 @@ function on_test()

local expected_dot_graph = [[
digraph {
node_0 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
node_1 [label="on_test_post_update"];
node_2 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_3 [label="script_integration_test_harness::dummy_post_update_system"];
node_4 [label="custom_system_a"];
node_5 [label="custom_system_b"];
node_6 [label="SystemSet GarbageCollection"];
node_7 [label="SystemSet ScriptSystem(custom_system_a)"];
node_8 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_6 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_7 [color=red, label="child of", arrowhead=diamond];
node_5 -> node_8 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_4 [color=blue, label="runs before", arrowhead=normal];
node_1 -> node_5 [color=blue, label="runs before", arrowhead=normal];
node_2 -> node_3 [color=blue, label="runs before", arrowhead=normal];
node_0 [label="bevy_asset::assets::Assets<bevy_asset::folder::LoadedFolder>::asset_events"];
node_1 [label="bevy_asset::assets::Assets<bevy_asset::assets::LoadedUntypedAsset>::asset_events"];
node_2 [label="bevy_asset::assets::Assets<()>::asset_events"];
node_3 [label="bevy_asset::assets::Assets<bevy_mod_scripting_core::asset::ScriptAsset>::asset_events"];
node_4 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
node_5 [label="on_test_post_update"];
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="custom_system_a"];
node_9 [label="custom_system_b"];
node_10 [label="SystemSet AssetEvents"];
node_11 [label="SystemSet GarbageCollection"];
node_12 [label="SystemSet ScriptSystem(custom_system_a)"];
node_13 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_10 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_10 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_10 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_10 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_8 -> node_12 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_13 [color=red, label="child of", arrowhead=diamond];
node_5 -> node_8 [color=blue, label="runs before", arrowhead=normal];
node_5 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_6 -> node_7 [color=blue, label="runs before", arrowhead=normal];
}
]]

Expand Down
39 changes: 24 additions & 15 deletions assets/tests/add_system/added_systems_run_in_parallel.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,30 @@ fn on_test() {

let expected_dot_graph = `
digraph {
node_0 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
node_1 [label="on_test_post_update"];
node_2 [label="script_integration_test_harness::dummy_before_post_update_system"];
node_3 [label="script_integration_test_harness::dummy_post_update_system"];
node_4 [label="custom_system_a"];
node_5 [label="custom_system_b"];
node_6 [label="SystemSet GarbageCollection"];
node_7 [label="SystemSet ScriptSystem(custom_system_a)"];
node_8 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_6 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_7 [color=red, label="child of", arrowhead=diamond];
node_5 -> node_8 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_4 [color=blue, label="runs before", arrowhead=normal];
node_1 -> node_5 [color=blue, label="runs before", arrowhead=normal];
node_2 -> node_3 [color=blue, label="runs before", arrowhead=normal];
node_0 [label="bevy_asset::assets::Assets<bevy_asset::folder::LoadedFolder>::asset_events"];
node_1 [label="bevy_asset::assets::Assets<bevy_asset::assets::LoadedUntypedAsset>::asset_events"];
node_2 [label="bevy_asset::assets::Assets<()>::asset_events"];
node_3 [label="bevy_asset::assets::Assets<bevy_mod_scripting_core::asset::ScriptAsset>::asset_events"];
node_4 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
node_5 [label="on_test_post_update"];
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="custom_system_a"];
node_9 [label="custom_system_b"];
node_10 [label="SystemSet AssetEvents"];
node_11 [label="SystemSet GarbageCollection"];
node_12 [label="SystemSet ScriptSystem(custom_system_a)"];
node_13 [label="SystemSet ScriptSystem(custom_system_b)"];
node_0 -> node_10 [color=red, label="child of", arrowhead=diamond];
node_1 -> node_10 [color=red, label="child of", arrowhead=diamond];
node_2 -> node_10 [color=red, label="child of", arrowhead=diamond];
node_3 -> node_10 [color=red, label="child of", arrowhead=diamond];
node_4 -> node_11 [color=red, label="child of", arrowhead=diamond];
node_8 -> node_12 [color=red, label="child of", arrowhead=diamond];
node_9 -> node_13 [color=red, label="child of", arrowhead=diamond];
node_5 -> node_8 [color=blue, label="runs before", arrowhead=normal];
node_5 -> node_9 [color=blue, label="runs before", arrowhead=normal];
node_6 -> node_7 [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
29 changes: 15 additions & 14 deletions benches/benchmarks.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
use bevy::log::tracing_subscriber::layer::SubscriberExt;
use bevy::log::{tracing_subscriber, Level};
use bevy::reflect::Reflect;
use bevy::utils::tracing;
use bevy::utils::tracing::span;
extern crate bevy_mod_scripting;
extern crate script_integration_test_harness;
extern crate test_utils;
use std::{collections::HashMap, path::PathBuf, sync::LazyLock, time::Duration};

use bevy::{
log::{
tracing, tracing::span, tracing_subscriber, tracing_subscriber::layer::SubscriberExt, Level,
},
reflect::Reflect,
};
use bevy_mod_scripting_core::bindings::{
FromScript, IntoScript, Mut, Ref, ReflectReference, ScriptValue, Val,
};
use criterion::{criterion_main, measurement::Measurement, BenchmarkGroup, Criterion};
use criterion::{BatchSize, BenchmarkFilter};
use criterion::{
criterion_main, measurement::Measurement, BatchSize, BenchmarkFilter, BenchmarkGroup, Criterion,
};
use regex::Regex;
use script_integration_test_harness::test_functions::rand::Rng;
use script_integration_test_harness::{
make_test_lua_plugin, make_test_rhai_plugin, perform_benchmark_with_generator,
run_lua_benchmark, run_plugin_script_load_benchmark, run_rhai_benchmark,
test_functions::rand::Rng,
};
use std::collections::HashMap;
use std::{path::PathBuf, sync::LazyLock, time::Duration};
use test_utils::{discover_all_tests, Test};

extern crate bevy_mod_scripting;
extern crate script_integration_test_harness;
extern crate test_utils;

static ENABLE_PROFILING: LazyLock<bool> =
LazyLock::new(|| std::env::var("ENABLE_PROFILING").is_ok());

Expand Down
16 changes: 16 additions & 0 deletions build_scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
WORKSPACE_DIR="$PWD"

cd "$(dirname "$0")"
# if the path is in /bevy_api_gen then we run the codegen check

if [[ "$WORKSPACE_DIR" == *"/bevy_api_gen"* ]]; then
# save output to file as well as stdout and stderr
cargo check --quiet --workspace --message-format=json --all-targets --keep-going
elif [[ "$WORKSPACE_DIR" == *"/xtask"* ]]; then
cd "$WORKSPACE_DIR"
cargo check --quiet --workspace --message-format=json --all-targets --keep-going
else
cd "$WORKSPACE_DIR"
cargo check --quiet --workspace --message-format=json --all-targets --keep-going
fi
2 changes: 1 addition & 1 deletion codegen_bevy_features.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded
bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded,std,async_executor
4 changes: 2 additions & 2 deletions crates/bevy_api_gen/Cargo.bootstrap.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = "2021"

[dependencies]
bevy_mod_scripting_core = { path = "{{BMS_CORE_PATH}}" }
bevy_reflect = { version = "0.15.3", features = [
"bevy",
bevy_reflect = { version = "0.16.0", features = [
"smol_str",
"glam",
"petgraph",
"smallvec",
Expand Down
6 changes: 1 addition & 5 deletions crates/bevy_api_gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ codegen-units = 8
incremental = false
debug = false

[rust-analyzer.rustc]
source = "discover"

[package.metadata.rust-analyzer]
rustc_private = true
Expand All @@ -41,7 +39,6 @@ log = "0.4"
env_logger = "0.11"
rustc_plugin = "0.12.0-nightly-2024-12-15"
indexmap = "2"
tempdir = "0.3"
cargo_metadata = "0.18"
serde_json = "1"
serde = "1"
Expand All @@ -51,8 +48,7 @@ strum = { version = "0.26", features = ["derive"] }
include_dir = "0.7"
prettyplease = "0.2"
convert_case = "0.6"
syn = { version = "2", features = ["parsing"], no-default-features = true }
clap-verbosity-flag = "2.2"
syn = { version = "2", features = ["parsing"], default-features = false }
itertools = "0.12"
chrono = "0.4"

Expand Down
54 changes: 30 additions & 24 deletions crates/bevy_api_gen/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ fn main() {
.map(|s| s.to_owned())
.collect::<Vec<String>>();

// log all dependencies
debug!("Enabled dependencies: {}", dependencies.join(","));

Some(dependencies)
}
_ => None,
Expand Down Expand Up @@ -110,36 +113,34 @@ fn main() {
if !output.is_dir() {
panic!("Output is not a directory");
}
let crates = std::fs::read_dir(&output)
.expect("Could not read output directory")
.filter_map(|d| {
let entry = d.expect("Could not read entry in output directory");
let path = entry.path();
if path.extension().is_some_and(|ext| ext == "rs")
&& path.file_stem().is_some_and(|s| s != "mod")
{
Some(path.file_stem().unwrap().to_owned())
} else {
None
}
});

let meta_loader = MetaLoader::new(vec![output.to_owned()], workspace_meta);
let mut crates: Vec<_> = crates
.map(|c| {
let name = c.to_str().unwrap().to_owned();
log::info!("Collecting crate: {}", name);
let meta = meta_loader
.meta_for(&name)
.expect("Could not find meta file for crate");
Crate { name, meta }
let mut crates = meta_loader
.iter_meta()
.filter_map(|m| {
log::debug!(
"Processing crate: {}, will generate: {}",
m.crate_name(),
m.will_generate()
);
m.will_generate().then_some(Crate {
name: m.crate_name().to_owned(),
meta: m,
})
})
.collect();
.collect::<Vec<_>>();

crates.sort_by(|a, b| a.name.cmp(&b.name));

let context = Collect { crates, api_name };
let json = serde_json::to_string_pretty(
&crates.iter().map(|c| c.name.clone()).collect::<Vec<_>>(),
)
.unwrap();

let collect = Collect { crates, api_name };

let mut context =
Context::from_serialize(context).expect("Could not create template context");
Context::from_serialize(collect).expect("Could not create template context");

extend_context_with_args(args.template_args.as_deref(), &mut context);

Expand All @@ -148,6 +149,11 @@ fn main() {
.expect("Failed to render mod.rs");
file.flush().unwrap();
log::info!("Succesfully generated mod.rs");

// put json of Collect context into stdout
std::io::stdout()
.write_all(json.as_bytes())
.expect("Failed to write Collect context to stdout");
return;
}
_ => {}
Expand Down
Loading
Loading