From b835d7eaa2285185019d20be6363ffc92a7f4872 Mon Sep 17 00:00:00 2001 From: Mark Schaller Date: Sat, 26 Sep 2026 02:32:27 -0400 Subject: [PATCH] Warn that Bazel's defines are transitive (for discussion) CMake scopes a compile definition to a target (PRIVATE) or its consumers (PUBLIC/INTERFACE). Bazel's `defines` always propagate to every dependent; the equivalent of PRIVATE is `local_defines`. The per-TU diff only checks that each TU gets the defines CMake gave it, so a PRIVATE define written as `defines` converges while changing how every consumer compiles (a visibility macro such as _EXPORTS turning on export-side behavior in consumers is the classic case). The only signal would be a WARN-level extra define on each consumer's TUs. Observed in any2bazel-lab: a lensfun migration avoided this unprompted, putting its visibility and _EXPORTS defines in local_defines for exactly this reason. No run has yet been seen getting it wrong, so there is no evidence the skill needs the line. Adds one sentence to "Create initial BUILD.bazel files". In the lab's later lensfun run with this change, the agent again kept those defines in local_defines. This is a proposal for discussion: it costs a line of context in every run to prevent a mistake not yet observed. Lab-Proposal: P7 Co-Authored-By: Claude Opus 5.5 --- SKILL.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SKILL.md b/SKILL.md index a925e45..5ba87c7 100644 --- a/SKILL.md +++ b/SKILL.md @@ -298,10 +298,12 @@ recorded apart, as `test_configure_command`. ### Create initial BUILD.bazel files {#create-build-files} Read `model..json`. For each production target emit a `cc_library` / -`cc_binary` with `srcs`, `hdrs`, `copts`, `defines`, `includes`, `deps`. Library -grouping need not match the reference (TU-set comparison is -grouping-agnostic), but keep **executable** names aligned or add a `target_map` -entry. Write `MODULE.bazel` as needed — before picking rulesets or pinning +`cc_binary` with `srcs`, `hdrs`, `copts`, `defines`, `includes`, `deps`. Bazel's +`defines` propagate to every dependent; a define the reference keeps private to +one target (CMake's `PRIVATE`, such as `_EXPORTS`) belongs in +`local_defines`. Library grouping need not match the reference (TU-set +comparison is grouping-agnostic), but keep **executable** names aligned or add +a `target_map` entry. Write `MODULE.bazel` as needed — before picking rulesets or pinning versions, read [docs/BAZEL-RULES.md](docs/BAZEL-RULES.md) (which rulesets have been exercised here, why some were hand-written instead, and why a version must be resolved