Skip to content

Commit 5dc91a1

Browse files
committed
Version and lint
1 parent f5bc6d6 commit 5dc91a1

File tree

36 files changed

+190
-171
lines changed

36 files changed

+190
-171
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,18 @@ profile_with_tracy = ["bevy/trace_tracy"]
7676
[dependencies]
7777
bevy = { workspace = true }
7878
bevy_mod_scripting_core = { workspace = true }
79-
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.12.0", optional = true }
80-
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.12.0", optional = true }
79+
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.13.0", optional = true }
80+
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.13.0", optional = true }
8181
# bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.9.0-alpha.2", optional = true }
8282
bevy_mod_scripting_functions = { workspace = true }
8383
bevy_mod_scripting_derive = { workspace = true }
8484

8585
[workspace.dependencies]
8686
profiling = { version = "1.0" }
8787
bevy = { version = "0.16.0", default-features = false }
88-
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.12.0" }
89-
bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.12.0", default-features = false }
90-
bevy_mod_scripting_derive = { path = "crates/bevy_mod_scripting_derive", version = "0.12.0" }
88+
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.13.0" }
89+
bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.13.0", default-features = false }
90+
bevy_mod_scripting_derive = { path = "crates/bevy_mod_scripting_derive", version = "0.13.0" }
9191

9292
# test utilities
9393
script_integration_test_harness = { path = "crates/testing_crates/script_integration_test_harness" }

benches/benchmarks.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
use bevy::log::tracing_subscriber::layer::SubscriberExt;
2-
use bevy::log::{tracing, tracing_subscriber, Level};
3-
use bevy::reflect::Reflect;
1+
use std::{collections::HashMap, path::PathBuf, sync::LazyLock, time::Duration};
2+
3+
use bevy::{
4+
log::{
5+
tracing, tracing::span, tracing_subscriber, tracing_subscriber::layer::SubscriberExt, Level,
6+
},
7+
reflect::Reflect,
8+
};
49
use bevy_mod_scripting_core::bindings::{
510
FromScript, IntoScript, Mut, Ref, ReflectReference, ScriptValue, Val,
611
};
7-
use criterion::{criterion_main, measurement::Measurement, BenchmarkGroup, Criterion};
8-
use criterion::{BatchSize, BenchmarkFilter};
12+
use criterion::{
13+
criterion_main, measurement::Measurement, BatchSize, BenchmarkFilter, BenchmarkGroup, Criterion,
14+
};
915
use regex::Regex;
10-
use script_integration_test_harness::test_functions::rand::Rng;
1116
use script_integration_test_harness::{
1217
make_test_lua_plugin, make_test_rhai_plugin, perform_benchmark_with_generator,
1318
run_lua_benchmark, run_plugin_script_load_benchmark, run_rhai_benchmark,
19+
test_functions::rand::Rng,
1420
};
15-
use std::collections::HashMap;
16-
use std::{path::PathBuf, sync::LazyLock, time::Duration};
17-
use bevy::log::tracing::span;
1821
use test_utils::{discover_all_tests, Test};
1922

2023
extern crate bevy_mod_scripting;

