Skip to content

Tell the agent to map the build type to flags, not to a compilation mode - #48

Open
anakanemison wants to merge 1 commit into
mschaller/u12-reference-configurationfrom
mschaller/u13-build-type-to-flags
Open

anakanemison wants to merge 1 commit into
mschaller/u12-reference-configurationfrom
mschaller/u13-build-type-to-flags

Conversation

@anakanemison

Copy link
Copy Markdown

Part 13 of 23 of a stacked series (tracking issue: #35). Based on U12-reference-configuration, the previous part: review and merge that first.

Kind: guidance. Lab proposal: P18.

What the migration runs showed

-c opt adds -O2 and NDEBUG; cmake's reference has neither. With this guidance, cmake migrations kept the reference's build type (runs 086, 087, 094).

The change

The skill never mentioned CMAKE_BUILD_TYPE or --compilation_mode, and its
canonicalization text called -O*/-g* "never your concern" (reworded in the
levels commit). Agents therefore map the concept, Release to -c opt,
and lose the number: CMake's Release is -O3 -DNDEBUG, Bazel's opt is -O2;
CMake's Debug is -g, Bazel's default fastbuild has neither.

Measured in any2bazel-lab: all nine migrations of pono, with and without
the skill, wrote
build --compilation_mode=opt as the counterpart of Release, several
saying so in a comment on the line above, and eight of the nine compile at
-O2 against a reference at -O3; the ninth added build --copt=-O3 and
matched. lensfun's CMakeLists.txt defaults the build type to Debug when
none is given; no lensfun migration set a compilation mode, so every one
dropped -g from all 40 TUs.

Adds a short "Build type" section to docs/REFERENCE-cmake.md, under a new
"Writing the BUILD files" heading that "Create initial BUILD.bazel files"
points to: the two mappings that differ, the reminder that a project can set its own default build type,
where to read the reference's actual level (diff.json's levels, or the
cache), and the two .bazelrc lines that pin it. It also says that opt adds
-DNDEBUG and so turns off assertions the reference may keep (diff.json's
ndebug shows it), and that
build --copt=-UNDEBUG undoes only the toolchain's -DNDEBUG, not one a
rule passes in its copts, which come later on the command line.

In the lab's later runs with this change, pono kept -O3, lensfun kept -g,
and CMake's sources, whose reference sets no build type, gained neither -O2
nor NDEBUG in three runs (two earlier runs had added both).

Testing

pytest tests/ at this commit: 196 passed (130 on main).

🤖 Generated with Claude Code

The skill never mentioned CMAKE_BUILD_TYPE or --compilation_mode, and its
canonicalization text called -O*/-g* "never your concern" (reworded in the
levels commit). Agents therefore map the concept, Release to `-c opt`,
and lose the number: CMake's Release is -O3 -DNDEBUG, Bazel's opt is -O2;
CMake's Debug is -g, Bazel's default fastbuild has neither.

Measured in any2bazel-lab: all nine migrations of pono, with and without
the skill, wrote
`build --compilation_mode=opt` as the counterpart of Release, several
saying so in a comment on the line above, and eight of the nine compile at
-O2 against a reference at -O3; the ninth added `build --copt=-O3` and
matched. lensfun's CMakeLists.txt defaults the build type to Debug when
none is given; no lensfun migration set a compilation mode, so every one
dropped -g from all 40 TUs.

Adds a short "Build type" section to docs/REFERENCE-cmake.md, under a new
"Writing the BUILD files" heading that "Create initial BUILD.bazel files"
points to: the two mappings that differ, the reminder that a project can set its own default build type,
where to read the reference's actual level (diff.json's levels, or the
cache), and the two .bazelrc lines that pin it. It also says that opt adds
-DNDEBUG and so turns off assertions the reference may keep (diff.json's
ndebug shows it), and that
`build --copt=-UNDEBUG` undoes only the toolchain's -DNDEBUG, not one a
rule passes in its copts, which come later on the command line.

In the lab's later runs with this change, pono kept -O3, lensfun kept -g,
and CMake's sources, whose reference sets no build type, gained neither -O2
nor NDEBUG in three runs (two earlier runs had added both).

Lab-Proposal: P18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant