feat: gate muda dep + menu API behind menus feature (default on)#1077
Draft
mxaddict wants to merge 1 commit into
Draft
feat: gate muda dep + menu API behind menus feature (default on)#1077mxaddict wants to merge 1 commit into
menus feature (default on)#1077mxaddict wants to merge 1 commit into
Conversation
Consumers that don't render menu bars can now opt out of the `muda` cascade — on Linux this drops the gtk-rs / glib-sys / gettext-sys transitive deps, which simplifies cross-compile to arm64 / musl and clears the unmaintained-gtk3 cargo-deny noise. Default features include `menus`, so existing apps are unaffected. Closes lapce#1076.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1076.
Summary
Adds a
menusCargo feature that gates themudadependency and allmenu-related API. The feature is in
default = [...], so existingapps are unaffected. Consumers that don't render menu bars
(layer-shell overlays, tray apps, single-window utilities) can opt
out with
default-features = falseand skip the gtk-rs / glib-sys /gettext-sys cascade on Linux.
Why
On Linux,
floemunconditionally pullsmudawith thegtkfeature, which drags in ~30 gtk-rs sys crates and gettext-sys. For
apps that never open a menu bar this is pure overhead with two
concrete costs:
multiarch'd or sysroot'd glib build — currently a hand-rolled apt
source-list dance or a
cross-rs/crosscontainer.has been deprecated upstream (
RUSTSEC-2024-0412/0413/0415/0416/0418/0419/0420)plus
proc-macro-error(RUSTSEC-2024-0370). Every downstream hasto ignore these advisories with rationale.
What changed
Cargo.toml—menus = ["dep:muda"]feature; added todefault;mudaworkspace dep + target-specific entries markedoptional = true.src/— everyuse muda::*/pub use muda/muda::*callsite cfg-gated with
#[cfg(feature = "menus")]. Touchedlib.rs,action.rs,message.rs,context.rs,app/{mod,handle}.rs,window/{handle,state}.rs,view/{id,state}.rs,views/decorator.rs,event/dispatch.rs,platform/mod.rs.absent off-feature. Consumers see the missing API at compile time
if they call into it.
Verification
Notes
muda = { workspace = true }in a windows+macos target block ANDmuda = { workspace = true, default-features = false, features = ["gtk"] }in a Linuxtarget block. The windows+macos block was redundant once the
workspace
optional = truewas set, so it collapses to a singlegeneral
muda = { workspace = true, optional = true }plus theLinux-specific gtk-feature override. Cargo's merge of the two
entries preserves the original per-OS feature set.
cargo fmtis broken project-wide for this checkout (existinglet-chains in
dispatch.rs/handle.rsaren't parsed by stable ornightly rustfmt). Touched files match the surrounding style; no
blanket reformat was applied.
Test plan
cargo build -p floem --no-default-features --features default-image-formats,vger,serde,editor— clean, zero muda/gtk artifacts.cargo check -p floem(default features) — clean.cargo check -p floem --features menus— clean.cargo build -p floem --all-features— clean.