crates/bevy_mod_scripting_core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_mod_scripting_core"
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"
@@ -32,7 +32,7 @@ rhai = { version = "1.21", default-features = false, features = [
3232
bevy = { workspace = true, default-features = false, features = ["bevy_asset", "std"] }
3333
parking_lot = "0.12.1"
3434
smallvec = "1.11"
35-
itertools = "0.13"
35+
itertools = "0.14"
3636
profiling = { workspace = true }
3737
bevy_mod_scripting_derive = { workspace = true }
3838
fixedbitset = "0.5"

crates/bevy_mod_scripting_core/src/asset.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
//! Systems and resources for handling script assets and events
22
3-
use crate::{
4-
commands::{CreateOrUpdateScript, DeleteScript},
5-
error::ScriptError,
6-
script::ScriptId,
7-
IntoScriptPluginParams, ScriptingSystemSet,
8-
};
3+
use std::borrow::Cow;
4+
95
use bevy::{
106
app::{App, PreUpdate},
117
asset::{Asset, AssetEvent, AssetId, AssetLoader, AssetPath, Assets},
12-
prelude::Resource,
138
log::{debug, info, trace, warn},
9+
platform::collections::HashMap,
1410
prelude::{
15-
Commands, Event, EventReader, EventWriter, Res,
16-
ResMut,
11+
Commands, Event, EventReader, EventWriter, IntoScheduleConfigs, Res, ResMut, Resource,
1712
},
1813
reflect::TypePath,
19-
platform::collections::HashMap,
2014
};
21-
use std::borrow::Cow;
22-
use bevy::prelude::IntoScheduleConfigs;
15+
16+
use crate::{
17+
commands::{CreateOrUpdateScript, DeleteScript},
18+
error::ScriptError,
19+
script::ScriptId,
20+
IntoScriptPluginParams, ScriptingSystemSet,
21+
};
2322

2423
/// Represents a scripting language. Languages which compile into another language should use the target language as their language.
2524
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Default)]

