From ac53e4c482fa67af38fe8cde702c4322c17f04cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Tue, 18 Mar 2025 01:52:42 +0100 Subject: [PATCH] only handle bin examples in showcase (#18374) # Objective - Some examples are now build as lib to be usable in other examples since https://github.com/bevyengine/bevy/pull/18288 - Those examples are not correctly handled in the showcase as it tries to run them ## Solution - Ignore lib examples in showcase when taking screenshots or building for the website --- tools/example-showcase/src/main.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/example-showcase/src/main.rs b/tools/example-showcase/src/main.rs index 4cdf3b0412..2ae3dfa6e9 100644 --- a/tools/example-showcase/src/main.rs +++ b/tools/example-showcase/src/main.rs @@ -275,6 +275,7 @@ fn main() { examples_to_run .iter() .filter(|example| example.category != "Stress Tests" || !ignore_stress_tests) + .filter(|example| example.example_type == ExampleType::Bin) .filter(|example| { example_list.is_none() || example_filter.contains(&example.technical_name) }) @@ -503,6 +504,10 @@ header_message = \"Examples (WebGL2)\" let mut categories = HashMap::new(); for to_show in examples_to_run { + if to_show.example_type != ExampleType::Bin { + continue; + } + if !to_show.wasm { continue; } @@ -659,6 +664,7 @@ header_message = \"Examples ({})\" examples_to_build .iter() .filter(|to_build| to_build.wasm) + .filter(|to_build| to_build.example_type == ExampleType::Bin) .skip(cli.page.unwrap_or(0) * cli.per_page.unwrap_or(0)) .take(cli.per_page.unwrap_or(usize::MAX)) }; @@ -804,6 +810,22 @@ fn parse_examples() -> Vec { .collect() }) .unwrap_or_default(), + example_type: match val.get("crate-type") { + Some(crate_type) => { + match crate_type + .as_array() + .unwrap() + .get(0) + .unwrap() + .as_str() + .unwrap() + { + "lib" => ExampleType::Lib, + _ => ExampleType::Bin, + } + } + None => ExampleType::Bin, + }, }) }) .collect() @@ -833,4 +855,12 @@ struct Example { wasm: bool, /// List of commands to run before the example. Can be used for example to specify data to download setup: Vec>, + /// Type of example + example_type: ExampleType, +} + +#[derive(Debug, PartialEq, Eq, Clone, Hash)] +enum ExampleType { + Lib, + Bin, }