Enable ambiguity detection in CI.

This commit is contained in:
andriyDev 2025-06-09 23:18:59 -07:00
parent c549b9e9a4
commit 8d2a1437e6

View File

@ -8,7 +8,7 @@ use bevy::{
ecs::schedule::{InternedScheduleLabel, LogLevel, ScheduleBuildSettings}, ecs::schedule::{InternedScheduleLabel, LogLevel, ScheduleBuildSettings},
platform::collections::HashMap, platform::collections::HashMap,
prelude::*, prelude::*,
render::pipelined_rendering::RenderExtractApp, render::{pipelined_rendering::RenderExtractApp, RenderApp},
}; };
fn main() { fn main() {
@ -19,12 +19,15 @@ fn main() {
configure_ambiguity_detection(main_app); configure_ambiguity_detection(main_app);
let render_extract_app = app.sub_app_mut(RenderExtractApp); let render_extract_app = app.sub_app_mut(RenderExtractApp);
configure_ambiguity_detection(render_extract_app); configure_ambiguity_detection(render_extract_app);
let sub_app = app.sub_app_mut(RenderApp);
// Ambiguities in the RenderApp are currently allowed. configure_ambiguity_detection(sub_app);
// Eventually, we should forbid these: see https://github.com/bevyengine/bevy/issues/7386 // TODO: Make the Extract schedule ambiguity friendly.
// Uncomment the lines below to show the current ambiguities in the RenderApp. sub_app.edit_schedule(ExtractSchedule, |schedule| {
// let sub_app = app.sub_app_mut(bevy_render::RenderApp); schedule.set_build_settings(ScheduleBuildSettings {
// configure_ambiguity_detection(sub_app); ambiguity_detection: LogLevel::Ignore,
..Default::default()
});
});
app.finish(); app.finish();
app.cleanup(); app.cleanup();
@ -37,13 +40,19 @@ fn main() {
"Main app has unexpected ambiguities among the following schedules: \n{main_app_ambiguities:#?}.", "Main app has unexpected ambiguities among the following schedules: \n{main_app_ambiguities:#?}.",
); );
// RenderApp is not checked here, because it is not within the App at this point.
let render_extract_ambiguities = count_ambiguities(app.sub_app(RenderExtractApp)); let render_extract_ambiguities = count_ambiguities(app.sub_app(RenderExtractApp));
assert_eq!( assert_eq!(
render_extract_ambiguities.total(), render_extract_ambiguities.total(),
0, 0,
"RenderExtract app has unexpected ambiguities among the following schedules: \n{render_extract_ambiguities:#?}", "RenderExtract app has unexpected ambiguities among the following schedules: \n{render_extract_ambiguities:#?}",
); );
let render_ambiguities = count_ambiguities(app.sub_app(RenderApp));
assert_eq!(
render_ambiguities.total(),
0,
"Render app has unexpected ambiguities among the following schedules: \n{render_ambiguities:#?}",
);
} }
/// Contains the number of conflicting systems per schedule. /// Contains the number of conflicting systems per schedule.