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
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ bevy_ecs = { version = "0.16.0", default-features = false }
bevy_log = { version = "0.16.0", default-features = false }
bevy_state = { version = "0.16.0", default-features = false, features = ["bevy_app"] }
bevy = { version = "0.16.0", default-features = false, features = ["bevy_log", "bevy_state"] }
deluxe = { version = "0.5.0", package = "deluxe-tg" }
deluxe-core = { version = "0.5.0", package = "deluxe-core-tg" }
proc-macro2 = "1.0.93"
quote = "1.0.38"
sha256 = { version = "1.5.0", default-features = false }
syn = { version = "2.0.96", features = ["full"] }
12 changes: 6 additions & 6 deletions bevy-butler-proc-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ exclude = [".direnv/", ".vscode/", "Cargo.lock", "*.nix", "flake.lock", ".envrc"
proc-macro = true

[dependencies]
deluxe = "0.5.0"
deluxe-core = "0.5.0"
proc-macro2 = "1.0.93"
quote = "1.0.38"
sha256 = { version = "1.5.0", default-features = false }
syn = { version = "2.0.96", features = ["full"] }
deluxe = { workspace = true }
deluxe-core = { workspace = true }
proc-macro2 = { workspace = true }
quote = { workspace = true }
sha256 = { workspace = true }
syn = { workspace = true }
2 changes: 1 addition & 1 deletion bevy-butler-proc-macro/src/add_system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) fn parse_system(attr: &SystemAttr, ident: &Ident) -> Expr {
});
let transforms = &attr.transforms.0;

let sys_expr = syn::parse_quote! {
let sys_expr: Expr = syn::parse_quote! {
#ident #generics #(. #transforms)*
};

Expand Down
7 changes: 4 additions & 3 deletions bevy-butler-proc-macro/src/add_system/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ impl ParseMetaRest for TransformList {
// Style 2: NameValue - transform = expr
if input.peek(Token![=]) {
input.parse::<Token![=]>()?;
let expr = Expr::parse(input)?;
ret.push(syn::parse2(quote!(#path ( #expr )))?);
let expr: Expr = Expr::parse(input)?;
let trns: ExprCall = syn::parse2(quote!(#path ( #expr )))?;
ret.push(trns);

parse_end_comma_or_eof(input)?;
continue;
}
Expand All @@ -64,7 +66,6 @@ impl ParseMetaRest for TransformList {
parse_end_comma_or_eof(input)?;
}
}

Ok(TransformList(ret))
}
}
Expand Down
12 changes: 7 additions & 5 deletions bevy-butler/tests/add_system/generic_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use bevy_ecs::prelude::*;
use bevy_log::info;
use wasm_bindgen_test::wasm_bindgen_test;

use super::common::log_plugin;
include!("../common.rs");
use common::log_plugin;

#[derive(Resource)]
struct GenericResource<T>(pub T, pub bool);
Expand All @@ -22,10 +23,11 @@ impl Plugin for MyPlugin {
}
}

#[add_system(generics = <&str>, plugin = MyPlugin, schedule = Startup, before = test_sys::<u8>)]
#[add_system(generics = <u8>, plugin = MyPlugin, schedule = Startup, after = test_sys::<&str>)]
#[add_system(generics = <bool>, plugin = MyPlugin, schedule = Startup, after(test_sys::<&str>), after = test_sys::<u8>)]
fn test_sys<T: 'static + Sync + Send + Display>(mut res: ResMut<GenericResource<T>>) {
// Duplicated generics to test an issue that existed with deluxe
#[add_system(generics = <&str, &str>, plugin = MyPlugin, schedule = Startup, before = test_sys::<u8, u8>)]
#[add_system(generics = <u8,u8>, plugin = MyPlugin, schedule = Startup, after = test_sys::<&str, &str>)]
#[add_system(generics = <bool,bool>, plugin = MyPlugin, schedule = Startup)]
fn test_sys<T: 'static + Sync + Send + Display, R>(mut res: ResMut<GenericResource<T>>) {
info!("{} = {}", type_name::<T>(), res.0);
res.1 = true;
}
Expand Down