From dcdbd3cc1b3f7747e63d1ae96d6338905074f4ec Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 30 Nov 2026 02:38:02 -0800 Subject: [PATCH] CI: declare the files each crate reads in other crates, for test selection Test selection in the shared gate (`select-tests`) runs the tests of the crates a change reaches. A crate that compiles or reads another crate's files lists them under `[package.metadata.craft]` in its Cargo.toml: - vectorcraft-plugins sets `reads-every-member = true`, because `tests/grant_sites.rs` reads the sources of every crate. - vectorcraft-cli, vectorcraft-affinity, vectorcraft-engine, vectorcraft-mcp, vectorcraft-ui-egui and xtask list the files they compile through `#[path]` or read with `include_str!`/`include_bytes!` or from `CARGO_MANIFEST_DIR`. Cargo ignores this table. Only the gate's selection step reads it, and that step fails when a read is missing from it. --- apps/vectorcraft-cli/Cargo.toml | 11 +++++++++++ crates/affinity/Cargo.toml | 4 ++++ crates/engine/Cargo.toml | 11 +++++++++++ crates/mcp/Cargo.toml | 4 ++++ crates/plugins/Cargo.toml | 4 ++++ crates/ui-egui/Cargo.toml | 4 ++++ xtask/Cargo.toml | 4 ++++ 7 files changed, 42 insertions(+) diff --git a/apps/vectorcraft-cli/Cargo.toml b/apps/vectorcraft-cli/Cargo.toml index 376f431903..25cffe599e 100644 --- a/apps/vectorcraft-cli/Cargo.toml +++ b/apps/vectorcraft-cli/Cargo.toml @@ -48,3 +48,14 @@ objc2-core-text = { version = "0.3", default-features = false, features = ["std" tempfile = "3" vectorcraft-testkit = { workspace = true } serde_json = { workspace = true } + +# The files of other crates that this crate compiles or its tests read, for CI's test selection. +[package.metadata.craft] +reads = [ + "apps/vectorcraft/src/mac_fonts.rs", + "apps/vectorcraft/src/prefs_dir.rs", + "apps/vectorcraft/src/profile.rs", + "apps/vectorcraft/src/system_fonts.rs", + "apps/vectorcraft/src/windows_cores.rs", + "crates/plugins/tests/fixtures/desaturate.wasm", +] diff --git a/crates/affinity/Cargo.toml b/crates/affinity/Cargo.toml index 92977884cf..80876c409a 100644 --- a/crates/affinity/Cargo.toml +++ b/crates/affinity/Cargo.toml @@ -24,3 +24,7 @@ craft-image-codecs = { workspace = true } # tests/it's `import_limits`, `outline_limits` and `text` modules need `synth`, also when this crate # is tested without vectorcraft-engine (`cargo xtask ci shard`). vectorcraft-affinity = { path = ".", features = ["synth"] } + +# The files of other crates that this crate's tests compile or read, for CI's test selection. +[package.metadata.craft] +reads = ["xtask/affinity-corpus.sha256", "xtask/src/sha256.rs"] diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index 027ae10251..1e74ecb5d2 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -143,3 +143,14 @@ ruzstd = { workspace = true } vectorcraft-js = { workspace = true } # A bundled font's own glyph boxes, for the glyph bounds tests. skrifa = { workspace = true } + +# The files of other crates that this crate compiles or its tests read, for CI's test selection. +[package.metadata.craft] +reads = [ + "crates/affinity/tests/support/corpus.rs", + "crates/affinity/tests/support/text_fixture.rs", + "crates/apischema/src/conformance.rs", + "crates/plugins/tests/fixtures/desaturate.wasm", + "xtask/affinity-corpus.sha256", + "xtask/src/sha256.rs", +] diff --git a/crates/mcp/Cargo.toml b/crates/mcp/Cargo.toml index 8aa221b4a6..b5544b958c 100644 --- a/crates/mcp/Cargo.toml +++ b/crates/mcp/Cargo.toml @@ -33,3 +33,7 @@ craft-image-codecs = { workspace = true } vectorcraft-testkit = { workspace = true } proptest = { workspace = true } socket2 = { workspace = true } + +# The files of other crates that this crate's tests compile, for CI's test selection. +[package.metadata.craft] +reads = ["crates/apischema/src/conformance.rs"] diff --git a/crates/plugins/Cargo.toml b/crates/plugins/Cargo.toml index 621f5e79bc..aecb0bd533 100644 --- a/crates/plugins/Cargo.toml +++ b/crates/plugins/Cargo.toml @@ -44,3 +44,7 @@ vectorcraft-plugins = { path = ".", features = ["test-steady"] } [features] # `vectorcraft_plugins::steady` for other crates' tests (dev-dependencies only). test-steady = [] + +# For CI's test selection: `tests/grant_sites.rs` reads the sources of every crate. +[package.metadata.craft] +reads-every-member = true diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index 95487e91c0..d0bb345b44 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -109,3 +109,7 @@ wat = { workspace = true } [build-dependencies] serde_json = { workspace = true } toml = "1" + +# The files of other crates that this crate's tests read, for CI's test selection. +[package.metadata.craft] +reads = ["crates/engine/src/cmd/addons/cutting/banner.rs", "crates/plugins/tests/fixtures/desaturate.wasm"] diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 6d935ae8fd..7a5c83e8b5 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -10,3 +10,7 @@ workspace = true [dependencies] serde_json = { workspace = true } + +# The files of other crates that this crate compiles, for CI's test selection. +[package.metadata.craft] +reads = ["crates/text/build/web_fonts.rs"]