Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/synchronize_bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes=true" >> "$GITHUB_OUTPUT"
git diff > bindings.diff
git diff --text > bindings.diff
echo "Diff created:"
cat bindings.diff
else
Expand Down
40 changes: 38 additions & 2 deletions .github/workflows/synchronize_bindings_check_diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
env:
DIFF_ARTIFACT: bindings.diff
PR_EVENT: event-bindings.json
EVENT_FILE: event.json
steps:
- name: Download Benchmark Results
- name: Download Diff Results
uses: dawidd6/action-download-artifact@v6
with:
name: ${{ env.DIFF_ARTIFACT }}
Expand All @@ -31,13 +32,48 @@ jobs:
with:
script: |
let fs = require('fs');
let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'}));
let prEvent = JSON.parse(fs.readFileSync(process.env.EVENT_FILE, {encoding: 'utf8'}));
core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref);
core.exportVariable("PR_BASE", prEvent.pull_request.base.ref);
core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha);
core.exportVariable("PR_NUMBER", prEvent.number);
core.exportVariable("HEAD_REPO", prEvent.pull_request.head.repo.full_name);
core.exportVariable("HEAD_REPO_URL", prEvent.pull_request.head.repo.git_url);

- name: Build Collapsible Diff Comment
id: build_comment
continue-on-error: true
shell: bash
run: |
echo '### 🔍 Binding Differences Detected' > comment.md
echo '' >> comment.md
echo '> The following changes were detected in generated bindings:' >> comment.md
echo '' >> comment.md

# Build collapsible sections per file
awk '
/^diff --git/ {
if (file != "") print "</pre></details>" >> "comment.md"
file=$4
gsub(/^a\//, "", file)
print "<details><summary>" file "</summary><pre>" >> "comment.md"
next
}
{ print $0 >> "comment.md" }
END { if (file != "") print "</pre></details>" >> "comment.md" }
' "${{ env.DIFF_ARTIFACT }}"

- name: Add or Update PR Comment with Diff
id: pr_comment
continue-on-error: true
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ env.PR_NUMBER }}
body-path: comment.md
edit-mode: replace
token: ${{ secrets.GITHUB_TOKEN }}
comment-identifier: bindings-diff

