bevy
bevy copied to clipboard
Feature-gate all references to `bevy_text` in `bevy_ui`
Objective
bevy_uifails to compile withoutbevy_textbeing enabled.- Fixes #11363.
Solution
- Add
#[cfg(feature = "bevy_text")]to all items that require it.
I think this change is honestly a bit ugly, but I can't see any other way around it. I considered making bevy_text required, but we agreed on Discord that there were some use cases for bevy_ui without bevy_text. If you have any ideas that decreases the amount of #[cfg(...)]s and #[allow(...)]s, that would be greatly appreciated.
This was tested by running the following commands:
$ cargo clippy -p bevy_ui
$ cargo clippy -p bevy_ui -F bevy_text
$ cargo run -p ci
Changelog
- Fixed
bevy_uinot compiling withoutbevy_text.
system
extract_uinodesshould not be behind thebevy_textfeature, it can work without changes withoutbevy_text
I believe I fixed this in b236ab5679287e7f8552fb662d1a2d9753a7651c.
I'm considering moving all of the #[cfg(feature = "bevy_text")] statements to a separate function, that way we only have to use the cfg attribute once.
#[cfg(feature = "bevy_text")]
fn build_text_interop(app: &mut App) {
app.add_systems(...);
// etc.
}