crates/bevy_mod_scripting_core/src/commands.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
//! Commands for creating, updating and deleting scripts
22
3+
use std::{marker::PhantomData, sync::Arc};
4+
5+
use bevy::{asset::Handle, ecs::entity::Entity, log::debug, prelude::Command};
6+
use parking_lot::Mutex;
7+
38
use crate::{
49
asset::ScriptAsset,
510
bindings::{ScriptValue, WorldGuard},
@@ -14,9 +19,6 @@ use crate::{
1419
script::{Script, ScriptId, Scripts, StaticScripts},
1520
IntoScriptPluginParams,
1621
};
17-
use bevy::{asset::Handle, ecs::entity::Entity, log::debug, prelude::Command};
18-
use parking_lot::Mutex;
19-
use std::{marker::PhantomData, sync::Arc};
2022

2123
/// Deletes a script with the given ID
2224
pub struct DeleteScript<P: IntoScriptPluginParams> {
@@ -384,6 +386,7 @@ mod test {
384386
prelude::{Entity, World},
385387
};
386388

389+
use super::*;
387390
use crate::{
388391
asset::Language,
389392
bindings::script_value::ScriptValue,
@@ -393,8 +396,6 @@ mod test {
393396
script::Scripts,
394397
};
395398

396-
use super::*;
397-
398399
fn setup_app() -> App {
399400
// setup all the resources necessary
400401
let mut app = App::new();

crates/bevy_mod_scripting_core/src/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//! Traits and types for managing script contexts.
22
3+
use bevy::{ecs::entity::Entity, prelude::Resource};
4+
35
use crate::{
46
bindings::{ThreadWorldContainer, WorldContainer, WorldGuard},
57
error::{InteropError, ScriptError},
68
script::ScriptId,
79
IntoScriptPluginParams,
810
};
9-
use bevy::ecs::{entity::Entity};
10-
use bevy::prelude::Resource;
1111

1212
/// A trait that all script contexts must implement.
1313
///

crates/bevy_mod_scripting_core/src/error.rs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
//! Errors that can occur when interacting with the scripting system
22
3-
use crate::{
4-
bindings::{
5-
access_map::{DisplayCodeLocation, ReflectAccessId},
6-
function::namespace::Namespace,
7-
pretty_print::DisplayWithWorld,
8-
script_value::ScriptValue,
9-
ReflectBaseType, ReflectReference,
10-
},
11-
script::ScriptId,
3+
use std::{
4+
any::TypeId,
5+
borrow::Cow,
6+
fmt::{Debug, Display},
7+
ops::Deref,
8+
str::Utf8Error,
9+
sync::Arc,
1210
};
11+
1312
use bevy::{
1413
ecs::{
1514
component::ComponentId,
@@ -18,13 +17,16 @@ use bevy::{
1817
prelude::Entity,
1918
reflect::{PartialReflect, Reflect},
2019
};
21-
use std::{
22-
any::TypeId,
23-
borrow::Cow,
24-
fmt::{Debug, Display},
25-
ops::Deref,
26-
str::Utf8Error,
27-
sync::Arc,
20+
21+
use crate::{
22+
bindings::{
23+
access_map::{DisplayCodeLocation, ReflectAccessId},
24+
function::namespace::Namespace,
25+
pretty_print::DisplayWithWorld,
26+
script_value::ScriptValue,
27+
ReflectBaseType, ReflectReference,
28+
},
29+
script::ScriptId,
2830
};
2931

3032
/// An error with an optional script Context
@@ -1599,12 +1601,11 @@ impl Default for InteropErrorInner {
15991601
mod test {
16001602
use bevy::prelude::{AppTypeRegistry, World};
16011603

1604+
use super::*;
16021605
use crate::bindings::{
16031606
function::script_function::AppScriptFunctionRegistry, AppReflectAllocator, WorldGuard,
16041607
};
16051608

1606-
use super::*;
1607-
16081609
#[test]
16091610
fn test_error_display() {
16101611
let error =

crates/bevy_mod_scripting_core/src/event.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! Event handlers and event types for scripting.
22
3-
use crate::{bindings::script_value::ScriptValue, error::ScriptError, script::ScriptId};
43
use bevy::{ecs::entity::Entity, prelude::Event, reflect::Reflect};
54

5+
use crate::{bindings::script_value::ScriptValue, error::ScriptError, script::ScriptId};
6+
67
/// An error coming from a script
78
#[derive(Debug, Event)]
89
pub struct ScriptErrorEvent {

crates/bevy_mod_scripting_core/src/extractors.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ use bevy::ecs::{
88
component::ComponentId,
99
entity::Entity,
1010
event::{Event, EventCursor, EventIterator, Events},
11+
prelude::Resource,
1112
query::{Access, AccessConflicts},
1213
storage::SparseSetIndex,
13-
system::{Local, SystemParam, SystemState},
14+
system::{Local, SystemParam, SystemParamValidationError, SystemState},
1415
world::World,
15-
prelude::Resource,
1616
};
17-
use bevy::ecs::system::SystemParamValidationError;
1817
use fixedbitset::FixedBitSet;
1918

2019
use crate::{
@@ -419,9 +418,9 @@ mod test {
419418
ecs::{
420419
component::Component,
421420
event::{Event, EventReader},
421+
prelude::Resource,
422422
system::{Query, ResMut},
423423
world::FromWorld,
424-
prelude::Resource,
425424
},
426425
};
427426
use test_utils::make_test_plugin;

crates/bevy_mod_scripting_core/src/handler.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
//! Contains the logic for handling script callback events
2+
use bevy::{
3+
ecs::{
4+
entity::Entity,
5+
query::QueryState,
6+
system::{Local, SystemState},
7+
world::{Mut, World},
8+
},
9+
log::trace_once,
10+
prelude::{Events, Ref, Resource},
11+
};
12+
213
use crate::{
314
bindings::{
415
pretty_print::DisplayWithWorld, script_value::ScriptValue, ThreadWorldContainer,
@@ -14,16 +25,6 @@ use crate::{
1425
script::{ScriptComponent, ScriptId},
1526
IntoScriptPluginParams,
1627
};
17-
use bevy::{
18-
ecs::{
19-
entity::Entity,
20-
query::QueryState,
21-
system::{Local, SystemState},
22-
world::{Mut, World},
23-
},
24-
log::trace_once,
25-
prelude::{Events, Ref, Resource},
26-
};
2728

2829
/// A function that handles a callback event
2930
pub type HandlerFn<P> = fn(
@@ -295,6 +296,7 @@ mod test {
295296
use parking_lot::Mutex;
296297
use test_utils::make_test_plugin;
297298

299+
use super::*;
298300
use crate::{
299301
bindings::script_value::ScriptValue,
300302
context::{ContextBuilder, ContextLoadingSettings},
@@ -303,8 +305,6 @@ mod test {
303305
script::{Script, ScriptComponent, ScriptId, Scripts, StaticScripts},
304306
BMSScriptingInfrastructurePlugin,
305307
};
306-
307-
use super::*;
308308
struct OnTestCallback;
309309

310310
impl IntoCallbackLabel for OnTestCallback {

crates/bevy_mod_scripting_core/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//!
33
//! Contains language agnostic systems and types for handling scripting in bevy.
44
5-
use crate::event::ScriptErrorEvent;
65
use asset::{
76
configure_asset_systems, configure_asset_systems_for_plugin, Language, ScriptAsset,
87
ScriptAssetLoader, ScriptAssetSettings,
@@ -24,6 +23,8 @@ use handler::{CallbackSettings, HandlerFn};
2423
use runtime::{initialize_runtime, Runtime, RuntimeContainer, RuntimeInitializer, RuntimeSettings};
2524
use script::{ScriptComponent, ScriptId, Scripts, StaticScripts};
2625

26+
use crate::event::ScriptErrorEvent;
27+
2728
pub mod asset;
2829
pub mod bindings;
2930
pub mod commands;

crates/bevy_mod_scripting_core/src/reflection_extensions.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
//! Various utility functions for working with reflection types.
22
3-
use crate::{
4-
bindings::{ReflectReference, WorldGuard},
5-
error::InteropError,
6-
};
7-
use bevy::reflect::{PartialReflect, Reflect, ReflectFromReflect, ReflectMut, TypeInfo};
83
use std::{
94
any::{Any, TypeId},
105
cmp::max,
116
};
7+
8+
use bevy::reflect::{PartialReflect, Reflect, ReflectFromReflect, ReflectMut, TypeInfo};
9+
10+
use crate::{
11+
bindings::{ReflectReference, WorldGuard},
12+
error::InteropError,
13+
};
1214
/// Extension trait for [`PartialReflect`] providing additional functionality for working with specific types.
1315
pub trait PartialReflectExt {
1416
/// Try to get a reference to the given key in an underyling map, if the type is a map.

crates/bevy_mod_scripting_core/src/runtime.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
//! "Runtime" here refers to the execution evironment of scripts. This might be the VM executing bytecode or the interpreter executing source code.
22
//! The important thing is that there is only one runtime which is used to execute all scripts of a particular type or `context`.
33
4-
use crate::{error::ScriptError, IntoScriptPluginParams};
54
use bevy::{
6-
ecs::system::{ResMut},
5+
ecs::system::ResMut,
76
prelude::{Res, Resource},
87
};
98

9+
use crate::{error::ScriptError, IntoScriptPluginParams};
10+
1011
/// A trait that all script runtimes must implement.
1112
pub trait Runtime: Default + 'static + Send + Sync {}
1213
impl<T: Default + 'static + Send + Sync> Runtime for T {}

crates/bevy_mod_scripting_core/src/script.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
//! Script related types, functions and components
22
3-
use crate::{asset::ScriptAsset, IntoScriptPluginParams};
4-
use bevy::prelude::ReflectComponent;
5-
use bevy::{asset::Handle, prelude::Resource, reflect::Reflect};
6-
use parking_lot::Mutex;
73
use std::{borrow::Cow, collections::HashMap, ops::Deref, sync::Arc};
8-
use bevy::platform::collections::HashSet;
4+
5+
use bevy::{
6+
asset::Handle,
7+
platform::collections::HashSet,
8+
prelude::{ReflectComponent, Resource},
9+
reflect::Reflect,
10+
};
11+
use parking_lot::Mutex;
12+
13+
use crate::{asset::ScriptAsset, IntoScriptPluginParams};
914

1015
/// A unique identifier for a script, by default corresponds to the path of the asset excluding the asset source.
1116
///

crates/bevy_mod_scripting_derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_mod_scripting_derive"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
edition = "2021"
55
authors = ["Maksymilian Mozolewski <[email protected]>"]
66
license = "MIT OR Apache-2.0"

0 commit comments

Comments
 (0)