From 290377d77bafdfafd3a3678e0d619e1f9781fc12 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 3 Mar 2025 17:05:17 +0000 Subject: [PATCH 1/2] chore: fix docgen example --- examples/docgen.rs | 46 ++++------------------------------------------ 1 file changed, 4 insertions(+), 42 deletions(-) diff --git a/examples/docgen.rs b/examples/docgen.rs index 0e0c256c11..7381d579a7 100644 --- a/examples/docgen.rs +++ b/examples/docgen.rs @@ -1,10 +1,7 @@ -use bevy::ecs::reflect::AppTypeRegistry; use bevy::{app::App, DefaultPlugins}; use bevy_mod_scripting::ScriptFunctionsPlugin; -use bevy_mod_scripting_core::bindings::function::script_function::AppScriptFunctionRegistry; use bevy_mod_scripting_core::bindings::globals::core::CoreScriptGlobalsPlugin; -use bevy_mod_scripting_core::bindings::globals::AppScriptGlobalsRegistry; -use ladfile_builder::plugin::{generate_lad_file, LadFileSettings, ScriptingDocgenPlugin}; +use ladfile_builder::plugin::ScriptingDocgenPlugin; fn main() -> std::io::Result<()> { let mut app = App::new(); @@ -20,45 +17,10 @@ fn main() -> std::io::Result<()> { ScriptFunctionsPlugin, )); - // there are two ways to generate the ladfile - - // 1. add the docgen plugin and run your app as normal app.add_plugins(ScriptingDocgenPlugin::default()); - // running the app once like below would do the trick - // app.cleanup(); - // app.finish(); - // app.update(); - - // or 2. manually trigger the system - // this is what we do here as we're running this example in GHA - - let type_registry = app - .world() - .get_resource::() - .unwrap() - .clone(); - let function_registry = app - .world() - .get_resource::() - .unwrap() - .clone(); - let global_registry = app - .world() - .get_resource::() - .unwrap() - .clone(); - - let settings = LadFileSettings { - description: "Core BMS framework bindings", - ..Default::default() - }; - - generate_lad_file( - &type_registry, - &function_registry, - &global_registry, - &settings, - ); + app.cleanup(); + app.finish(); + app.update(); // bah bye, the generated file will be found in assets/ // this can then be passed to various backends to generate docs, and other declaration files From 63b19142723f008760029aa88d2f70a2ead15233 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 3 Mar 2025 17:18:35 +0000 Subject: [PATCH 2/2] dont wait for finalize just do it --- examples/docgen.rs | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/examples/docgen.rs b/examples/docgen.rs index 7381d579a7..8a227d8c56 100644 --- a/examples/docgen.rs +++ b/examples/docgen.rs @@ -1,7 +1,10 @@ +use bevy::ecs::reflect::AppTypeRegistry; use bevy::{app::App, DefaultPlugins}; use bevy_mod_scripting::ScriptFunctionsPlugin; +use bevy_mod_scripting_core::bindings::function::script_function::AppScriptFunctionRegistry; use bevy_mod_scripting_core::bindings::globals::core::CoreScriptGlobalsPlugin; -use ladfile_builder::plugin::ScriptingDocgenPlugin; +use bevy_mod_scripting_core::bindings::globals::AppScriptGlobalsRegistry; +use ladfile_builder::plugin::{generate_lad_file, LadFileSettings, ScriptingDocgenPlugin}; fn main() -> std::io::Result<()> { let mut app = App::new(); @@ -17,10 +20,45 @@ fn main() -> std::io::Result<()> { ScriptFunctionsPlugin, )); + // there are two ways to generate the ladfile + + // 1. add the docgen plugin and run your app as normal app.add_plugins(ScriptingDocgenPlugin::default()); - app.cleanup(); app.finish(); - app.update(); + app.cleanup(); + // running update once will do the trick + // app.update(); + + // or 2. manually trigger the system + // this is what we do here as we're running this example in GHA + + let type_registry = app + .world() + .get_resource::() + .unwrap() + .clone(); + let function_registry = app + .world() + .get_resource::() + .unwrap() + .clone(); + let global_registry = app + .world() + .get_resource::() + .unwrap() + .clone(); + + let settings = LadFileSettings { + description: "Core BMS framework bindings", + ..Default::default() + }; + + generate_lad_file( + &type_registry, + &function_registry, + &global_registry, + &settings, + ); // bah bye, the generated file will be found in assets/ // this can then be passed to various backends to generate docs, and other declaration files