mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:00:52 +01:00
[PR #620] [MERGED] stale_build: follow includes through the CMake include directories (STALE-BUILD-INCLUDE-DIRS) #661
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#661
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/620
Author: @TuroYT
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:fix/stale-build-include-dirs📝 Commits (2)
a92dd6astale_build: follow includes through the CMake include directories (STALE-BUILD-INCLUDE-DIRS)378fcbcstale_build: follow every copy of a header in the include directories📊 Changes
2 files changed (+139 additions, -2 deletions)
View changed files
➕
tests/test_stale_build_include_dirs.py(+109 -0)📝
tools/stale_build.py(+30 -2)📄 Description
Claimed in the coordination issue as: STALE-BUILD-INCLUDE-DIRS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7128145674)
What was wrong
tools/stale_build.py,program_sources(): a quoted#include "..."was resolved only relative to the includingfile's directory (
os.path.join(os.path.dirname(path), inc)). The build also finds headers through the includedirectories of
runtime/CMakeLists.txt.Reproduction on main (
d7576d56a):runtime/test/pe_loader_test.cppline 25 includes"pe_loader.h", which isruntime/src/pe_loader.h. Thepe_loader_testtarget getssrcandshimsatruntime/CMakeLists.txtlines 657-660. Editingpe_loader.hdidnot make the built program stale, so
make_game.pyandtools/first_light.pycould reuse an old binary, against themodule docstring.
What changed
tools/stale_build.py: a new_resolve_include()looks an include up next to the including file first (unchanged),then in
_INCLUDE_DIRS. The constant listsruntime/src,runtime/shims, then the xtaskqueue directories(
runtime/shims/xtaskqueue,third_party/xtaskqueue/Source/Task,Source/Common,Include) thatruntime/CMakeLists.txtgives its test programs at lines 90-92, 1206-1210 and 1227-1229. Every copy found in thosedirectories counts as a source, not only the first: CMake orders the directories per target, so a header present in
two of them could be the copy a given program compiles. No header name exists in two of them today. An include
found nowhere is skipped, as before. The
seenset still stops cycles.tests/test_stale_build_include_dirs.py(new): 11 tests: ten on temporary trees and one smoke test on the real tree.It does not touch
tests/test_stale_build.py, which belongs to #611.Corpus numbers (every
runtime/test/*.cpp)Quoted includes counted with the same regex as the tool.
The 76 that were not next to their file: 53 are in
runtime/srcorruntime/shims, and 23 are xtaskqueue headers(
TaskQueueImpl.h,TaskQueueP.h,XTaskQueue.h,XTaskQueuePriv.h,pch.h,referenced_ptr.h). All 665 nowresolve, and none is a system or generated header.
Note: 368 includes have no
/in their name, but most of those sit next to their file. The 76 is the count thatmatters here.
Tested
Against the unfixed tool (
tools/stale_build.pytaken from main, test file unchanged): 7 of 11 tests fail, includingthe header-in-
runtime/srccase, the exe-marked-stale case, the xtaskqueue cycle and the real-tree smoke test. Thefour that pass on both (next-to-program wins, unresolved header skipped, relative resolution unchanged, missing
program) pin behaviour that must not change.
PR #611 (
tests/test_stale_build.py, 15 tests) copied into the worktree and run against the fixed tool: 15 tests OK.The copy was deleted afterwards.
Review follow-up
Dezmonius checked this on Windows 10 and pointed out that the first revision took the first match in a fixed order
(
srcbeforeshims), which can differ from one CMake target's order: withtarget_include_directories(prog PRIVATE shims src)the compiler takes the shims copy, and editing only that copy leftnewer_sources()empty. The secondcommit follows every copy instead, and
test_editing_only_the_shims_copy_marks_the_exe_stalecovers that case.Not tested
os.path.joinandnormpathhandling was not exercised with backslashes).make_game.pyrun that rebuilds a stale program. Only--helpand the existing dry-run andfirst_light tests were run.
program stale that did not need it (an extra rebuild), never miss one.
AI-assisted (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.