Repository navigation
Warn that Bazel's defines are transitive (for discussion) - #57
Open
anakanemison wants to merge 1 commit into
Open
anakanemison wants to merge 1 commit into
anakanemison wants to merge 1 commit into
Conversation
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 <target>_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 <target>_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 <noreply@anthropic.com>
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.
Part 22 of 23 of a stacked series (tracking issue: #35). Based on
D4-long-commands, the previous part: review and merge that first.Kind: discussion. Lab proposal: P7.
What the migration runs showed
definespropagate to dependents where CMake'sPRIVATEdefinitions do not. With the warning, the lensfun run kept<target>_EXPORTSand visibility defines inlocal_defines(run 083).The change
CMake scopes a compile definition to a target (PRIVATE) or its consumers
(PUBLIC/INTERFACE). Bazel's
definesalways propagate to every dependent;the equivalent of PRIVATE is
local_defines. The per-TU diff only checksthat each TU gets the defines CMake gave it, so a PRIVATE define written as
definesconverges while changing how every consumer compiles (avisibility 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.
Testing
pytest tests/at this commit: 196 passed (130 onmain).🤖 Generated with Claude Code