bevy icon indicating copy to clipboard operation
bevy copied to clipboard

`bevy_text` feature gating for `bevy_ui` doesn't seem to work

Open ickshonpe opened this issue 1 year ago • 4 comments

Bevy version

82d6f56cfc3432f584632f761c44ec8efd2e7c67

What you did

cargo run --example text --no-default-features --features "android-game-activity android_shared_stdcxx animation bevy_asset bevy_audio bevy_color bevy_core_pipeline bevy_gilrs bevy_gizmos bevy_gltf bevy_mesh_picking_backend bevy_pbr bevy_picking bevy_remote bevy_render bevy_scene bevy_sprite bevy_sprite_picking_backend bevy_state bevy_ui bevy_ui_picking_backend bevy_winit custom_cursor default_font hdr multi_threaded png smaa_luts sysinfo_plugin tonemapping_luts vorbis webgl2 x11"

(everything but bevy_text)

What went wrong

The example compiles. I thought that removing the bevy_text feature was meant to disable bevy_ui's text support? Maybe I'm just misunderstanding about how rust features work though.

ickshonpe avatar Oct 14 '24 12:10 ickshonpe

I believe that --no-default-features only disables default features for the top-level crates you are compiling. And that one of the features you are enabling transitively enables the text feature on bevy_ui.

That said, compiling bevy_ui without the text feature is constantly breaking. I would suggest that:

  • EITHER The feature is removed and bevy_ui should just hard depend on text support
  • OR A test is added to CI to check this combination.

nicoburns avatar Oct 14 '24 17:10 nicoburns

It doesn't seem like it's enabled transitively, the text2d example runs without bevy_text but everything else:

cargo run --example text2d --no-default-features --features "android-game-activity android_shared_stdcxx animation bevy_asset bevy_audio bevy_color bevy_core_pipeline bevy_gilrs bevy_gizmos bevy_gltf bevy_mesh_picking_backend bevy_pbr bevy_picking bevy_remote bevy_render bevy_scene bevy_sprite bevy_sprite_picking_backend bevy_state bevy_ui bevy_ui_picking_backend bevy_winit custom_cursor default_font hdr multi_threaded png smaa_luts sysinfo_plugin tonemapping_luts vorbis webgl2 x11"

but if we also remove the bevy_ui feature as well:

cargo run --example text2d --no-default-features --features "android-game-activity android_shared_stdcxx animation bevy_asset bevy_audio bevy_color bevy_core_pipeline bevy_gilrs bevy_gizmos bevy_gltf bevy_mesh_picking_backend bevy_pbr bevy_picking bevy_remote bevy_render bevy_scene bevy_sprite bevy_sprite_picking_backend bevy_state bevy_ui_picking_backend bevy_winit custom_cursor default_font hdr multi_threaded png smaa_luts sysinfo_plugin tonemapping_luts vorbis webgl2 x11"

compilation fails with an unresolved import bevy::text error. So it appears to me that the problem should lie within the bevy_ui crate but I'm not clear what changes need to be made.

Strongly agree that either the feature gating should work and that we should include a test to ensure that it works, or we should remove it and just have an explicit bevy_ui -> bevy_text dependency.

ickshonpe avatar Oct 14 '24 17:10 ickshonpe

I'd be fine to just have an explicit dependency. I don't think that keeping bevy_text optional is particularly viable or valuable in the long-run.

alice-i-cecile avatar Oct 14 '24 21:10 alice-i-cecile

Yeah optionality made more sense before with the ab_glyph implementation when we had more bugs than features hehe

ickshonpe avatar Oct 14 '24 23:10 ickshonpe