A private build reuses each main build object whose compile is provably the same, also for a private lift in another generated dir

build_game.py used to reuse build/<ver>'s generated objects only as a whole and only for generated/<ver>, so a private
lift of a patch change (gen.py --out generated/<ver>-prN, build_game.py --gen) compiled all 421 chunks, about 5 min on
12 jobs, for one changed chunk. main_objects now decides per object: same compiler, flags and rule in the main
build.ninja (with the main runtime/ and generated dir in place of ours), main build up to date, and every file the main
compile read according to its Ninja deps log byte-identical on our side and unchanged since the object was written
(NTFS ChangeTime, st_ctime elsewhere), the compiler binaries too. A file new on our side whose name those compiles
included or probed blocks the reuse. Anything unknown compiles. The build prints "reused N of M generated objects",
--verbose lists the rest with the reason; obj/reused.txt lets a later build delete a copied object before compiling it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-17 19:37:43 +03:00
1 parent a5c3e0f9f5
commit 2b95408642
2 files changed
+297 -87

No files matched your search

+9
View File
@@ -111,6 +111,15 @@ of them.
$env:SCCACHE = "path\to\sccache.exe"
.venv\Scripts\python tools\build_game.py --version <ver>
```
A build into another `--out` (a task build, or a private lift of a patch change with `--gen generated\<ver>-<tag>`)
hardlinks the objects of the main build `build\<ver>` and compiles only `runtime/` and the generated files whose
compile differs. An object is reused when the main `build.ninja` has the same compiler, flags and rule, the main
build is up to date, and every file its compile read according to the main Ninja deps log (the `.c`, the `runtime/`
and generated headers, the system headers) has the same bytes in this build's trees and has not changed since the
object was written, and neither has the compiler. A lift that changes one patch site then compiles one or two chunks
instead of all of them. The build prints `reused N of M generated objects`; `--verbose` lists the others with the
reason, and `--full-build` compiles everything.
`--patches` builds in the frame-rate, resolution and other patch sets, switchable at run time. The link copies
`SDL3.dll`, `libiconv-2.dll` and `libopus-0.dll` next to the exe.
For Xbox button prompts, run `make_romfs_patches.py` twice more, with `--prompts xbox` and `--prompts xbox-label`: