Skip to content

[CI] Check that a second build has nothing to do - #23056

Draft
guitargeek wants to merge 3 commits into
root-project:masterfrom
guitargeek:ci-null-build-check
Draft

[CI] Check that a second build has nothing to do#23056
guitargeek wants to merge 3 commits into
root-project:masterfrom
guitargeek:ci-null-build-check

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

Building an already built tree twice in a row must be a no-op, apart from etc/gitinfo.txt which the gitinfotxt target rewrites on every build by design. When that is not the case, every incremental build pays for the targets that are needlessly redone plus everything depending on them.

Add a null build check that runs on all platforms right after the build: it fingerprints every file in the build tree, builds again, and reports what was written. Doing it this way rather than parsing build tool output keeps it working across Ninja, Makefiles and MSBuild alike.

The verdict is only acted on at the very end, after ctest, so that a spurious rebuild does not cost us the test results.

🤖 Done with the help of AI

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

Test Results

    23 files      23 suites   5d 6h 25m 3s ⏱️
 3 857 tests  3 850 ✅ 0 💤   7 ❌
78 561 runs  78 453 ✅ 0 💤 108 ❌

For more details on these failures, see this check.

Results for commit b2b7f9d.

♻️ This comment has been updated with latest results.

Building an already built tree twice in a row must be a no-op, apart from
etc/gitinfo.txt which the gitinfotxt target rewrites on every build by
design. When that is not the case, every incremental build pays for the
targets that are needlessly redone plus everything depending on them.

Add a null build check that runs on all platforms right after the build:
it fingerprints every file in the build tree, builds again, and reports
what was written. Doing it this way rather than parsing build tool output
keeps it working across Ninja, Makefiles and MSBuild alike.

The verdict is only acted on at the very end, after ctest, so that a
spurious rebuild does not cost us the test results.

🤖 Done with the help of AI
@guitargeek
guitargeek force-pushed the ci-null-build-check branch 2 times, most recently from 8315dc9 to b2b7f9d Compare August 10, 2026 22:35
ROOT_STANDARD_LIBRARY_PACKAGE(... NO_SOURCES) provided the dummy source file
that add_library() needs as the output of a custom command that touches it.
All the packages of one directory share that output, and listing one custom
command output in several independent targets that build in parallel is not
supported; core/clingutils alone has 15 of them.

Ninja and Make happen to get away with it, but with MSBuild the touch runs
again on every build, so 14 of the 15 STL dictionaries were recompiled and
relinked every time, along with everything depending on them.

Write the file at configure time instead. Nothing touches it at build time
anymore, so it cannot go stale under the targets that compile it.

🤖 Done with the help of AI
MSBuild re-executes these post-build events even when the build has
nothing to do, and `cmake -E copy` rewrites its destination
unconditionally, so every null build modified those files. Ninja and
Makefiles are immune because there POST_BUILD steps only run when the
target itself relinks.

Use `cmake -E copy_if_different` so a no-op event leaves the destination
untouched, and replace the data.h POST_BUILD hack with
configure_file(... COPYONLY), the convention the sibling test
directories already use for such runtime inputs.

🤖 Done with the help of AI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant