Skip to content

Conversation

makspll
Copy link
Owner

@makspll makspll commented Aug 24, 2025

Summary

Fixes #460, adds crate_feature_graph calculator which properly calculates all the necessary crates

Adds the following bindings features:

  "bevy_a11y",
  "bevy_animation",
  "bevy_asset",
  "bevy_color",
  "bevy_core_pipeline",
  "bevy_ecs",
  "bevy_gizmos",
  "bevy_gltf",
  "bevy_image",
  "bevy_input",
  "bevy_input_focus",
  "bevy_math",
  "bevy_mesh",
  "bevy_pbr",
  "bevy_picking",
  "bevy_reflect",
  "bevy_render",
  "bevy_scene",
  "bevy_sprite",
  "bevy_text",
  "bevy_time",
  "bevy_transform"

The default feature will only include some:

default = [
    "core_functions",
    "bevy_ecs_bindings",
    "bevy_input_bindings",
    "bevy_math_bindings",
    "bevy_reflect_bindings",
    "bevy_time_bindings",
    "bevy_transform_bindings",
    "bevy_color_bindings",
    "bevy_core_pipeline_bindings",
]

Also improves the interaction of the code generator shells with logging and filtering crates.

Finally splits out the generated bindings into their own crates.

Migration Guide

No migration is necessary, bindings are still aggregated by the bevy_mod_scripting_functions plugin managed by features mentioned above. Simply ensure you're using the features you need

Copy link

semanticdiff-com bot commented Aug 24, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  codegen/src/bin/main.rs  44% smaller
  codegen/src/passes/find_reflect_types.rs  39% smaller
  codegen/src/args.rs  35% smaller
  codegen/src/callback.rs  29% smaller
  codegen/src/bin/driver.rs  26% smaller
  codegen/src/passes/populate_template_data.rs  25% smaller
  codegen/src/passes/codegen.rs  24% smaller
  codegen/src/passes/find_methods_and_fields.rs  18% smaller
  crates/bevy_mod_scripting_functions/src/core.rs  18% smaller
  xtask/src/main.rs  18% smaller
  codegen/src/driver/mod.rs  11% smaller
  .gitattributes Unsupported file format
  .github/workflows/bevy_mod_scripting.yml  0% smaller
  .github/workflows/synchronize_bindings.yml  0% smaller
  Cargo.toml Unsupported file format
  check.sh Unsupported file format
  codegen/.cargo/config.toml Unsupported file format
  codegen/Cargo.toml Unsupported file format
  codegen/crates/crate_feature_graph/Cargo.toml Unsupported file format
  codegen/crates/crate_feature_graph/README.md Unsupported file format
  codegen/crates/crate_feature_graph/bin/main.rs  0% smaller
  codegen/crates/crate_feature_graph/example.png Unsupported file format
  codegen/crates/crate_feature_graph/src/feature.rs  0% smaller
  codegen/crates/crate_feature_graph/src/graph.rs  0% smaller
  codegen/crates/crate_feature_graph/src/lib.rs  0% smaller
  codegen/crates/test_crates/workspace/root/Cargo.toml Unsupported file format
  codegen/crates/test_crates/workspace/root/children/crate_a/Cargo.toml Unsupported file format
  codegen/crates/test_crates/workspace/root/children/crate_a/src/lib.rs  0% smaller
  codegen/crates/test_crates/workspace/root/children/crate_b/Cargo.toml Unsupported file format
  codegen/crates/test_crates/workspace/root/children/crate_b/src/lib.rs  0% smaller
  codegen/src/context.rs  0% smaller
  codegen/src/feature_graph.rs  0% smaller
  codegen/src/lib.rs  0% smaller
  codegen/src/meta.rs  0% smaller
  codegen/src/modifying_file_loader.rs  0% smaller
  codegen/src/passes/write_meta.rs  0% smaller
  codegen/src/plugin.rs  0% smaller
  codegen/templates/crate.tera Unsupported file format
  codegen/templates/footer.tera Unsupported file format
  codegen/templates/header.tera Unsupported file format
  codegen/templates/mod.tera Unsupported file format
  codegen_bevy_features.txt Unsupported file format
  crates/bevy_mod_scripting_functions/Cargo.toml Unsupported file format
  crates/bevy_mod_scripting_functions/src/bevy_bindings/.gitignore Unsupported file format
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs  0% smaller
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs  0% smaller
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs  0% smaller
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs Unsupported file format
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs  0% smaller
  crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs  0% smaller
  crates/bevy_mod_scripting_functions/src/bevy_bindings/mod.rs  0% smaller
  crates/bevy_mod_scripting_functions/src/lib.rs  0% smaller
  crates/bindings/bevy_a11y_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_a11y_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_a11y_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_animation_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_animation_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_animation_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_asset_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_asset_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_asset_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_color_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_color_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_color_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_core_pipeline_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_core_pipeline_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_core_pipeline_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_ecs_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_ecs_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_ecs_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_gizmos_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_gizmos_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_gizmos_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_gltf_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_gltf_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_gltf_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_image_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_image_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_image_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_input_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_input_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_input_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_input_focus_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_input_focus_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_input_focus_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_math_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_math_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_math_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_mesh_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_mesh_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_mesh_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_pbr_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_pbr_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_pbr_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_picking_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_picking_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_picking_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_reflect_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_reflect_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_reflect_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_render_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_render_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_render_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_scene_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_scene_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_scene_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_sprite_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_sprite_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_sprite_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_text_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_text_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_text_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_time_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_time_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_time_bms_bindings/src/lib.rs  0% smaller
  crates/bindings/bevy_transform_bms_bindings/Cargo.toml Unsupported file format
  crates/bindings/bevy_transform_bms_bindings/README.md Unsupported file format
  crates/bindings/bevy_transform_bms_bindings/src/lib.rs  0% smaller
  docs/src/Summary/installation.md Unsupported file format
  xtask/Cargo.toml Unsupported file format
  xtask/src/binding_crate.rs  0% smaller
  xtask/src/codegen_meta.rs  0% smaller
  xtask/src/lib.rs  0% smaller
  xtask/templates/bindings_crate.readme.tera Unsupported file format
  xtask/templates/bindings_crate.toml.tera Unsupported file format

Copy link
Contributor

github-actions bot commented Aug 24, 2025

🐰 Bencher Report

Branchfeat/improve-codegen-crate-calculation
Testbedlinux-gha
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
nanoseconds (ns)
(Result Δ%)
Upper Boundary
nanoseconds (ns)
(Limit %)
component/access Lua📈 view plot
🚷 view threshold
3,598.60 ns
(-11.04%)Baseline: 4,045.27 ns
4,511.14 ns
(79.77%)
component/access Rhai📈 view plot
🚷 view threshold
5,478.90 ns
(-6.80%)Baseline: 5,878.42 ns
6,414.13 ns
(85.42%)
component/get Lua📈 view plot
🚷 view threshold
2,260.80 ns
(-7.41%)Baseline: 2,441.71 ns
2,703.38 ns
(83.63%)
component/get Rhai📈 view plot
🚷 view threshold
4,180.90 ns
(-4.55%)Baseline: 4,380.40 ns
4,731.23 ns
(88.37%)
conversions/Mut::from📈 view plot
🚷 view threshold
86.85 ns
(-2.95%)Baseline: 89.49 ns
113.30 ns
(76.65%)
conversions/Ref::from📈 view plot
🚷 view threshold
82.83 ns
(-4.60%)Baseline: 86.82 ns
111.53 ns
(74.26%)
conversions/ScriptValue::List📈 view plot
🚷 view threshold
300.95 ns
(+6.84%)Baseline: 281.67 ns
324.24 ns
(92.82%)
conversions/ScriptValue::Map📈 view plot
🚷 view threshold
1,028.80 ns
(-18.96%)Baseline: 1,269.52 ns
1,607.43 ns
(64.00%)
conversions/ScriptValue::Reference::from_into📈 view plot
🚷 view threshold
26.33 ns
(-2.36%)Baseline: 26.97 ns
50.70 ns
(51.93%)
conversions/Val::from_into📈 view plot
🚷 view threshold
285.79 ns
(-6.61%)Baseline: 306.02 ns
358.92 ns
(79.63%)
function/call 4 args Lua📈 view plot
🚷 view threshold
1,580.00 ns
(-15.66%)Baseline: 1,873.39 ns
2,183.65 ns
(72.36%)
function/call 4 args Rhai📈 view plot
🚷 view threshold
1,322.70 ns
(-14.71%)Baseline: 1,550.78 ns
1,833.64 ns
(72.14%)
function/call Lua📈 view plot
🚷 view threshold
213.65 ns
(-10.86%)Baseline: 239.69 ns
265.19 ns
(80.56%)
function/call Rhai📈 view plot
🚷 view threshold
382.11 ns
(-18.38%)Baseline: 468.18 ns
575.37 ns
(66.41%)
loading/empty Lua📈 view plot
🚷 view threshold
52,130.00 ns
(-18.75%)Baseline: 64,161.20 ns
75,735.32 ns
(68.83%)
loading/empty Rhai📈 view plot
🚷 view threshold
304,350.00 ns
(-18.27%)Baseline: 372,367.00 ns
459,335.79 ns
(66.26%)
math/vec mat ops Lua📈 view plot
🚷 view threshold
7,104.60 ns
(-6.40%)Baseline: 7,590.79 ns
8,761.35 ns
(81.09%)
math/vec mat ops Rhai📈 view plot
🚷 view threshold
6,015.60 ns
(-12.40%)Baseline: 6,866.76 ns
7,801.84 ns
(77.10%)
query/10 entities Lua📈 view plot
🚷 view threshold
18,701.00 ns
(-12.36%)Baseline: 21,339.40 ns
24,351.15 ns
(76.80%)
query/10 entities Rhai📈 view plot
🚷 view threshold
18,754.00 ns
(-11.58%)Baseline: 21,209.80 ns
24,353.94 ns
(77.01%)
query/100 entities Lua📈 view plot
🚷 view threshold
39,103.00 ns
(-9.55%)Baseline: 43,233.10 ns
47,512.60 ns
(82.30%)
query/100 entities Rhai📈 view plot
🚷 view threshold
31,991.00 ns
(-3.91%)Baseline: 33,291.90 ns
36,364.78 ns
(87.97%)
query/1000 entities Lua📈 view plot
🚷 view threshold
259,610.00 ns
(-8.09%)Baseline: 282,462.00 ns
314,221.13 ns
(82.62%)
query/1000 entities Rhai📈 view plot
🚷 view threshold
195,060.00 ns
(+10.15%)Baseline: 177,078.00 ns
199,851.71 ns
(97.60%)
reflection/10 Lua📈 view plot
🚷 view threshold
5,495.50 ns
(-11.64%)Baseline: 6,219.44 ns
6,992.78 ns
(78.59%)
reflection/10 Rhai📈 view plot
🚷 view threshold
14,648.00 ns
(-9.55%)Baseline: 16,194.40 ns
18,086.18 ns
(80.99%)
reflection/100 Lua📈 view plot
🚷 view threshold
47,037.00 ns
(-9.30%)Baseline: 51,858.80 ns
57,896.36 ns
(81.24%)
reflection/100 Rhai📈 view plot
🚷 view threshold
721,390.00 ns
(-5.17%)Baseline: 760,729.00 ns
846,222.76 ns
(85.25%)
resource/access Lua📈 view plot
🚷 view threshold
3,228.70 ns
(-11.89%)Baseline: 3,664.42 ns
4,167.89 ns
(77.47%)
resource/access Rhai📈 view plot
🚷 view threshold
4,958.00 ns
(-7.46%)Baseline: 5,357.93 ns
5,900.73 ns
(84.02%)
resource/get Lua📈 view plot
🚷 view threshold
1,925.90 ns
(-8.19%)Baseline: 2,097.65 ns
2,341.42 ns
(82.25%)
resource/get Rhai📈 view plot
🚷 view threshold
3,804.50 ns
(-2.38%)Baseline: 3,897.28 ns
4,273.19 ns
(89.03%)
🐰 View full continuous benchmarking report in Bencher

@makspll makspll changed the title feat: improve codegen crate calculation feat: improve codegen crate calculation, add more binding features Aug 24, 2025
@makspll makspll enabled auto-merge (squash) August 24, 2025 20:37
@makspll makspll disabled auto-merge August 24, 2025 20:57
@makspll makspll enabled auto-merge (squash) August 24, 2025 21:01
@makspll makspll disabled auto-merge August 25, 2025 02:34
@makspll makspll changed the title feat: improve codegen crate calculation, add more binding features feat: improve codegen crate calculation, separate bindings into crates Aug 25, 2025
@makspll makspll enabled auto-merge (squash) August 25, 2025 16:07
@makspll makspll disabled auto-merge August 25, 2025 19:23
@makspll makspll merged commit 10382f4 into main Aug 25, 2025
21 checks passed
@makspll makspll deleted the feat/improve-codegen-crate-calculation branch August 25, 2025 19:23
@github-actions github-actions bot mentioned this pull request Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Incomplete Codegen
1 participant