diff --git a/crates/craft/Cargo.toml b/crates/craft/Cargo.toml index 9a92f14c0..eeb7ccd6e 100644 --- a/crates/craft/Cargo.toml +++ b/crates/craft/Cargo.toml @@ -323,7 +323,7 @@ deckcraft-format = ["dep:craft-deckcraft-format"] designcraft-format = ["dep:craft-designcraft-format"] -dialogs = ["dep:craft-dialogs"] # native only: rfd's folder picker and file paths +dialogs = ["dep:craft-dialogs", "browse"] # native only: rfd's folder picker and file paths doc = ["dep:craft-doc"] doc-pcraft-pixels = ["doc", "craft-doc/pcraft-pixels"] @@ -542,7 +542,7 @@ openpgp = ["dep:craft-openpgp"] ora = ["dep:craft-ora"] -pages = ["dep:craft-pages"] +pages = ["dep:craft-pages", "keymap", "text"] palette = ["dep:craft-palette"] @@ -642,7 +642,7 @@ raw-raf = ["raw", "craft-raw/raf"] raw-rw2 = ["raw", "craft-raw/rw2"] raw-srw = ["raw", "craft-raw/srw"] -review = ["dep:craft-review", "keymap"] +review = ["dep:craft-review", "keymap", "pages"] rtf = ["dep:craft-rtf"] rtf-doc = ["rtf", "craft-rtf/doc"] diff --git a/crates/craft/tests/families.rs b/crates/craft/tests/families.rs index 4ddea2ab5..5ca90293c 100644 --- a/crates/craft/tests/families.rs +++ b/crates/craft/tests/families.rs @@ -37,6 +37,13 @@ const BASE: &[&str] = &["color-ui"]; /// and not a family itself. const COMPOSITION: &[&str] = &["menu"]; +/// Edges between families that are allowed, each with its reason (developer ruling, port S-L347). +const ALLOWED: &[(&str, &str, &str)] = &[ + ("dialogs", "browse", "the file chooser lists browse's places"), + ("pages", "text", "the page rulers are text's ruler over a page"), + ("review", "pages", "comment balloons sit beside placed pages"), +]; + /// Family crates `m`'s `ui` depends on: through its `ui` feature, and through dependencies that turn `ui` on. fn ui_edges(m: &Member) -> Vec { let mut edges: Vec = m.features.get("ui").into_iter().flatten().filter_map(|e| common::crate_of(e)).map(str::to_owned).collect(); @@ -58,10 +65,12 @@ fn family_ui_depends_on_no_other_family() { let mut offenders = Vec::new(); for m in members().iter().filter(|m| FAMILIES.contains(&m.dir.as_str()) && !COMPOSITION.contains(&m.dir.as_str())) { for dep in ui_edges(m) { - if dep != m.dir && FAMILIES.contains(&dep.as_str()) && !BASE.contains(&dep.as_str()) { + if dep != m.dir && FAMILIES.contains(&dep.as_str()) && !BASE.contains(&dep.as_str()) + && !ALLOWED.iter().any(|(from, to, _)| *from == m.dir && *to == dep) + { offenders.push(format!("craft-{}'s ui depends on craft-{dep}", m.dir)); } } } - assert!(offenders.is_empty(), "family ui crates may depend only on craft-color-ui's ui, not on each other:\n{}", offenders.join("\n")); + assert!(offenders.is_empty(), "family ui crates may depend only on craft-color-ui's ui, not on each other (beyond ALLOWED):\n{}", offenders.join("\n")); }