- name: Fail PR With URL
uses: actions/github-script@v6
with:
Expand Down
80 changes: 47 additions & 33 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ core_functions = ["bevy_mod_scripting_functions/core_functions"]
bevy_a11y_bindings = ["bevy_mod_scripting_functions/bevy_a11y"]
bevy_animation_bindings = ["bevy_mod_scripting_functions/bevy_animation"]
bevy_asset_bindings = ["bevy_mod_scripting_functions/bevy_asset"]
bevy_camera_bindings = ["bevy_mod_scripting_functions/bevy_camera"]
bevy_color_bindings = ["bevy_mod_scripting_functions/bevy_color"]
bevy_core_pipeline_bindings = [
"bevy_mod_scripting_functions/bevy_core_pipeline",
Expand All @@ -76,17 +77,24 @@ bevy_gltf_bindings = ["bevy_mod_scripting_functions/bevy_gltf"]
bevy_image_bindings = ["bevy_mod_scripting_functions/bevy_image"]
bevy_input_bindings = ["bevy_mod_scripting_functions/bevy_input"]
bevy_input_focus_bindings = ["bevy_mod_scripting_functions/bevy_input_focus"]
bevy_light_bindings = ["bevy_mod_scripting_functions/bevy_light"]
bevy_math_bindings = ["bevy_mod_scripting_functions/bevy_math"]
bevy_mesh_bindings = ["bevy_mod_scripting_functions/bevy_mesh"]
bevy_pbr_bindings = ["bevy_mod_scripting_functions/bevy_pbr"]
bevy_picking_bindings = ["bevy_mod_scripting_functions/bevy_picking"]
bevy_post_process_bindings = ["bevy_mod_scripting_functions/bevy_post_process"]
bevy_reflect_bindings = ["bevy_mod_scripting_functions/bevy_reflect"]
bevy_render_bindings = ["bevy_mod_scripting_functions/bevy_render"]
bevy_scene_bindings = ["bevy_mod_scripting_functions/bevy_scene"]
bevy_sprite_bindings = ["bevy_mod_scripting_functions/bevy_sprite"]
bevy_sprite_render_bindings = [
"bevy_mod_scripting_functions/bevy_sprite_render",
]
bevy_text_bindings = ["bevy_mod_scripting_functions/bevy_text"]
bevy_time_bindings = ["bevy_mod_scripting_functions/bevy_time"]
bevy_transform_bindings = ["bevy_mod_scripting_functions/bevy_transform"]
bevy_ui_bindings = ["bevy_mod_scripting_functions/bevy_ui"]
bevy_ui_render_bindings = ["bevy_mod_scripting_functions/bevy_ui_render"]

# optional
unsafe_lua_modules = ["bevy_mod_scripting_lua?/unsafe_lua_modules"]
Expand Down Expand Up @@ -140,54 +148,57 @@ bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "

# bevy

bevy = { version = "0.16.0", default-features = false }
bevy_math = { version = "0.16.0", default-features = false, features = ["std"] }
bevy_transform = { version = "0.16.0", default-features = false }
bevy_reflect = { version = "0.16.0", default-features = false }
bevy_ecs = { version = "0.16.0", default-features = false }
bevy_asset = { version = "0.16.0", default-features = false }
bevy_app = { version = "0.16.0", default-features = false }
bevy_log = { version = "0.16.0", default-features = false }
bevy_internal = { version = "0.16.0", default-features = false }
bevy_diagnostic = { version = "0.16.0", default-features = false }
bevy_platform = { version = "0.16.0", default-features = false }
bevy_time = { version = "0.16.0", default-features = false }
bevy_input = { version = "0.16.0", default-features = false }
bevy_a11y = { version = "0.16.0", default-features = false, features = [

bevy = { version = "0.17", default-features = false }
bevy_math = { version = "0.17", default-features = false, features = ["std"] }
bevy_transform = { version = "0.17", default-features = false }
bevy_reflect = { version = "0.17", default-features = false }
bevy_ecs = { version = "0.17", default-features = false }
bevy_asset = { version = "0.17", default-features = false }
bevy_app = { version = "0.17", default-features = false }
bevy_log = { version = "0.17", default-features = false }
bevy_internal = { version = "0.17", default-features = false }
bevy_diagnostic = { version = "0.17", default-features = false }
bevy_platform = { version = "0.17", default-features = false }
bevy_time = { version = "0.17", default-features = false }
bevy_input = { version = "0.17", default-features = false }
bevy_a11y = { version = "0.17", default-features = false, features = [
"std",
"bevy_reflect",
] }
bevy_animation = { version = "0.16.0", default-features = false }
bevy_color = { version = "0.16.0", default-features = false, features = [
bevy_animation = { version = "0.17", default-features = false }
bevy_color = { version = "0.17", default-features = false, features = [
"std",
"bevy_reflect",
] }
bevy_core_pipeline = { version = "0.16.0", default-features = false }
bevy_gizmos = { version = "0.16.0", default-features = false }
bevy_gltf = { version = "0.16.0", default-features = false }
bevy_image = { version = "0.16.0", default-features = false, features = [
bevy_core_pipeline = { version = "0.17", default-features = false }
bevy_gizmos = { version = "0.17", default-features = false }
bevy_gltf = { version = "0.17", default-features = false }
bevy_image = { version = "0.17", default-features = false, features = [
"bevy_reflect",
] }
bevy_input_focus = { version = "0.16.0", default-features = false, features = [
bevy_input_focus = { version = "0.17", default-features = false, features = [
"std",
"bevy_reflect",
] }
bevy_mesh = { version = "0.16.0", default-features = false }
bevy_pbr = { version = "0.16.0", default-features = false }
bevy_picking = { version = "0.16.0", default-features = false }
bevy_render = { version = "0.16.0", default-features = false }
bevy_scene = { version = "0.16.0", default-features = false }
bevy_sprite = { version = "0.16.0", default-features = false }
bevy_text = { version = "0.16.0", default-features = false }
bevy_window = { version = "0.16.0", default-features = false, features = [
bevy_mesh = { version = "0.17", default-features = false }
bevy_pbr = { version = "0.17", default-features = false }
bevy_picking = { version = "0.17", default-features = false }
bevy_render = { version = "0.17", default-features = false }
bevy_scene = { version = "0.17", default-features = false }
bevy_sprite = { version = "0.17", default-features = false }
bevy_text = { version = "0.17", default-features = false }
bevy_window = { version = "0.17", default-features = false, features = [
"bevy_reflect",
"std",
] }
bevy_winit = { version = "0.16.0", default-features = false }
bevy_winit = { version = "0.17", default-features = false }
bevy_utils = { version = "0.17", default-features = false, features = ["std"] }

glam = { version = "0.29.3", default-features = false }
uuid = { version = "1.11", default-features = false }
glam = { version = "0.30.7", default-features = false }
uuid = { version = "1.13", default-features = false }
smol_str = { version = "0.2.0", default-features = false }
nonmax = { version = "0.5", default-features = false, features = ["std"] }

# other
serde_json = { version = "1.0", default-features = false }
Expand Down Expand Up @@ -224,7 +235,7 @@ pretty_assertions = { version = "1.4", default-features = false, features = [
manifest-dir-macros = { version = "0.1.18", default-features = false }
assert_cmd = { version = "2.1", default-features = false }
tokio = { version = "1", default-features = false }
bevy_console = { version = "0.14", default-features = false }
bevy_console = { version = "0.16", default-features = false }
tracing-tracy = { version = "0.11", default-features = false }
libtest-mimic = { version = "0.8", default-features = false }
criterion = { version = "0.5", default-features = false }
Expand All @@ -238,10 +249,13 @@ bevy = { workspace = true, features = [
"bevy_asset",
"bevy_core_pipeline",
"bevy_sprite",
"bevy_sprite_render",
"bevy_state",
"x11",
"bevy_ui",
"default_font",
"custom_cursor",
"debug",
] }
bevy_platform = { workspace = true }
clap = { workspace = true, features = ["derive"] }
Expand Down
13 changes: 6 additions & 7 deletions assets/scripts/game_of_life.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ LifeState = world.get_type_by_name("LifeState")
Settings = world.get_type_by_name("Settings")

info("Lua: The game_of_life.lua script just got loaded")

math.randomseed(os.time())

function fetch_life_state()
Expand Down Expand Up @@ -37,11 +36,11 @@ function on_click(x, y)
local dimensions = settings.physical_grid_dimensions
local screen = settings.display_grid_dimensions

local dimension_x = dimensions._1
local dimension_y = dimensions._2
local dimension_x = dimensions[1]
local dimension_y = dimensions[2]

local screen_x = screen._1
local screen_y = screen._2
local screen_x = screen[1]
local screen_y = screen[2]

local cell_width = screen_x / dimension_x
local cell_height = screen_y / dimension_y
Expand Down Expand Up @@ -78,8 +77,8 @@ function on_update()
local cells = fetch_life_state().cells
local settings = world.get_resource(Settings)
local dimensions = settings.physical_grid_dimensions
local dimension_x = dimensions._1
local dimension_y = dimensions._2
local dimension_x = dimensions[1]
local dimension_y = dimensions[2]

-- primitives are passed by value to lua, keep a hold of old state but turn 255's into 1's
local prev_state = {}
Expand Down
12 changes: 6 additions & 6 deletions assets/scripts/game_of_life.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ fn on_click(x,y) {
let dimensions = settings.physical_grid_dimensions;
let screen = settings.display_grid_dimensions;

let dimension_x = dimensions["_0"];
let dimension_y = dimensions["_1"];
let dimension_x = dimensions[0];
let dimension_y = dimensions[1];

let screen_x = screen["_0"];
let screen_y = screen["_1"];
let screen_x = screen[0];
let screen_y = screen[1];

let cell_width = screen_x / dimension_x;
let cell_height = screen_y / dimension_y;
Expand Down Expand Up @@ -77,8 +77,8 @@ fn on_update() {
// note that here we do not make use of RhaiProxyable and just go off pure reflection
let settings = world.get_resource.call(Settings);
let dimensions = settings.physical_grid_dimensions;
let dimension_x = dimensions["_0"];
let dimension_y = dimensions["_1"];
let dimension_x = dimensions[0];
let dimension_y = dimensions[1];

// primitives are passed by value to rhai, keep a hold of old state but turn 255's into 1's
let prev_state = [];
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/add_system/added_systems_run_in_parallel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ digraph {
node_16 [label="on_test_post_update"];
node_17 [label="custom_system_a"];
node_18 [label="custom_system_b"];
node_19 [label="SystemSet AssetEvents"];
node_19 [label="SystemSet AssetEventSystems"];
node_20 [label="SystemSet GarbageCollection"];
node_21 [label="SystemSet ListeningPhase"];
node_22 [label="SystemSet MachineStartPhase"];
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/add_system/added_systems_run_in_parallel.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ digraph {
node_16 [label="on_test_post_update"];
node_17 [label="custom_system_a"];
node_18 [label="custom_system_b"];
node_19 [label="SystemSet AssetEvents"];
node_19 [label="SystemSet AssetEventSystems"];
node_20 [label="SystemSet GarbageCollection"];
node_21 [label="SystemSet ListeningPhase"];
node_22 [label="SystemSet MachineStartPhase"];
Expand Down
2 changes: 1 addition & 1 deletion codegen/Cargo.bootstrap.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2024"

[dependencies]
bevy_mod_scripting_bindings = { path = "{{BMS_BINDINGS_PATH}}" }
bevy_reflect = { version = "0.16.0", features = [
bevy_reflect = { version = "0.17", features = [
"smol_str",
"glam",
"petgraph",
Expand Down
42 changes: 41 additions & 1 deletion codegen/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@
fn main() {
use std::{
path::{Path, PathBuf},
process::Command,
};

fn rustc_path(channel: &str) -> PathBuf {
let output = Command::new("rustup")
.args(["which", "--toolchain", channel, "rustc"])
.output()
.expect("failed to run rustup which");

let rustc_path = String::from_utf8(output.stdout).unwrap();

PathBuf::from(rustc_path.trim())
}

fn target_libdir(rustc: &Path) -> PathBuf {
let output = Command::new(rustc)
.args(["--print", "target-libdir"])
.output()
.expect("failed to run rustc --print target-libdir");

let libdir = String::from_utf8(output.stdout).unwrap();

PathBuf::from(libdir.trim())
}

pub fn main() {
// Use to set RUSTC_CHANNEL so we can compute target dir from rustc_plugin
let toolchain_toml = include_str!("rust-toolchain.toml");
let toolchain_table = toolchain_toml.parse::<toml::Table>().unwrap();
let toolchain = toolchain_table["toolchain"].as_table().unwrap();
let channel = toolchain["channel"].as_str().unwrap();
println!("cargo:rustc-env=RUSTC_CHANNEL={channel}");

// I believe there was some sort of change in cargo, which motivated this change in the original rustc_plugin:
// https://github.com/cognitive-engineering-lab/rustc_plugin/pull/41
//
// This solves issues with linking to the rustc driver dynamic library, as cargo does not seem to put in the correct LD_LIBRARY_PATH for the driver binary instantiations
// Embedding this in the binary solves the problem
let rustc_path = rustc_path(channel);
let target_libdir = target_libdir(&rustc_path);

println!(
"cargo::rustc-link-arg=-Wl,-rpath,{}",
target_libdir.display()
);
}
Loading
Loading