Skip to content

Commit ac53e4c

Browse files
authored
only handle bin examples in showcase (bevyengine#18374)
# Objective - Some examples are now build as lib to be usable in other examples since bevyengine#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
1 parent 31d2b65 commit ac53e4c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tools/example-showcase/src/main.rs

+30
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ fn main() {
275275
examples_to_run
276276
.iter()
277277
.filter(|example| example.category != "Stress Tests" || !ignore_stress_tests)
278+
.filter(|example| example.example_type == ExampleType::Bin)
278279
.filter(|example| {
279280
example_list.is_none() || example_filter.contains(&example.technical_name)
280281
})
@@ -503,6 +504,10 @@ header_message = \"Examples (WebGL2)\"
503504

504505
let mut categories = HashMap::new();
505506
for to_show in examples_to_run {
507+
if to_show.example_type != ExampleType::Bin {
508+
continue;
509+
}
510+
506511
if !to_show.wasm {
507512
continue;
508513
}
@@ -659,6 +664,7 @@ header_message = \"Examples ({})\"
659664
examples_to_build
660665
.iter()
661666
.filter(|to_build| to_build.wasm)
667+
.filter(|to_build| to_build.example_type == ExampleType::Bin)
662668
.skip(cli.page.unwrap_or(0) * cli.per_page.unwrap_or(0))
663669
.take(cli.per_page.unwrap_or(usize::MAX))
664670
};
@@ -804,6 +810,22 @@ fn parse_examples() -> Vec<Example> {
804810
.collect()
805811
})
806812
.unwrap_or_default(),
813+
example_type: match val.get("crate-type") {
814+
Some(crate_type) => {
815+
match crate_type
816+
.as_array()
817+
.unwrap()
818+
.get(0)
819+
.unwrap()
820+
.as_str()
821+
.unwrap()
822+
{
823+
"lib" => ExampleType::Lib,
824+
_ => ExampleType::Bin,
825+
}
826+
}
827+
None => ExampleType::Bin,
828+
},
807829
})
808830
})
809831
.collect()
@@ -833,4 +855,12 @@ struct Example {
833855
wasm: bool,
834856
/// List of commands to run before the example. Can be used for example to specify data to download
835857
setup: Vec<Vec<String>>,
858+
/// Type of example
859+
example_type: ExampleType,
860+
}
861+
862+
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
863+
enum ExampleType {
864+
Lib,
865+
Bin,
836866
}

0 commit comments

Comments
 (0)