Skip to content

Commit f5bc6d6

Browse files
committed
Bevy 0.16
Remove unused 0.16 missed fix Bevy 0.16 full More fixes Fix Fixes
1 parent 040cc4a commit f5bc6d6

File tree

46 files changed

+388
-428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+388
-428
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ assets/scripts/tlconfig.lua
1515
**.log
1616
**build/
1717
.html
18+
.idea/
1819

1920
/assets/**/*.lad.json
20-
/docs/src/ladfiles/*.lad.json
21+
/docs/src/ladfiles/*.lad.json

Cargo.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_mod_scripting"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
authors = ["Maksymilian Mozolewski <[email protected]>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
@@ -84,7 +84,7 @@ bevy_mod_scripting_derive = { workspace = true }
8484

8585
[workspace.dependencies]
8686
profiling = { version = "1.0" }
87-
bevy = { version = "0.15.3", default-features = false }
87+
bevy = { version = "0.16.0", default-features = false }
8888
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.12.0" }
8989
bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.12.0", default-features = false }
9090
bevy_mod_scripting_derive = { path = "crates/bevy_mod_scripting_derive", version = "0.12.0" }
@@ -94,19 +94,17 @@ script_integration_test_harness = { path = "crates/testing_crates/script_integra
9494
test_utils = { path = "crates/testing_crates/test_utils" }
9595

9696
[dev-dependencies]
97-
bevy = { workspace = true, default-features = true }
97+
bevy = { workspace = true, default-features = true, features = ["std"] }
9898
clap = { version = "4.1", features = ["derive"] }
99-
rand = "0.8.5"
100-
bevy_console = "0.13"
101-
# rhai-rand = "0.1"
99+
rand = "0.9.1"
102100
criterion = { version = "0.5" }
103-
ansi-parser = "0.9"
104101
ladfile_builder = { path = "crates/ladfile_builder", version = "0.3.2" }
105102
script_integration_test_harness = { workspace = true }
106103
test_utils = { workspace = true }
107104
libtest-mimic = "0.8"
108105
tracing-tracy = "0.11"
109106
regex = "1.11"
107+
bevy_console = { git = "https://github.com/Katsutoshii/bevy-console", branch = "bevy-0.16.0"}
110108

111109
[workspace]
112110
members = [

assets/tests/add_system/added_systems_run_in_parallel.lua

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,30 @@ function on_test()
2121

2222
local expected_dot_graph = [[
2323
digraph {
24-
node_0 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
25-
node_1 [label="on_test_post_update"];
26-
node_2 [label="script_integration_test_harness::dummy_before_post_update_system"];
27-
node_3 [label="script_integration_test_harness::dummy_post_update_system"];
28-
node_4 [label="custom_system_a"];
29-
node_5 [label="custom_system_b"];
30-
node_6 [label="SystemSet GarbageCollection"];
31-
node_7 [label="SystemSet ScriptSystem(custom_system_a)"];
32-
node_8 [label="SystemSet ScriptSystem(custom_system_b)"];
33-
node_0 -> node_6 [color=red, label="child of", arrowhead=diamond];
34-
node_4 -> node_7 [color=red, label="child of", arrowhead=diamond];
35-
node_5 -> node_8 [color=red, label="child of", arrowhead=diamond];
36-
node_1 -> node_4 [color=blue, label="runs before", arrowhead=normal];
37-
node_1 -> node_5 [color=blue, label="runs before", arrowhead=normal];
38-
node_2 -> node_3 [color=blue, label="runs before", arrowhead=normal];
24+
node_0 [label="bevy_asset::assets::Assets<bevy_asset::folder::LoadedFolder>::asset_events"];
25+
node_1 [label="bevy_asset::assets::Assets<bevy_asset::assets::LoadedUntypedAsset>::asset_events"];
26+
node_2 [label="bevy_asset::assets::Assets<()>::asset_events"];
27+
node_3 [label="bevy_asset::assets::Assets<bevy_mod_scripting_core::asset::ScriptAsset>::asset_events"];
28+
node_4 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
29+
node_5 [label="on_test_post_update"];
30+
node_6 [label="script_integration_test_harness::dummy_before_post_update_system"];
31+
node_7 [label="script_integration_test_harness::dummy_post_update_system"];
32+
node_8 [label="custom_system_a"];
33+
node_9 [label="custom_system_b"];
34+
node_10 [label="SystemSet AssetEvents"];
35+
node_11 [label="SystemSet GarbageCollection"];
36+
node_12 [label="SystemSet ScriptSystem(custom_system_a)"];
37+
node_13 [label="SystemSet ScriptSystem(custom_system_b)"];
38+
node_0 -> node_10 [color=red, label="child of", arrowhead=diamond];
39+
node_1 -> node_10 [color=red, label="child of", arrowhead=diamond];
40+
node_2 -> node_10 [color=red, label="child of", arrowhead=diamond];
41+
node_3 -> node_10 [color=red, label="child of", arrowhead=diamond];
42+
node_4 -> node_11 [color=red, label="child of", arrowhead=diamond];
43+
node_8 -> node_12 [color=red, label="child of", arrowhead=diamond];
44+
node_9 -> node_13 [color=red, label="child of", arrowhead=diamond];
45+
node_5 -> node_8 [color=blue, label="runs before", arrowhead=normal];
46+
node_5 -> node_9 [color=blue, label="runs before", arrowhead=normal];
47+
node_6 -> node_7 [color=blue, label="runs before", arrowhead=normal];
3948
}
4049
]]
4150

assets/tests/add_system/added_systems_run_in_parallel.rhai

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,30 @@ fn on_test() {
2020

2121
let expected_dot_graph = `
2222
digraph {
23-
node_0 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
24-
node_1 [label="on_test_post_update"];
25-
node_2 [label="script_integration_test_harness::dummy_before_post_update_system"];
26-
node_3 [label="script_integration_test_harness::dummy_post_update_system"];
27-
node_4 [label="custom_system_a"];
28-
node_5 [label="custom_system_b"];
29-
node_6 [label="SystemSet GarbageCollection"];
30-
node_7 [label="SystemSet ScriptSystem(custom_system_a)"];
31-
node_8 [label="SystemSet ScriptSystem(custom_system_b)"];
32-
node_0 -> node_6 [color=red, label="child of", arrowhead=diamond];
33-
node_4 -> node_7 [color=red, label="child of", arrowhead=diamond];
34-
node_5 -> node_8 [color=red, label="child of", arrowhead=diamond];
35-
node_1 -> node_4 [color=blue, label="runs before", arrowhead=normal];
36-
node_1 -> node_5 [color=blue, label="runs before", arrowhead=normal];
37-
node_2 -> node_3 [color=blue, label="runs before", arrowhead=normal];
23+
node_0 [label="bevy_asset::assets::Assets<bevy_asset::folder::LoadedFolder>::asset_events"];
24+
node_1 [label="bevy_asset::assets::Assets<bevy_asset::assets::LoadedUntypedAsset>::asset_events"];
25+
node_2 [label="bevy_asset::assets::Assets<()>::asset_events"];
26+
node_3 [label="bevy_asset::assets::Assets<bevy_mod_scripting_core::asset::ScriptAsset>::asset_events"];
27+
node_4 [label="bevy_mod_scripting_core::bindings::allocator::garbage_collector"];
28+
node_5 [label="on_test_post_update"];
29+
node_6 [label="script_integration_test_harness::dummy_before_post_update_system"];
30+
node_7 [label="script_integration_test_harness::dummy_post_update_system"];
31+
node_8 [label="custom_system_a"];
32+
node_9 [label="custom_system_b"];
33+
node_10 [label="SystemSet AssetEvents"];
34+
node_11 [label="SystemSet GarbageCollection"];
35+
node_12 [label="SystemSet ScriptSystem(custom_system_a)"];
36+
node_13 [label="SystemSet ScriptSystem(custom_system_b)"];
37+
node_0 -> node_10 [color=red, label="child of", arrowhead=diamond];
38+
node_1 -> node_10 [color=red, label="child of", arrowhead=diamond];
39+
node_2 -> node_10 [color=red, label="child of", arrowhead=diamond];
40+
node_3 -> node_10 [color=red, label="child of", arrowhead=diamond];
41+
node_4 -> node_11 [color=red, label="child of", arrowhead=diamond];
42+
node_8 -> node_12 [color=red, label="child of", arrowhead=diamond];
43+
node_9 -> node_13 [color=red, label="child of", arrowhead=diamond];
44+
node_5 -> node_8 [color=blue, label="runs before", arrowhead=normal];
45+
node_5 -> node_9 [color=blue, label="runs before", arrowhead=normal];
46+
node_6 -> node_7 [color=blue, label="runs before", arrowhead=normal];
3847
}`;
3948

4049
assert_str_eq.call(dot_graph, expected_dot_graph, "Expected the schedule graph to match the expected graph");

benches/benchmarks.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use bevy::log::tracing_subscriber::layer::SubscriberExt;
2-
use bevy::log::{tracing_subscriber, Level};
2+
use bevy::log::{tracing, tracing_subscriber, Level};
33
use bevy::reflect::Reflect;
4-
use bevy::utils::tracing;
5-
use bevy::utils::tracing::span;
64
use bevy_mod_scripting_core::bindings::{
75
FromScript, IntoScript, Mut, Ref, ReflectReference, ScriptValue, Val,
86
};
@@ -16,6 +14,7 @@ use script_integration_test_harness::{
1614
};
1715
use std::collections::HashMap;
1816
use std::{path::PathBuf, sync::LazyLock, time::Duration};
17+
use bevy::log::tracing::span;
1918
use test_utils::{discover_all_tests, Test};
2019

2120
extern crate bevy_mod_scripting;

crates/bevy_api_gen/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ log = "0.4"
4141
env_logger = "0.11"
4242
rustc_plugin = "0.12.0-nightly-2024-12-15"
4343
indexmap = "2"
44-
tempdir = "0.3"
4544
cargo_metadata = "0.18"
4645
serde_json = "1"
4746
serde = "1"
@@ -52,7 +51,6 @@ include_dir = "0.7"
5251
prettyplease = "0.2"
5352
convert_case = "0.6"
5453
syn = { version = "2", features = ["parsing"], no-default-features = true }
55-
clap-verbosity-flag = "2.2"
5654
itertools = "0.12"
5755
chrono = "0.4"
5856

crates/bevy_mod_scripting_core/Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,15 @@ mlua = { version = "0.10", default-features = false, optional = true }
2929
rhai = { version = "1.21", default-features = false, features = [
3030
"sync",
3131
], optional = true }
32-
bevy = { workspace = true, default-features = false, features = ["bevy_asset"] }
33-
thiserror = "1.0.31"
32+
bevy = { workspace = true, default-features = false, features = ["bevy_asset", "std"] }
3433
parking_lot = "0.12.1"
35-
dashmap = "6"
3634
smallvec = "1.11"
3735
itertools = "0.13"
38-
derivative = "2.2"
3936
profiling = { workspace = true }
4037
bevy_mod_scripting_derive = { workspace = true }
4138
fixedbitset = "0.5"
42-
petgraph = "0.6"
43-
bevy_mod_debugdump = "0.12"
4439
bevy_system_reflection = { path = "../bevy_system_reflection", version = "0.1.1" }
40+
variadics_please = "1.1.0"
4541

4642
[dev-dependencies]
4743
test_utils = { workspace = true }

crates/bevy_mod_scripting_core/src/asset.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ use crate::{
99
use bevy::{
1010
app::{App, PreUpdate},
1111
asset::{Asset, AssetEvent, AssetId, AssetLoader, AssetPath, Assets},
12-
ecs::system::Resource,
12+
prelude::Resource,
1313
log::{debug, info, trace, warn},
1414
prelude::{
15-
Commands, Event, EventReader, EventWriter, IntoSystemConfigs, IntoSystemSetConfigs, Res,
15+
Commands, Event, EventReader, EventWriter, Res,
1616
ResMut,
1717
},
1818
reflect::TypePath,
19-
utils::hashbrown::HashMap,
19+
platform::collections::HashMap,
2020
};
2121
use std::borrow::Cow;
22+
use bevy::prelude::IntoScheduleConfigs;
2223

2324
/// Represents a scripting language. Languages which compile into another language should use the target language as their language.
2425
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Default)]
@@ -142,7 +143,7 @@ impl Default for ScriptAssetSettings {
142143
fn default() -> Self {
143144
Self {
144145
script_id_mapper: AssetPathToScriptIdMapper {
145-
map: (|path: &AssetPath| path.path().to_string_lossy().into_owned().into()),
146+
map: |path: &AssetPath| path.path().to_string_lossy().into_owned().into(),
146147
},
147148
extension_to_language_map: HashMap::from_iter(vec![
148149
("lua", Language::Lua),
@@ -231,7 +232,7 @@ pub(crate) fn dispatch_script_asset_events(
231232
language,
232233
};
233234
debug!("Script loaded, populating metadata: {:?}:", metadata);
234-
script_asset_events.send(ScriptAssetEvent::Added(metadata.clone()));
235+
script_asset_events.write(ScriptAssetEvent::Added(metadata.clone()));
235236
metadata_store.insert(*id, metadata);
236237
} else {
237238
warn!("A script was added but it's asset was not found, failed to compute metadata. This script will not be loaded. Did you forget to store `Handle<ScriptAsset>` somewhere?. {}", id);
@@ -241,15 +242,15 @@ pub(crate) fn dispatch_script_asset_events(
241242
AssetEvent::Removed { id } => {
242243
if let Some(metadata) = metadata_store.get(*id) {
243244
debug!("Script removed: {:?}", metadata);
244-
script_asset_events.send(ScriptAssetEvent::Removed(metadata.clone()));
245+
script_asset_events.write(ScriptAssetEvent::Removed(metadata.clone()));
245246
} else {
246247
warn!("Script metadata not found for removed script asset: {}. Cannot properly clean up script", id);
247248
}
248249
}
249250
AssetEvent::Modified { id } => {
250251
if let Some(metadata) = metadata_store.get(*id) {
251252
debug!("Script modified: {:?}", metadata);
252-
script_asset_events.send(ScriptAssetEvent::Modified(metadata.clone()));
253+
script_asset_events.write(ScriptAssetEvent::Modified(metadata.clone()));
253254
} else {
254255
warn!("Script metadata not found for modified script asset: {}. Cannot properly update script", id);
255256
}
@@ -572,9 +573,9 @@ mod tests {
572573
struct DummyPlugin;
573574

574575
impl IntoScriptPluginParams for DummyPlugin {
575-
type R = ();
576-
type C = ();
577576
const LANGUAGE: Language = Language::Lua;
577+
type C = ();
578+
type R = ();
578579

579580
fn build_runtime() -> Self::R {}
580581
}

crates/bevy_mod_scripting_core/src/bindings/access_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::hash::{BuildHasherDefault, Hasher};
55
use bevy::{
66
ecs::{component::ComponentId, world::unsafe_world_cell::UnsafeWorldCell},
77
prelude::Resource,
8-
utils::hashbrown::{HashMap, HashSet},
8+
platform::collections::{HashMap, HashSet},
99
};
1010
use parking_lot::Mutex;
1111
use smallvec::SmallVec;

crates/bevy_mod_scripting_core/src/bindings/allocator.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
use bevy::{
44
app::{App, Plugin, PostUpdate},
55
diagnostic::{Diagnostic, DiagnosticPath, Diagnostics, RegisterDiagnostic},
6-
ecs::system::{Res, Resource},
6+
ecs::system::{Res},
77
prelude::ResMut,
88
reflect::PartialReflect,
9-
utils::hashbrown::HashMap,
9+
platform::collections::HashMap,
1010
};
1111
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
1212
use std::{
@@ -16,6 +16,7 @@ use std::{
1616
hash::Hasher,
1717
sync::{atomic::AtomicU64, Arc},
1818
};
19+
use bevy::prelude::Resource;
1920

2021
/// The path used for the total number of allocations diagnostic
2122
pub const ALLOCATOR_TOTAL_DIAG_PATH: DiagnosticPath =

crates/bevy_mod_scripting_core/src/bindings/function/from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,4 +585,4 @@ macro_rules! impl_from_script_tuple {
585585
};
586586
}
587587

588-
bevy::utils::all_tuples!(impl_from_script_tuple, 1, 14, T);
588+
variadics_please::all_tuples!(impl_from_script_tuple, 1, 14, T);

crates/bevy_mod_scripting_core/src/bindings/function/into.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,4 @@ macro_rules! impl_into_script_tuple {
199199
}
200200
}
201201

202-
bevy::utils::all_tuples!(impl_into_script_tuple, 1, 14, T);
202+
variadics_please::all_tuples!(impl_into_script_tuple, 1, 14, T);

crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
ScriptValue,
1212
};
1313
use bevy::prelude::{Reflect, Resource};
14-
use bevy::utils::hashbrown::HashMap;
14+
use bevy::platform::collections::HashMap;
1515
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
1616
use std::borrow::Cow;
1717
use std::collections::VecDeque;
@@ -622,7 +622,7 @@ macro_rules! impl_script_function {
622622
};
623623
}
624624

625-
bevy::utils::all_tuples!(impl_script_function, 0, 13, T);
625+
variadics_please::all_tuples!(impl_script_function, 0, 13, T);
626626

627627
#[cfg(test)]
628628
mod test {

crates/bevy_mod_scripting_core/src/bindings/function/type_dependencies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ macro_rules! register_tuple_dependencies {
156156
}
157157

158158

159-
bevy::utils::all_tuples!(register_tuple_dependencies, 1, 14, T);
159+
variadics_please::all_tuples!(register_tuple_dependencies, 1, 14, T);
160160

161161
/// A trait collecting type dependency information for a whole function. Used to register everything used by a function with the type registry
162162
pub trait GetFunctionTypeDependencies<Marker> {
@@ -184,4 +184,4 @@ macro_rules! impl_script_function_type_dependencies{
184184
};
185185
}
186186

187-
bevy::utils::all_tuples!(impl_script_function_type_dependencies, 0, 13, T);
187+
variadics_please::all_tuples!(impl_script_function_type_dependencies, 0, 13, T);

crates/bevy_mod_scripting_core/src/bindings/globals/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
docgen::{into_through_type_info, typed_through::ThroughTypeInfo},
1010
error::InteropError,
1111
};
12-
use bevy::{ecs::system::Resource, reflect::Typed, utils::hashbrown::HashMap};
12+
use bevy::{prelude::Resource, reflect::Typed, platform::collections::HashMap};
1313
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
1414
use std::{any::TypeId, borrow::Cow, sync::Arc};
1515

crates/bevy_mod_scripting_core/src/bindings/reference.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,11 @@ impl ReflectBase {
503503
match self {
504504
ReflectBase::Component(entity, component_id) => {
505505
// Safety: the caller ensures invariants hold
506-
world.get_entity(entity)?.get_by_id(component_id)
506+
if let Ok(entity) = world.get_entity(entity) {
507+
entity.get_by_id(component_id)
508+
} else {
509+
None
510+
}
507511
}
508512
ReflectBase::Resource(component_id) => {
509513
// Safety: the caller ensures invariants hold
@@ -522,7 +526,11 @@ impl ReflectBase {
522526
match self {
523527
ReflectBase::Component(entity, component_id) => {
524528
// Safety: the caller ensures invariants hold
525-
world.get_entity(entity)?.get_mut_by_id(component_id)
529+
if let Ok(entity) = world.get_entity(entity) {
530+
entity.get_mut_by_id(component_id).ok()
531+
} else {
532+
None
533+
}
526534
}
527535
ReflectBase::Resource(component_id) => {
528536
// Safety: the caller ensures invariants hold

crates/bevy_mod_scripting_core/src/bindings/schedule.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use bevy::{
99
},
1010
ecs::{
1111
schedule::{Schedule, ScheduleLabel, Schedules},
12-
system::Resource,
1312
world::World,
1413
},
14+
prelude::Resource,
1515
};
1616
use bevy_system_reflection::{ReflectSchedule, ReflectSystem};
1717
use parking_lot::RwLock;
@@ -342,7 +342,7 @@ mod tests {
342342

343343
// Collect all edges as (from, to) name pairs.
344344
let mut found_edges = Vec::new();
345-
for (from, to, _) in graph.dependency().graph().all_edges() {
345+
for (from, to) in graph.dependency().graph().all_edges() {
346346
let name_from = resolve_name(from);
347347
let name_to = resolve_name(to);
348348
found_edges.push((name_from, name_to));

0 commit comments

Comments
 (0)