NB4a: an Engine adds only the catalog plugins its project chooses; raea-cli's catalog feature compiles them all in

package.json raea.plugins (a list of names, or declarations keyed by name) chooses them, a scene's components and
resources under a plugin's crate add that plugin, and each chosen plugin brings the ones it needs. raea's own
registrations and a build without the catalog are unchanged. The run's trace records what was chosen and why
(plugins_chosen), and a name the build lacks is said once. sync writes engine/bevy-plugins' catalog feature: every
declared plugin but those declared "catalog": false (bevy, Bevy's optional features). tools/nobuild.sh catalog renders
and plays a project choosing avian and hanabi, and compares scenes that choose none against a raea without the catalog.
This commit is contained in:
shinyobjectz committed 2026-11-22 09:15:58 -08:00
1 parent 1dee25c609
commit f2bf93cbee
17 files changed
+365 -72

No files matched your search

Generated
+1
View File
@@ -15442,6 +15442,7 @@ dependencies = [
"raea-bevy-world",
"raea-core-program",
"raea-core-shape",
"raea-io-trace",
"raea-sys-frame",
"raea-sys-material",
"raea-sys-shader",
+1
View File
@@ -126,6 +126,7 @@ tweening = ["dep:bevy_tweening", "raea-bevy-calls/tweening"]
vector_shapes = ["dep:bevy_vector_shapes"]
vox = ["dep:bevy_vox_scene"]
yoleck = ["dep:bevy-yoleck", "egui"]
catalog = ["aseprite", "asset_loader", "avian", "avian2d", "big_space", "common_assets", "console", "debugdump", "easings", "egui", "enhanced_input", "enoki", "flair", "hanabi", "http", "hui", "inspector", "kira", "ldtk", "leafwing", "light_2d", "lightyear", "lookup_curve", "navigator", "noise", "noisy", "northstar", "obj", "pancam", "panorbit", "proc_gen", "progress", "quinnet", "rand", "rapier2d", "rapier3d", "remote", "save", "simple_tilemap", "skein", "smud", "sprite3d", "spritesheet", "swatch", "text3d", "tiled", "tilemap", "tnua", "trauma_shake", "trenchbroom", "tween", "tweening", "vector_shapes", "vox", "yoleck"]
# <<< declared features
# Optional dependencies a feature turns on for what they change elsewhere, not for code here: lightyear_core's
+56 -56
View File
@@ -126,61 +126,61 @@ pub fn install() {
pub fn declared() -> Vec<Declared> {
#[allow(unused_mut)]
let mut v = Vec::new();
#[cfg(feature = "aseprite")] v.push(Declared { name: "aseprite", krate: "bevy_aseprite_ultra", source: "version = \"=0.10.0\"", prefixes: &["bevy_aseprite_ultra::"], headless: &[], on_demand: false });
#[cfg(feature = "asset_loader")] v.push(Declared { name: "asset_loader", krate: "bevy_asset_loader", source: "version = \"=0.28.1\"", prefixes: &["bevy_asset_loader::"], headless: &[], on_demand: false });
#[cfg(feature = "avian")] v.push(Declared { name: "avian", krate: "avian3d", source: "version = \"=0.8.0\"", prefixes: &["avian3d::", "bevy_transform_interpolation::"], headless: &["assets", "mesh"], on_demand: false });
#[cfg(feature = "avian2d")] v.push(Declared { name: "avian2d", krate: "avian2d", source: "version = \"=0.8.0\"", prefixes: &["avian2d::"], headless: &[], on_demand: true });
v.push(Declared { name: "bevy", krate: "bevy", source: "version = \"=0.20.0\"", prefixes: &["bevy_gilrs::", "bevy_input::", "bevy_picking::", "bevy_gizmos::", "bevy_dev_tools::", "bevy_audio::", "bevy_camera_controller::", "bevy_feathers::", "bevy_ui_widgets::", "bevy_input_focus::", "bevy_light::", "bevy_solari::", "bevy_pbr::", "bevy_a11y::", "bevy_animation::", "bevy_anti_alias::", "bevy_app::", "bevy_asset::", "bevy_camera::", "bevy_core_pipeline::", "bevy_ecs::", "bevy_gizmos_render::", "bevy_gltf::", "bevy_image::", "bevy_mesh::", "bevy_post_process::", "bevy_render::", "bevy_scene::", "bevy_sprite::", "bevy_sprite_render::", "bevy_text::", "bevy_time::", "bevy_transform::", "bevy_ui::", "bevy_ui_render::", "bevy_window::", "bevy_world_serialization::"], headless: &["assets", "mesh", "image", "input", "primary-window", "picking"], on_demand: false });
#[cfg(feature = "big_space")] v.push(Declared { name: "big_space", krate: "big_space", source: "version = \"=0.14.0-rc.0\"", prefixes: &["big_space::"], headless: &["own-transform", "input"], on_demand: true });
#[cfg(feature = "common_assets")] v.push(Declared { name: "common_assets", krate: "bevy_common_assets", source: "version = \"=0.18.0\"", prefixes: &["bevy_common_assets::", "raea_bevy_plugins::common_assets::"], headless: &["assets"], on_demand: false });
#[cfg(feature = "console")] v.push(Declared { name: "console", krate: "bevy_console", source: "version = \"=0.19.0\"", prefixes: &["bevy_console::"], headless: &["shader", "image", "input", "window"], on_demand: false });
#[cfg(feature = "debugdump")] v.push(Declared { name: "debugdump", krate: "bevy_mod_debugdump", source: "version = \"=0.17.0\"", prefixes: &["bevy_mod_debugdump::"], headless: &[], on_demand: false });
#[cfg(feature = "easings")] v.push(Declared { name: "easings", krate: "bevy_easings", source: "version = \"=0.20.0\"", prefixes: &["bevy_easings::", "raea_bevy_adapters::easings::"], headless: &[], on_demand: false });
#[cfg(feature = "egui")] v.push(Declared { name: "egui", krate: "bevy_egui", source: "version = \"=0.43.1\"", prefixes: &["bevy_egui::"], headless: &["shader", "image", "input", "window"], on_demand: false });
#[cfg(feature = "enhanced_input")] v.push(Declared { name: "enhanced_input", krate: "bevy_enhanced_input", source: "version = \"=0.27.0\"", prefixes: &["bevy_enhanced_input::", "raea_bevy_plugins::enhanced_input::"], headless: &["input"], on_demand: false });
#[cfg(feature = "enoki")] v.push(Declared { name: "enoki", krate: "bevy_enoki", source: "version = \"=0.8.0\"", prefixes: &["bevy_enoki::", "raea_bevy_adapters::enoki::"], headless: &[], on_demand: false });
#[cfg(feature = "flair")] v.push(Declared { name: "flair", krate: "bevy_flair", source: "version = \"=0.9.0\"", prefixes: &["bevy_flair::", "bevy_flair_core::", "bevy_flair_style::"], headless: &[], on_demand: false });
#[cfg(feature = "hanabi")] v.push(Declared { name: "hanabi", krate: "bevy_hanabi", source: "git = \"https://github.com/djeedai/bevy_hanabi\", rev = \"77630ff1eed8b104f34e91d23e9440428dc5ab01\"", prefixes: &["bevy_hanabi::", "raea_bevy_plugins::hanabi::"], headless: &[], on_demand: false });
#[cfg(feature = "http")] v.push(Declared { name: "http", krate: "bevy_http_client", source: "version = \"=0.12.0\"", prefixes: &["bevy_http_client::"], headless: &[], on_demand: false });
#[cfg(feature = "hui")] v.push(Declared { name: "hui", krate: "bevy_hui", source: "version = \"=0.8.0\"", prefixes: &["bevy_hui::"], headless: &[], on_demand: false });
#[cfg(feature = "inspector")] v.push(Declared { name: "inspector", krate: "bevy-inspector-egui", source: "version = \"=0.38.0\"", prefixes: &["bevy_inspector_egui::"], headless: &[], on_demand: true });
#[cfg(feature = "kira")] v.push(Declared { name: "kira", krate: "bevy_kira_audio", source: "version = \"=0.27.1\"", prefixes: &["bevy_kira_audio::"], headless: &["assets"], on_demand: true });
#[cfg(feature = "ldtk")] v.push(Declared { name: "ldtk", krate: "bevy_ecs_ldtk", source: "version = \"=0.16.0\"", prefixes: &["bevy_ecs_ldtk::", "raea_bevy_adapters::ldtk::"], headless: &[], on_demand: false });
#[cfg(feature = "leafwing")] v.push(Declared { name: "leafwing", krate: "leafwing-input-manager", source: "version = \"=0.22.0\"", prefixes: &["leafwing_input_manager::", "raea_bevy_plugins::leafwing::"], headless: &["input"], on_demand: false });
#[cfg(feature = "light_2d")] v.push(Declared { name: "light_2d", krate: "bevy_light_2d", source: "version = \"=0.11.0\"", prefixes: &["bevy_light_2d::", "raea_bevy_adapters::light_2d::"], headless: &[], on_demand: false });
#[cfg(feature = "lightyear")] v.push(Declared { name: "lightyear", krate: "lightyear", source: "version = \"=0.31.0\"", prefixes: &["lightyear", "bevy_replicon::", "raea_bevy_plugins::lightyear::", "aeronet_io::"], headless: &[], on_demand: true });
#[cfg(feature = "lookup_curve")] v.push(Declared { name: "lookup_curve", krate: "bevy_lookup_curve", source: "version = \"=0.13.0\"", prefixes: &["bevy_lookup_curve::"], headless: &["assets"], on_demand: false });
#[cfg(feature = "navigator")] v.push(Declared { name: "navigator", krate: "vleue_navigator", source: "version = \"=0.17.0\"", prefixes: &["vleue_navigator::"], headless: &["assets", "mesh", "gizmos"], on_demand: false });
#[cfg(feature = "noise")] v.push(Declared { name: "noise", krate: "noise", source: "version = \"=0.9.0\"", prefixes: &["noise::"], headless: &[], on_demand: false });
#[cfg(feature = "noisy")] v.push(Declared { name: "noisy", krate: "noisy_bevy", source: "version = \"=0.15.0\"", prefixes: &["noisy_bevy::"], headless: &["shader"], on_demand: false });
#[cfg(feature = "northstar")] v.push(Declared { name: "northstar", krate: "bevy_northstar", source: "version = \"=0.8.0\"", prefixes: &["bevy_northstar::"], headless: &[], on_demand: false });
#[cfg(feature = "obj")] v.push(Declared { name: "obj", krate: "bevy_obj", source: "version = \"=0.20.0\"", prefixes: &["bevy_obj::"], headless: &["assets", "mesh", "pbr"], on_demand: false });
#[cfg(feature = "pancam")] v.push(Declared { name: "pancam", krate: "bevy_pancam", source: "version = \"=0.22.0\"", prefixes: &["bevy_pancam::"], headless: &["input", "primary-window"], on_demand: false });
#[cfg(feature = "panorbit")] v.push(Declared { name: "panorbit", krate: "bevy_panorbit_camera", source: "version = \"=0.36.0\"", prefixes: &["bevy_panorbit_camera::"], headless: &[], on_demand: false });
#[cfg(feature = "proc_gen")] v.push(Declared { name: "proc_gen", krate: "bevy_ghx_proc_gen", source: "version = \"=0.10.0\"", prefixes: &["bevy_ghx_proc_gen::", "ghx_proc_gen::", "ghx_grid::", "bevy_ghx_grid::"], headless: &[], on_demand: false });
#[cfg(feature = "progress")] v.push(Declared { name: "progress", krate: "iyes_progress", source: "version = \"=0.18.0\"", prefixes: &["iyes_progress::"], headless: &[], on_demand: false });
#[cfg(feature = "quinnet")] v.push(Declared { name: "quinnet", krate: "bevy_quinnet", source: "version = \"=0.22.0\"", prefixes: &["bevy_quinnet::"], headless: &[], on_demand: true });
#[cfg(feature = "rand")] v.push(Declared { name: "rand", krate: "bevy_rand", source: "version = \"=0.16.0\"", prefixes: &["bevy_rand::", "bevy_prng::"], headless: &[], on_demand: false });
#[cfg(feature = "rapier2d")] v.push(Declared { name: "rapier2d", krate: "bevy_rapier2d", source: "version = \"=0.37.0\"", prefixes: &["bevy_rapier2d::", "raea_bevy_adapters::rapier2d::"], headless: &[], on_demand: false });
#[cfg(feature = "rapier3d")] v.push(Declared { name: "rapier3d", krate: "bevy_rapier3d", source: "version = \"=0.37.0\"", prefixes: &["bevy_rapier3d::", "raea_bevy_adapters::rapier3d::"], headless: &[], on_demand: false });
v.push(Declared { name: "remote", krate: "bevy_remote", source: "version = \"=0.20.0\"", prefixes: &["bevy_remote::"], headless: &[], on_demand: false });
#[cfg(feature = "save")] v.push(Declared { name: "save", krate: "moonshine-save", source: "version = \"=0.8.0\"", prefixes: &["moonshine_save::"], headless: &["assets"], on_demand: false });
#[cfg(feature = "simple_tilemap")] v.push(Declared { name: "simple_tilemap", krate: "bevy_simple_tilemap", source: "version = \"=0.21.0\"", prefixes: &["bevy_simple_tilemap::"], headless: &["shader", "image"], on_demand: false });
#[cfg(feature = "skein")] v.push(Declared { name: "skein", krate: "bevy_skein", source: "version = \"=0.7.0-rc.1\"", prefixes: &["bevy_skein::"], headless: &[], on_demand: false });
#[cfg(feature = "smud")] v.push(Declared { name: "smud", krate: "bevy_smud", source: "version = \"=0.15.0\"", prefixes: &["bevy_smud::"], headless: &["shader", "mesh"], on_demand: false });
#[cfg(feature = "sprite3d")] v.push(Declared { name: "sprite3d", krate: "bevy_sprite3d", source: "version = \"=10.1.0\"", prefixes: &["bevy_sprite3d::", "raea_bevy_calls::sprite3d::"], headless: &["image", "mesh", "pbr"], on_demand: false });
#[cfg(feature = "spritesheet")] v.push(Declared { name: "spritesheet", krate: "bevy_spritesheet_animation", source: "version = \"=8.0.1\"", prefixes: &["bevy_spritesheet_animation::", "raea_bevy_adapters::spritesheet::"], headless: &[], on_demand: false });
#[cfg(feature = "swatch")] v.push(Declared { name: "swatch", krate: "raea-bench-swatch", source: "path = \"../../bench/bridge/swatch\"", prefixes: &["raea_bench_swatch::"], headless: &[], on_demand: false });
#[cfg(feature = "text3d")] v.push(Declared { name: "text3d", krate: "bevy_rich_text3d", source: "version = \"=0.8.0\"", prefixes: &["bevy_rich_text3d::", "raea_bevy_adapters::text3d::"], headless: &[], on_demand: false });
#[cfg(feature = "tiled")] v.push(Declared { name: "tiled", krate: "bevy_ecs_tiled", source: "version = \"=0.14.0\"", prefixes: &["bevy_ecs_tiled::"], headless: &[], on_demand: false });
#[cfg(feature = "tilemap")] v.push(Declared { name: "tilemap", krate: "bevy_ecs_tilemap", source: "version = \"=0.20.0\"", prefixes: &["bevy_ecs_tilemap::"], headless: &[], on_demand: false });
#[cfg(feature = "tnua")] v.push(Declared { name: "tnua", krate: "bevy-tnua", source: "version = \"=0.33.0\"", prefixes: &["bevy_tnua", "raea_bevy_plugins::tnua::"], headless: &["assets", "mesh"], on_demand: false });
#[cfg(feature = "trauma_shake")] v.push(Declared { name: "trauma_shake", krate: "bevy_trauma_shake", source: "version = \"=0.9.0\"", prefixes: &["bevy_trauma_shake::"], headless: &[], on_demand: false });
#[cfg(feature = "trenchbroom")] v.push(Declared { name: "trenchbroom", krate: "bevy_trenchbroom", source: "version = \"=0.15.0\"", prefixes: &["bevy_trenchbroom::", "bevy_materialize::"], headless: &["assets", "mesh", "shader", "image", "pbr"], on_demand: false });
#[cfg(feature = "tween")] v.push(Declared { name: "tween", krate: "bevy_tween", source: "version = \"=0.14.1\"", prefixes: &["bevy_tween::", "bevy_time_runner::"], headless: &[], on_demand: false });
#[cfg(feature = "tweening")] v.push(Declared { name: "tweening", krate: "bevy_tweening", source: "git = \"https://github.com/djeedai/bevy_tweening\", rev = \"2341b0c3e4d18cc11825ba2d7cd6c5f6f41f4152\"", prefixes: &["bevy_tweening::"], headless: &[], on_demand: false });
#[cfg(feature = "vector_shapes")] v.push(Declared { name: "vector_shapes", krate: "bevy_vector_shapes", source: "version = \"=0.14.0\"", prefixes: &["bevy_vector_shapes::"], headless: &[], on_demand: false });
#[cfg(feature = "vox")] v.push(Declared { name: "vox", krate: "bevy_vox_scene", source: "version = \"=0.23.0\"", prefixes: &["bevy_vox_scene::", "flipbook::"], headless: &["assets", "mesh", "image", "pbr", "scene"], on_demand: false });
#[cfg(feature = "yoleck")] v.push(Declared { name: "yoleck", krate: "bevy-yoleck", source: "version = \"=0.34.0\"", prefixes: &["bevy_yoleck::"], headless: &[], on_demand: false });
#[cfg(feature = "aseprite")] v.push(Declared { name: "aseprite", krate: "bevy_aseprite_ultra", source: "version = \"=0.10.0\"", prefixes: &["bevy_aseprite_ultra::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "asset_loader")] v.push(Declared { name: "asset_loader", krate: "bevy_asset_loader", source: "version = \"=0.28.1\"", prefixes: &["bevy_asset_loader::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "avian")] v.push(Declared { name: "avian", krate: "avian3d", source: "version = \"=0.8.0\"", prefixes: &["avian3d::", "bevy_transform_interpolation::"], needs: &[], headless: &["assets", "mesh"], on_demand: false });
#[cfg(feature = "avian2d")] v.push(Declared { name: "avian2d", krate: "avian2d", source: "version = \"=0.8.0\"", prefixes: &["avian2d::"], needs: &[], headless: &[], on_demand: true });
v.push(Declared { name: "bevy", krate: "bevy", source: "version = \"=0.20.0\"", prefixes: &["bevy_gilrs::", "bevy_input::", "bevy_picking::", "bevy_gizmos::", "bevy_dev_tools::", "bevy_audio::", "bevy_camera_controller::", "bevy_feathers::", "bevy_ui_widgets::", "bevy_input_focus::", "bevy_light::", "bevy_solari::", "bevy_pbr::", "bevy_a11y::", "bevy_animation::", "bevy_anti_alias::", "bevy_app::", "bevy_asset::", "bevy_camera::", "bevy_core_pipeline::", "bevy_ecs::", "bevy_gizmos_render::", "bevy_gltf::", "bevy_image::", "bevy_mesh::", "bevy_post_process::", "bevy_render::", "bevy_scene::", "bevy_sprite::", "bevy_sprite_render::", "bevy_text::", "bevy_time::", "bevy_transform::", "bevy_ui::", "bevy_ui_render::", "bevy_window::", "bevy_world_serialization::"], needs: &[], headless: &["assets", "mesh", "image", "input", "primary-window", "picking"], on_demand: false });
#[cfg(feature = "big_space")] v.push(Declared { name: "big_space", krate: "big_space", source: "version = \"=0.14.0-rc.0\"", prefixes: &["big_space::"], needs: &[], headless: &["own-transform", "input"], on_demand: true });
#[cfg(feature = "common_assets")] v.push(Declared { name: "common_assets", krate: "bevy_common_assets", source: "version = \"=0.18.0\"", prefixes: &["bevy_common_assets::", "raea_bevy_plugins::common_assets::"], needs: &[], headless: &["assets"], on_demand: false });
#[cfg(feature = "console")] v.push(Declared { name: "console", krate: "bevy_console", source: "version = \"=0.19.0\"", prefixes: &["bevy_console::"], needs: &["egui"], headless: &["shader", "image", "input", "window"], on_demand: false });
#[cfg(feature = "debugdump")] v.push(Declared { name: "debugdump", krate: "bevy_mod_debugdump", source: "version = \"=0.17.0\"", prefixes: &["bevy_mod_debugdump::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "easings")] v.push(Declared { name: "easings", krate: "bevy_easings", source: "version = \"=0.20.0\"", prefixes: &["bevy_easings::", "raea_bevy_adapters::easings::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "egui")] v.push(Declared { name: "egui", krate: "bevy_egui", source: "version = \"=0.43.1\"", prefixes: &["bevy_egui::"], needs: &[], headless: &["shader", "image", "input", "window"], on_demand: false });
#[cfg(feature = "enhanced_input")] v.push(Declared { name: "enhanced_input", krate: "bevy_enhanced_input", source: "version = \"=0.27.0\"", prefixes: &["bevy_enhanced_input::", "raea_bevy_plugins::enhanced_input::"], needs: &[], headless: &["input"], on_demand: false });
#[cfg(feature = "enoki")] v.push(Declared { name: "enoki", krate: "bevy_enoki", source: "version = \"=0.8.0\"", prefixes: &["bevy_enoki::", "raea_bevy_adapters::enoki::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "flair")] v.push(Declared { name: "flair", krate: "bevy_flair", source: "version = \"=0.9.0\"", prefixes: &["bevy_flair::", "bevy_flair_core::", "bevy_flair_style::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "hanabi")] v.push(Declared { name: "hanabi", krate: "bevy_hanabi", source: "git = \"https://github.com/djeedai/bevy_hanabi\", rev = \"77630ff1eed8b104f34e91d23e9440428dc5ab01\"", prefixes: &["bevy_hanabi::", "raea_bevy_plugins::hanabi::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "http")] v.push(Declared { name: "http", krate: "bevy_http_client", source: "version = \"=0.12.0\"", prefixes: &["bevy_http_client::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "hui")] v.push(Declared { name: "hui", krate: "bevy_hui", source: "version = \"=0.8.0\"", prefixes: &["bevy_hui::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "inspector")] v.push(Declared { name: "inspector", krate: "bevy-inspector-egui", source: "version = \"=0.38.0\"", prefixes: &["bevy_inspector_egui::"], needs: &["egui"], headless: &[], on_demand: true });
#[cfg(feature = "kira")] v.push(Declared { name: "kira", krate: "bevy_kira_audio", source: "version = \"=0.27.1\"", prefixes: &["bevy_kira_audio::"], needs: &[], headless: &["assets"], on_demand: true });
#[cfg(feature = "ldtk")] v.push(Declared { name: "ldtk", krate: "bevy_ecs_ldtk", source: "version = \"=0.16.0\"", prefixes: &["bevy_ecs_ldtk::", "raea_bevy_adapters::ldtk::"], needs: &["tilemap"], headless: &[], on_demand: false });
#[cfg(feature = "leafwing")] v.push(Declared { name: "leafwing", krate: "leafwing-input-manager", source: "version = \"=0.22.0\"", prefixes: &["leafwing_input_manager::", "raea_bevy_plugins::leafwing::"], needs: &[], headless: &["input"], on_demand: false });
#[cfg(feature = "light_2d")] v.push(Declared { name: "light_2d", krate: "bevy_light_2d", source: "version = \"=0.11.0\"", prefixes: &["bevy_light_2d::", "raea_bevy_adapters::light_2d::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "lightyear")] v.push(Declared { name: "lightyear", krate: "lightyear", source: "version = \"=0.31.0\"", prefixes: &["lightyear", "bevy_replicon::", "raea_bevy_plugins::lightyear::", "aeronet_io::"], needs: &[], headless: &[], on_demand: true });
#[cfg(feature = "lookup_curve")] v.push(Declared { name: "lookup_curve", krate: "bevy_lookup_curve", source: "version = \"=0.13.0\"", prefixes: &["bevy_lookup_curve::"], needs: &[], headless: &["assets"], on_demand: false });
#[cfg(feature = "navigator")] v.push(Declared { name: "navigator", krate: "vleue_navigator", source: "version = \"=0.17.0\"", prefixes: &["vleue_navigator::"], needs: &[], headless: &["assets", "mesh", "gizmos"], on_demand: false });
#[cfg(feature = "noise")] v.push(Declared { name: "noise", krate: "noise", source: "version = \"=0.9.0\"", prefixes: &["noise::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "noisy")] v.push(Declared { name: "noisy", krate: "noisy_bevy", source: "version = \"=0.15.0\"", prefixes: &["noisy_bevy::"], needs: &[], headless: &["shader"], on_demand: false });
#[cfg(feature = "northstar")] v.push(Declared { name: "northstar", krate: "bevy_northstar", source: "version = \"=0.8.0\"", prefixes: &["bevy_northstar::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "obj")] v.push(Declared { name: "obj", krate: "bevy_obj", source: "version = \"=0.20.0\"", prefixes: &["bevy_obj::"], needs: &[], headless: &["assets", "mesh", "pbr"], on_demand: false });
#[cfg(feature = "pancam")] v.push(Declared { name: "pancam", krate: "bevy_pancam", source: "version = \"=0.22.0\"", prefixes: &["bevy_pancam::"], needs: &[], headless: &["input", "primary-window"], on_demand: false });
#[cfg(feature = "panorbit")] v.push(Declared { name: "panorbit", krate: "bevy_panorbit_camera", source: "version = \"=0.36.0\"", prefixes: &["bevy_panorbit_camera::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "proc_gen")] v.push(Declared { name: "proc_gen", krate: "bevy_ghx_proc_gen", source: "version = \"=0.10.0\"", prefixes: &["bevy_ghx_proc_gen::", "ghx_proc_gen::", "ghx_grid::", "bevy_ghx_grid::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "progress")] v.push(Declared { name: "progress", krate: "iyes_progress", source: "version = \"=0.18.0\"", prefixes: &["iyes_progress::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "quinnet")] v.push(Declared { name: "quinnet", krate: "bevy_quinnet", source: "version = \"=0.22.0\"", prefixes: &["bevy_quinnet::"], needs: &[], headless: &[], on_demand: true });
#[cfg(feature = "rand")] v.push(Declared { name: "rand", krate: "bevy_rand", source: "version = \"=0.16.0\"", prefixes: &["bevy_rand::", "bevy_prng::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "rapier2d")] v.push(Declared { name: "rapier2d", krate: "bevy_rapier2d", source: "version = \"=0.37.0\"", prefixes: &["bevy_rapier2d::", "raea_bevy_adapters::rapier2d::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "rapier3d")] v.push(Declared { name: "rapier3d", krate: "bevy_rapier3d", source: "version = \"=0.37.0\"", prefixes: &["bevy_rapier3d::", "raea_bevy_adapters::rapier3d::"], needs: &[], headless: &[], on_demand: false });
v.push(Declared { name: "remote", krate: "bevy_remote", source: "version = \"=0.20.0\"", prefixes: &["bevy_remote::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "save")] v.push(Declared { name: "save", krate: "moonshine-save", source: "version = \"=0.8.0\"", prefixes: &["moonshine_save::"], needs: &[], headless: &["assets"], on_demand: false });
#[cfg(feature = "simple_tilemap")] v.push(Declared { name: "simple_tilemap", krate: "bevy_simple_tilemap", source: "version = \"=0.21.0\"", prefixes: &["bevy_simple_tilemap::"], needs: &[], headless: &["shader", "image"], on_demand: false });
#[cfg(feature = "skein")] v.push(Declared { name: "skein", krate: "bevy_skein", source: "version = \"=0.7.0-rc.1\"", prefixes: &["bevy_skein::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "smud")] v.push(Declared { name: "smud", krate: "bevy_smud", source: "version = \"=0.15.0\"", prefixes: &["bevy_smud::"], needs: &[], headless: &["shader", "mesh"], on_demand: false });
#[cfg(feature = "sprite3d")] v.push(Declared { name: "sprite3d", krate: "bevy_sprite3d", source: "version = \"=10.1.0\"", prefixes: &["bevy_sprite3d::", "raea_bevy_calls::sprite3d::"], needs: &[], headless: &["image", "mesh", "pbr"], on_demand: false });
#[cfg(feature = "spritesheet")] v.push(Declared { name: "spritesheet", krate: "bevy_spritesheet_animation", source: "version = \"=8.0.1\"", prefixes: &["bevy_spritesheet_animation::", "raea_bevy_adapters::spritesheet::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "swatch")] v.push(Declared { name: "swatch", krate: "raea-bench-swatch", source: "path = \"../../bench/bridge/swatch\"", prefixes: &["raea_bench_swatch::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "text3d")] v.push(Declared { name: "text3d", krate: "bevy_rich_text3d", source: "version = \"=0.8.0\"", prefixes: &["bevy_rich_text3d::", "raea_bevy_adapters::text3d::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "tiled")] v.push(Declared { name: "tiled", krate: "bevy_ecs_tiled", source: "version = \"=0.14.0\"", prefixes: &["bevy_ecs_tiled::"], needs: &["tilemap"], headless: &[], on_demand: false });
#[cfg(feature = "tilemap")] v.push(Declared { name: "tilemap", krate: "bevy_ecs_tilemap", source: "version = \"=0.20.0\"", prefixes: &["bevy_ecs_tilemap::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "tnua")] v.push(Declared { name: "tnua", krate: "bevy-tnua", source: "version = \"=0.33.0\"", prefixes: &["bevy_tnua", "raea_bevy_plugins::tnua::"], needs: &["avian"], headless: &["assets", "mesh"], on_demand: false });
#[cfg(feature = "trauma_shake")] v.push(Declared { name: "trauma_shake", krate: "bevy_trauma_shake", source: "version = \"=0.9.0\"", prefixes: &["bevy_trauma_shake::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "trenchbroom")] v.push(Declared { name: "trenchbroom", krate: "bevy_trenchbroom", source: "version = \"=0.15.0\"", prefixes: &["bevy_trenchbroom::", "bevy_materialize::"], needs: &[], headless: &["assets", "mesh", "shader", "image", "pbr"], on_demand: false });
#[cfg(feature = "tween")] v.push(Declared { name: "tween", krate: "bevy_tween", source: "version = \"=0.14.1\"", prefixes: &["bevy_tween::", "bevy_time_runner::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "tweening")] v.push(Declared { name: "tweening", krate: "bevy_tweening", source: "git = \"https://github.com/djeedai/bevy_tweening\", rev = \"2341b0c3e4d18cc11825ba2d7cd6c5f6f41f4152\"", prefixes: &["bevy_tweening::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "vector_shapes")] v.push(Declared { name: "vector_shapes", krate: "bevy_vector_shapes", source: "version = \"=0.14.0\"", prefixes: &["bevy_vector_shapes::"], needs: &[], headless: &[], on_demand: false });
#[cfg(feature = "vox")] v.push(Declared { name: "vox", krate: "bevy_vox_scene", source: "version = \"=0.23.0\"", prefixes: &["bevy_vox_scene::", "flipbook::"], needs: &[], headless: &["assets", "mesh", "image", "pbr", "scene"], on_demand: false });
#[cfg(feature = "yoleck")] v.push(Declared { name: "yoleck", krate: "bevy-yoleck", source: "version = \"=0.34.0\"", prefixes: &["bevy_yoleck::"], needs: &["egui"], headless: &[], on_demand: false });
v
}
+4
View File
@@ -83,6 +83,8 @@ pub struct Declared {
pub source: &'static str,
/// the type-path prefixes its generated TypeScript keeps
pub prefixes: &'static [&'static str],
/// the other declared plugins it needs added with it (a backend's engine: tnua's avian)
pub needs: &'static [&'static str],
/// what a plain headless App needs for it: "assets" (AssetPlugin), "mesh" (Assets<Mesh>), "states", "input"
pub headless: &'static [&'static str],
/// only an App that names it gets it
@@ -93,6 +95,8 @@ pub struct Declared {
/// first Engine.
pub fn install_all() {
install();
// the catalog: an Engine adds those its project chooses (raea_runtime_plugins::choose, docs/nobuild.feature NB4a)
raea_runtime_plugins::catalog(declared().iter().filter(|d| compiled().contains(&d.name)).map(|d| raea_runtime_plugins::Entry { name: d.name, needs: d.needs, prefixes: d.prefixes }).collect());
bridge::register_natives();
}
+3
View File
@@ -89,6 +89,9 @@ raea-core-animate = { path = "../../core/animate" }
[features]
# Bevy plugins compiled in (raea-bevy-plugins), as tools/bevy-plugins.sh names them: bevy-plugins,raea-bevy-plugins/avian,...
bevy-plugins = ["dep:raea-bevy-plugins", "raea-runtime-react/bevy-plugins"]
# every plugin engine/bevy-plugins declares but those it leaves out of its catalog, each added to an App only when its
# project chooses it (raea_runtime_plugins::choose, docs/nobuild.feature NB4a)
catalog = ["bevy-plugins", "raea-bevy-plugins/catalog"]
[package.metadata.cargo-shear]
# depended on only to turn their features on (raea-runtime-bake's modules, raea-runtime-sound's seedling and ml)
+1 -1
View File
@@ -208,7 +208,7 @@ fn main() {
std::process::exit(raea_cli::cli(&args[1..]));
}
#[cfg(feature = "bevy-plugins")]
let (compiled, default_prefixes) = (raea_bevy_plugins::compiled(), raea_bevy_plugins::prefixes());
let (compiled, default_prefixes) = { raea_runtime_plugins::choose_every(); (raea_bevy_plugins::compiled(), raea_bevy_plugins::prefixes()) }; // the generator walks every compiled plugin's types, chosen or not
#[cfg(not(feature = "bevy-plugins"))]
let (compiled, default_prefixes): (Vec<&str>, Vec<&str>) = (Vec::new(), Vec::new());
let mut prefixes = flag_all(&args, "--prefix");
+3 -2
View File
@@ -60,8 +60,9 @@ impl Engine {
// no render thread: a frame is drawn by the update that asks for it (wasm32 has no pipelined rendering to turn off)
#[cfg(not(target_arch = "wasm32"))]
let group = group.disable::<bevy::render::pipelined_rendering::PipelinedRenderingPlugin>();
// the registered Bevy plugins' changes, and no WinitPlugin: an Engine makes no event loop (raea_runtime_plugins::group, #182)
app.add_plugins(plugins::group(group));
// the registered plugins' changes (of the catalog's, those the project chose: nobuild NB4a), no WinitPlugin (no event loop, #182)
let chosen = plugins::choose(prog, dir);
app.add_plugins(plugins::group_chosen(group, &chosen)).insert_resource(chosen);
#[cfg(feature = "raytracing")]
if raea_render_raytrace::wanted(prog) {
raea_render_raytrace::add(&mut app);
+2
View File
@@ -18,6 +18,8 @@ serde = "1"
raea-core-shape = { path = "../../core/shape" }
raea-bevy-world = { path = "../../engine/bevy-world" }
serde_json = "1"
# which plugins an Engine chose, into the run's trace (choose.rs)
raea-io-trace = { path = "../../io/trace" }
# Bevy's window plugin compiled in on the desktop, so `group` always has it to leave out (#182): raea's Engines are
# headless, and a build that brings bevy_winit any other way (raea-page-host's window, a plugin's x11, or cargo unifying
+132
View File
@@ -0,0 +1,132 @@
//! Which of the plugin catalog's plugins an Engine adds (docs/nobuild.feature NB4a). A raea built with the catalog has
//! every plugin engine/bevy-plugins declares compiled in, and an Engine adds only the ones its project chooses: those
//! the nearest package.json at or above the edit's folder names under raea.plugins (a list of names, or declarations
//! keyed by name; raea.bevy.plugins, its first name, too), those a part's components or resources come from (a type
//! under a plugin's crate), and the plugins each of them needs. So two that conflict (avian and rapier3d) never meet in
//! one App unless a scene asks for both. A registered plugin outside the catalog (raea's own) is in every App, and a
//! build without the catalog adds every plugin it registered, as before.
use std::path::{Path, PathBuf};
use std::sync::Mutex;
use std::sync::atomic::{AtomicBool, Ordering};
use bevy::prelude::*;
use raea_core_program::ir::{Program, V};
use serde_json::{Value, json};
/// One plugin of the catalog: its name, the ones added with it, and the type-path prefixes its types live under.
#[derive(Clone, Copy, Debug)]
pub struct Entry {
pub name: &'static str,
pub needs: &'static [&'static str],
pub prefixes: &'static [&'static str],
}
static CATALOG: Mutex<Vec<Entry>> = Mutex::new(Vec::new());
static EVERY: AtomicBool = AtomicBool::new(false);
/// The catalog this build has: every declared plugin it compiled in (raea-bevy-plugins' install_all).
pub fn catalog(entries: Vec<Entry>) {
*CATALOG.lock().unwrap() = entries;
}
/// Every compiled plugin in every App from now on, chosen or not: the generator walks all of their types
/// (raea-bevy-sdk).
pub fn choose_every() {
EVERY.store(true, Ordering::Relaxed);
}
/// The catalog's plugins an Engine adds, by name.
#[derive(Resource, Clone, Debug, Default, PartialEq)]
pub struct Chosen {
pub names: Vec<&'static str>,
}
impl Chosen {
/// Whether a registered plugin goes in: raea's own always, a catalog plugin's (or one of its halves, "bevy_audio"
/// of "bevy") when its plugin is chosen.
pub fn adds(&self, registered: &str) -> bool {
EVERY.load(Ordering::Relaxed) || owner(&CATALOG.lock().unwrap(), registered).is_none_or(|e| self.names.contains(&e.name))
}
}
fn owner<'a>(cat: &'a [Entry], registered: &str) -> Option<&'a Entry> {
cat.iter().filter(|e| registered.strip_prefix(e.name).is_some_and(|r| r.is_empty() || r.starts_with('_'))).max_by_key(|e| e.name.len())
}
/// The package.json that chooses a project's plugins (the nearest at or above `dir` naming any) and the names it gives,
/// leaving out raea's own (a declaration with `"raea": true`, which every build has).
pub fn named(dir: &Path) -> Option<(PathBuf, Vec<String>)> {
for d in dir.ancestors() {
let pkg = d.join("package.json");
let Some(v) = std::fs::read_to_string(&pkg).ok().and_then(|t| serde_json::from_str::<Value>(&t).ok()) else { continue };
let mut names: Vec<String> = Vec::new();
let mut any = false;
for p in [&v["raea"]["plugins"], &v["raea"]["bevy"]["plugins"]] {
match p {
Value::Array(a) => names.extend(a.iter().filter_map(Value::as_str).map(String::from)),
Value::Object(o) => names.extend(o.iter().filter(|(_, s)| s["raea"] != true).map(|(k, _)| k.clone())),
_ => continue,
}
any |= p.as_array().map_or(0, Vec::len) + p.as_object().map_or(0, |o| o.len()) > 0;
}
if any {
names.dedup();
return Some((pkg, names));
}
}
None
}
/// Whether `s` names a type under `prefix` (at the start of a path, not inside another crate's name).
fn mentions(s: &str, prefix: &str) -> bool {
s.match_indices(prefix).any(|(i, _)| s[..i].chars().next_back().is_none_or(|c| !(c.is_alphanumeric() || c == '_' || c == ':')))
}
/// The plugins an Engine opened on `program` in `dir` adds. Said once on stderr when the project names one this
/// build lacks; written to the run's trace (`plugins_chosen`) each time.
pub fn choose(program: &Program, dir: &Path) -> Chosen {
let cat = CATALOG.lock().unwrap().clone();
let mut chosen = Chosen::default();
let mut why: Vec<Value> = Vec::new();
let mut add = |e: &Entry, because: String, chosen: &mut Chosen| {
if !chosen.names.contains(&e.name) {
chosen.names.push(e.name);
why.push(json!({ "plugin": e.name, "because": because }));
}
};
let named = named(dir);
let mut lacks = Vec::new();
for n in named.iter().flat_map(|(_, l)| l) {
match cat.iter().find(|e| e.name == n) {
Some(e) => add(e, "package.json".into(), &mut chosen),
None => lacks.push(n.clone()),
}
}
// the types the scene's rows name (a component's or resource's `type`, or inline in a value as JSON)
let paths: Vec<&str> = program.spawns.iter().flat_map(|(_, rows)| rows.iter().flat_map(|r| r.values())).filter_map(|v| if let V::S(s) = v { Some(s.as_str()) } else { None }).filter(|s| s.contains("::")).collect();
// "bevy" is Bevy's own features: its prefixes are the crates every scene's types come from
for e in cat.iter().filter(|e| e.name != "bevy") {
if let Some(p) = e.prefixes.iter().find(|p| paths.iter().any(|s| mentions(s, p))) {
add(e, format!("a type under {p}"), &mut chosen);
}
}
let mut i = 0;
while i < chosen.names.len() {
let by = chosen.names[i];
for n in cat.iter().find(|e| e.name == by).map_or(&[][..], |e| e.needs) {
if let Some(e) = cat.iter().find(|e| e.name == *n) {
add(e, format!("{by} needs it"), &mut chosen);
}
}
i += 1;
}
if let (false, Some((pkg, _))) = (lacks.is_empty(), &named) {
static SAID: std::sync::Once = std::sync::Once::new();
SAID.call_once(|| {
let has = if cat.is_empty() { "this raea has no Bevy plugins compiled in".to_string() } else { format!("this raea has {}", cat.iter().map(|e| e.name).collect::<Vec<_>>().join(", ")) };
eprintln!("raea: {} names {}, which this raea doesn't have ({has}; docs/nobuild.feature NB4b)", pkg.display(), lacks.join(", "));
});
}
raea_io_trace::event("plugins_chosen", json!({ "package": named.as_ref().map(|(p, _)| p.display().to_string()), "chosen": why, "lacks": lacks, "catalog": cat.len() }));
chosen
}
+17 -5
View File
@@ -47,6 +47,8 @@ mod world;
pub use world::*;
mod fields;
pub use fields::*;
mod choose;
pub use choose::*;
mod reflect;
pub use reflect::*;
pub mod character;
@@ -84,12 +86,21 @@ pub fn names() -> Vec<&'static str> {
/// itself; WinitPlugin would make an event loop in every App, and winit allows one a process, so a process's second App
/// panicked "Failed to build event loop: RecreationAttempt" (#182: Linux, a build cargo had unified bevy_winit into).
/// It's compiled in on the desktop (Cargo.toml), so it's always here to leave out, however the build brought it.
pub fn group(mut b: PluginGroupBuilder) -> PluginGroupBuilder {
pub fn group(b: PluginGroupBuilder) -> PluginGroupBuilder {
group_of(b, None)
}
/// `group` for an Engine whose project chose its plugins (choose.rs): only the chosen ones' changes.
pub fn group_chosen(b: PluginGroupBuilder, chosen: &Chosen) -> PluginGroupBuilder {
group_of(b, Some(chosen))
}
fn group_of(mut b: PluginGroupBuilder, chosen: Option<&Chosen>) -> PluginGroupBuilder {
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))]
if b.contains::<bevy::winit::WinitPlugin>() {
b = b.disable::<bevy::winit::WinitPlugin>();
}
for r in PLUGINS.lock().unwrap().iter().filter(|r| !r.on_demand) {
for r in PLUGINS.lock().unwrap().iter().filter(|r| !r.on_demand && chosen.is_none_or(|c| c.adds(r.name))) {
if let Some(g) = r.group {
b = g(b);
}
@@ -128,8 +139,8 @@ struct Keyed {
last: i64,
}
/// Adds the registered plugins (all but the on-demand ones) and the frame clock, when there are any. An App without
/// plugins is left as it was.
/// Adds the registered plugins (all but the on-demand ones, and of the catalog's only those in the App's Chosen when it
/// has one) and the frame clock, when there are any. An App without plugins is left as it was.
pub fn install(app: &mut App, fps: f64) {
// the keyboard's and mouse buttons' state as resources TypeScript can read and write (Bevy's InputPlugin adds
// them without registering them for reflection; the gamepad's ButtonInput it registers itself)
@@ -151,7 +162,8 @@ pub fn install(app: &mut App, fps: f64) {
// materials written in TypeScript (<ShaderMaterial>, shader_material.rs): the render Engine only
shader_material::install(app);
keyed(app);
let list: Vec<fn(&mut App)> = PLUGINS.lock().unwrap().iter().filter(|r| !r.on_demand).map(|r| r.install).collect();
let chosen = app.world().get_resource::<Chosen>().cloned();
let list: Vec<fn(&mut App)> = PLUGINS.lock().unwrap().iter().filter(|r| !r.on_demand && chosen.as_ref().is_none_or(|c| c.adds(r.name))).map(|r| r.install).collect();
install_list(app, fps, list);
}
+1
View File
@@ -126,6 +126,7 @@
"bevy": {
"crate": "bevy",
"builtin": true,
"catalog": false,
"versions": {
"0.19": "=0.19.1",
"0.20": "=0.20.0"
+20
View File
@@ -19,6 +19,26 @@ generates them. TypeScript then drives them two ways:
Rust is written only where a plugin's API isn't data (see "What still needs Rust").
### A project choosing from the catalog (2026-11-19, docs/nobuild.feature NB4a)
raea built with its catalog (raea-cli's `catalog` feature, which engine/bevy-plugins' sync writes: every declared
plugin but those declared `"catalog": false`, today only `bevy`, Bevy's own optional features) has every plugin
compiled in, and an Engine adds only the ones its project chooses. An author writes no declaration and runs no build:
```json
"raea": { "plugins": ["avian", "hanabi"] }
```
The nearest package.json at or above the composition's folder that names plugins chooses them (a list of names, or
declarations keyed by name as below; `"raea": true` entries are raea's own and in every build). A plugin a scene's
components or resources come from (a type under its crate, `avian3d::...`) is added too, and so is every plugin a
chosen one `needs`. The rest are compiled in and never added, so two that conflict (avian and rapier3d) meet only in a
scene that asks for both. The run's trace says what was chosen and why (`plugins_chosen`); a name the build lacks is
said once on stderr. `tools/nobuild.sh catalog` is the check: a project choosing avian and hanabi renders and plays,
and scenes that choose none draw the same pixels as a raea built without the catalog.
The declaration below is for adding a plugin to the catalog, which is raea's job, not an author's.
### The declaration, and how the build resolves it
A project's package.json names its plugins under `raea.plugins` (`raea.bevy.plugins`, its first name, is still read). Each key is the plugin's name, which is also its
+5 -7
View File
@@ -192,12 +192,8 @@ splice() { # FILE NAME CONTENT-FILE
}
cmd_sync() {
local files=()
if [ $# -gt 0 ]; then
files=("$@")
else
while read -r f; do files+=("$f"); done < <(declarations)
fi
local files=("$@")
[ $# -gt 0 ] || while read -r f; do files+=("$f"); done < <(declarations)
[ ${#files[@]} -gt 0 ] || die "no package.json declares raea.plugins"
local all minor deps feats cdeps cfeats reg list name spec crate src fl dname dspec dline seen="" skipped="" own=""
all=$(merged "${files[@]}")
@@ -277,7 +273,7 @@ cmd_sync() {
local cfg="#[cfg(feature = \"$name\")]"
local lcfg="$cfg"
[ "$builtin" = true ] && lcfg=""
echo " $lcfg v.push(Declared { name: \"$name\", krate: \"$crate\", source: $(jq -Rn --arg s "$src" '$s'), prefixes: &[$prefixes], headless: &[$headless], on_demand: $ondemand });" >> "$list"
echo " $lcfg v.push(Declared { name: \"$name\", krate: \"$crate\", source: $(jq -Rn --arg s "$src" '$s'), prefixes: &[$prefixes], needs: &[$(needs_of "$spec" | sed 's/^, //')], headless: &[$headless], on_demand: $ondemand });" >> "$list"
# Blitz widgets (docs/sdk.feature S8b): each tag backed in every page App by the widget its expression makes
local widgets; widgets=$(jq -r '.widgets // {} | to_entries[] | " raea_sys_page::widgets::AppPageWidgets::page_widget(app, \"\(.key)\", || Box::new(\(.value)));"' <<<"$spec" | tr -d '\n')
[ -z "$widgets" ] || printf ' %s\n raea_sys_page::widgets::register_page_plugin(|app| {%s });\n' "$cfg" "$widgets" >> "$reg"
@@ -324,6 +320,8 @@ cmd_sync() {
fi
done
done
# the catalog the release builds in (docs/nobuild.feature NB4a): every plugin but those declared "catalog": false
echo "catalog = [$(jq -r 'to_entries[] | select(.value.catalog != false) | .key' <<<"$all" | grep -Fxf <(cut -d' ' -f1 "$feats") | sed 's/.*/"&"/' | paste -sd, - | sed 's/,/, /g')]" >> "$feats"
splice "$TOML" "declared dependencies" "$deps"
splice "$TOML" "declared features" "$feats"
splice "$CRATE/src/lib.rs" "declared modules" "$mods"
+48 -1
View File
@@ -16,6 +16,12 @@
# composition that sets it, and the scene's base with the variable, rendered by
# RAEA_BIN and compared (the frame, and the settings the trace records); written to
# docs/nobuild/props.tsv, exits 1 if one fails
# tools/nobuild.sh catalog NB4a's check: RAEA_CATALOG_BIN (a raea with --features catalog, or raea-bevy-sdk built
# so, run as `raea-bevy-sdk motion`) renders and plays tools/nobuild/catalog, a project
# choosing avian and hanabi: the ball falls, the fountain rises, and the trace says
# package.json chose both. Then each props.tsv scene that draws the same pixels twice
# (raster, the path tracer) and tools/nobuild/card.tsx draw the same by it as by RAEA_BIN:
# a plugin compiled in and not chosen changes nothing. Exits 1 if one fails
#
# A decision row (tab-separated): kind:name, then its class, the TypeScript form it becomes, its check, its status
# (open, doing, done, stays). Classes: frame (changes what a frame shows or costs: a prop), view (a debug view: NB2),
@@ -203,10 +209,51 @@ props() {
if [ "$fails" = 0 ]; then rm -rf -- "${dir:?}"; else echo "nobuild: renders kept in $dir"; exit 1; fi
}
# a frame's pixels of one colour, by a rule on r, g, b: how many, and their mean x and y
pixels() {
magick "$1" -depth 8 txt:- | awk -F'[,:() ]+' -v rule="$2" 'NR > 1 { x = $1; y = $2; r = $4; g = $5; b = $6
hit = rule == "ball" ? (r > 90 && g < 60 && b > 15 && b < r * 0.6) : (r > 170 && g > 70 && b < 90 && g < r * 0.85)
if (hit) { n++; sx += x; sy += y } } END { printf "%d %.0f %.0f", n, n ? sx / n : -1, n ? sy / n : -1 }'
}
catalog() {
bin=${RAEA_BIN:-$RAEA/target/release/raea}
local cbin=${RAEA_CATALOG_BIN:-$RAEA/target/release/raea-bevy-sdk} here=$RAEA/tools/nobuild/catalog dir fails=0
[ -x "$bin" ] && [ -x "$cbin" ] || { echo "nobuild: needs raea at $bin (RAEA_BIN) and one with the catalog at $cbin (RAEA_CATALOG_BIN)" >&2; exit 1; }
dir=$(mktemp -d "${TMPDIR:-/tmp}/nobuild-catalog.XXXXXX") || exit 1
case $(basename "$cbin") in raea-bevy-sdk*) printf '#!/bin/bash\nexec "%s" motion "$@"\n' "$cbin" > "$dir/craea" ;; *) printf '#!/bin/bash\nexec "%s" "$@"\n' "$cbin" > "$dir/craea" ;; esac
chmod +x "$dir/craea"
check() { if [ "$2" = pass ]; then echo " $1: pass ($3)"; else echo " $1: FAIL ($3)"; fails=$((fails + 1)); fi; }
# every frame, as physics steps by the frame drawn (a render --at skips the steps between)
(cd "$here" && RAEA_TRACE_DIR="$dir/trace" "$dir/craea" render drop.tsx -o "$dir/r" > "$dir/r.log" 2>&1)
local b0 b40 o40 chosen
b0=$(pixels "$dir/r/frame-00000.png" ball); b40=$(pixels "$dir/r/frame-00040.png" ball); o40=$(pixels "$dir/r/frame-00040.png" fountain)
echo "nobuild catalog: tools/nobuild/catalog/drop.tsx by $cbin"
check "the ball falls (avian)" "$(awk -v a="$b0" -v b="$b40" 'BEGIN { split(a, p, " "); split(b, q, " "); print (p[1] > 100 && q[1] > 100 && q[3] > p[3] + 40) ? "pass" : "x" }')" "frame 0: $b0, frame 40: $b40 (pixels, x, y)"
check "the fountain rises (hanabi)" "$(awk -v o="$o40" 'BEGIN { split(o, p, " "); print (p[1] > 100 && p[2] > 240) ? "pass" : "x" }')" "frame 40: $o40"
chosen=$(find "$dir/trace" -name events.jsonl -exec cat {} + 2>/dev/null | jq -r 'select(.kind == "plugins_chosen") | [.chosen[] | "\(.plugin) by \(.because)"] | join(", ")' | sort -u | head -1)
check "package.json chose them" "$(grep -q 'avian by package.json' <<<"$chosen" && grep -q 'hanabi by package.json' <<<"$chosen" && echo pass)" "${chosen:-no plugins_chosen in the trace}"
(cd "$here" && "$dir/craea" play drop.tsx --offscreen --no-vsync --size 480x270 --seconds 1.6 --snapshot 1.3 "$dir/play.png" > "$dir/play.log" 2>&1)
local pb po; pb=$(pixels "$dir/play.png" ball); po=$(pixels "$dir/play.png" fountain)
check "it plays" "$(awk -v a="$b0" -v b="$pb" -v o="$po" 'BEGIN { split(a, p, " "); split(b, q, " "); split(o, f, " "); print (q[1] > 100 && q[3] > p[3] + 40 && f[1] > 100) ? "pass" : "x" }')" "at 1.3 s: ball $pb, fountain $po"
# the same pixels with the catalog compiled in and nothing chosen
local scene comp light frame f
while IFS=$'\t' read -r scene comp light frame; do
f=$(printf 'frame-%05d.png' "$frame")
props_render "$scene" "$comp" "$light" "$dir/plain-${scene%.tsx}-$comp"
bin=$dir/craea props_render "$scene" "$comp" "$light" "$dir/cat-${scene%.tsx}-$comp"
local pae; pae=$(diff_levels PAE "$dir/plain-${scene%.tsx}-$comp/$f" "$dir/cat-${scene%.tsx}-$comp/$f")
check "$scene $comp, frame $frame: the same pixels" "$([ "$pae" = 0.000 ] && echo pass)" "max ${pae:-no frame} levels"
done < <({ awk -F'\t' '$1 !~ /^#/ && NF >= 6 && ($5 == "raster" || ($5 == "traced" && $3 == "trace")) { print $1 "\t" $3 "\t" $5 "\t" $6 }' "$RAEA/tools/nobuild/props.tsv"; printf 'card.tsx\tcard\traster\t20\n'; } | sort -u)
echo "nobuild catalog: $fails failing"
if [ "$fails" = 0 ]; then rm -rf -- "${dir:?}"; else echo "nobuild: renders and logs kept in $dir"; exit 1; fi
}
case ${1:-} in
builds) shift; builds "$@" ;;
scan) scan ;;
consts) consts ;;
props) props ;;
*) sed -n '2,28p' "$0" | sed 's/^# \{0,1\}//'; exit 2 ;;
catalog) catalog ;;
*) sed -n '2,29p' "$0" | sed 's/^# \{0,1\}//'; exit 2 ;;
esac
+18
View File
@@ -0,0 +1,18 @@
import { AbsoluteFill, Composition, interpolate, registerRoot, useCurrentFrame } from "raea";
// docs/nobuild.feature NB4a: a 2D card (type, a gradient, a rounded box, a border) that tools/nobuild.sh catalog draws by
// raea with the plugin catalog compiled in and by raea without it, which must give the same pixels.
function Card() {
const f = useCurrentFrame();
const x = interpolate(f, [0, 24], [-40, 0], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
return (
<AbsoluteFill style={{ background: "linear-gradient(135deg, #0f172a, #1e3a8a)", justifyContent: "center", alignItems: "center" }}>
<div style={{ transform: `translateX(${x}px)`, padding: "24px 36px", borderRadius: 18, border: "3px solid #fbbf24", background: "rgba(255,255,255,0.08)", color: "#f8fafc", fontSize: 44, fontWeight: 700 }}>
Same pixels
<div style={{ fontSize: 20, fontWeight: 400, opacity: 0.8 }}>with every plugin compiled in</div>
</div>
</AbsoluteFill>
);
}
registerRoot(() => <Composition id="card" component={Card} width={480} height={270} fps={30} durationInFrames={30} />);
+45
View File
@@ -0,0 +1,45 @@
import { AbsoluteFill, Composition, registerRoot } from "raea";
import { Camera3d } from "raea/camera";
import { AmbientLight, DirectionalLight } from "raea/light";
import { ConicalFrustum, Cuboid, Mesh3d } from "raea/mesh";
import { StandardMaterial } from "raea/pbr";
import { ColliderConstructor, Restitution, RigidBody } from "raea/plugins/avian";
import { Particles } from "raea/plugins/hanabi";
import { Sphere } from "raea/3d";
import { Transform } from "raea/transform";
// docs/nobuild.feature NB4a: a project choosing avian and hanabi from the catalog (package.json raea.plugins beside
// it), rendered and played by the release raea (tools/nobuild.sh catalog). A ball dropped on a floor (avian) and a
// fountain of orange GPU particles beside it (hanabi). By frame 40 the ball has fallen from the top of the frame to
// the floor, and the fountain fills a column over the pedestal on the right.
function Drop() {
return (
<AbsoluteFill style={{ background: "#0f1720" }}>
<>
<Camera3d transform={Transform.fromXyz(0, 2, 7).lookingAt([0, 1.2, 0])} projection={{ Perspective: { fov: 0.785398163397448 } }} />
<AmbientLight brightness={200} />
<DirectionalLight transform={Transform.fromXyz(3, 6, 4).lookingAt([0, 0, 0])} illuminance={10400} shadow_maps_enabled />
<Mesh3d name="floor">
<Cuboid half_size={[4, 0.15, 2]} />
<StandardMaterial base_color="#334155" perceptual_roughness={0.8} />
<RigidBody value="Static" />
<ColliderConstructor value={{ Cuboid: { x_length: 8, y_length: 0.3, z_length: 4 } }} />
</Mesh3d>
<Mesh3d transform={Transform.fromXyz(-1.2, 3.2, 0)} name="ball" driven={true}>
<Sphere radius={0.4} />
<StandardMaterial base_color="#e11d48" perceptual_roughness={0.4} />
<RigidBody value="Dynamic" />
<ColliderConstructor value={{ Sphere: { radius: 0.4 } }} />
<Restitution value={{ coefficient: 0.3, combine_rule: "Min" }} />
</Mesh3d>
<Mesh3d transform={Transform.fromXyz(1.8, 0.3, 0)} name="pedestal">
<ConicalFrustum radius_top={0.25} radius_bottom={0.35} height={0.3} />
<StandardMaterial base_color="#111111" />
<Particles value={{ rate: 2000, lifetime: 1.2, speed: 3, spread: 0.15, size: 0.08, color: [1, 0.55, 0.1, 1], gravity: 4, seed: 7, opaque: true }} />
</Mesh3d>
</>
</AbsoluteFill>
);
}
registerRoot(() => <Composition id="drop" component={Drop} width={480} height={270} fps={30} durationInFrames={48} />);
+8
View File
@@ -0,0 +1,8 @@
{
"name": "raea-nobuild-catalog",
"private": true,
"description": "docs/nobuild.feature NB4a: a project choosing two plugins from the catalog the release raea has compiled in",
"raea": {
"plugins": ["avian", "hanabi"]
}
}