From 5aa49ce7262472d7ded2d6d6885bad69331f80ab Mon Sep 17 00:00:00 2001 From: alexion Date: Thu, 17 Sep 2026 12:37:28 -0400 Subject: [PATCH] docs(skills): split build style rules --- .../build/rules/{rust.md => dependencies.md} | 26 +------------------ src/skills/style/build/rules/tests.md | 25 ++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) rename src/skills/style/build/rules/{rust.md => dependencies.md} (61%) create mode 100644 src/skills/style/build/rules/tests.md diff --git a/src/skills/style/build/rules/rust.md b/src/skills/style/build/rules/dependencies.md similarity index 61% rename from src/skills/style/build/rules/rust.md rename to src/skills/style/build/rules/dependencies.md index f66d2cb..f0bf7c2 100644 --- a/src/skills/style/build/rules/rust.md +++ b/src/skills/style/build/rules/dependencies.md @@ -1,4 +1,4 @@ -# Rust build rules +# Dependency rules ## Use workspace dependency versions @@ -28,27 +28,3 @@ Apply this rule to `rust_library`, `rust_binary`, and `rust_test` targets. Cargo and Bazel resolve Rust dependencies independently. Complete declarations keep `cargo check`, Rust Analyzer, and Bazel builds consistent. - -## Declare Rust tests in Bazel - -### Rule - -Declare Rust test files in the nearest Bazel `BUILD` file with `rust_test`. -Do not add `[[test]]` entries to `Cargo.toml` unless the operator explicitly requests Cargo test declarations. - -### Rationale - -Bazel is the source of truth for Rust test targets in this repository. -Keeping test declarations in Bazel avoids duplicate test target lists. - -## Use one source input style per `rust_test` - -### Rule - -Do not set both `crate` and `srcs` on a `rust_test` target. -Use exactly one input style for each Rust test target. - -### Rationale - -`rules_rust` rejects `rust_test` targets that set both `crate` and `srcs`. -Keeping one input style per target makes the test declaration valid and unambiguous. diff --git a/src/skills/style/build/rules/tests.md b/src/skills/style/build/rules/tests.md new file mode 100644 index 0000000..aa45381 --- /dev/null +++ b/src/skills/style/build/rules/tests.md @@ -0,0 +1,25 @@ +# Test rules + +## Declare Rust tests in Bazel + +### Rule + +Declare Rust test files in the nearest Bazel `BUILD` file with `rust_test`. +Do not add `[[test]]` entries to `Cargo.toml` unless the operator explicitly requests Cargo test declarations. + +### Rationale + +Bazel is the source of truth for Rust test targets in this repository. +Keeping test declarations in Bazel avoids duplicate test target lists. + +## Use one source input style per `rust_test` + +### Rule + +Do not set both `crate` and `srcs` on a `rust_test` target. +Use exactly one input style for each Rust test target. + +### Rationale + +`rules_rust` rejects `rust_test` targets that set both `crate` and `srcs`. +Keeping one input style per target makes the test declaration valid and unambiguous.