build: seed from the build checkout, one shared ccache, per-build record, discovered CMake sources (b22)

Open
#2,882 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
cmake, cpp, docker

Research direction

Start with the numbered work items in the issue, then read tools/worktree-setup.sh, tools/seed_build_tree.py, and tools/internal/buildgate to understand the current setup, seeding, and build records. Use the cited build logs and CMake source map as baselines. Done means the six listed changes are implemented and the build record, cache behavior, seed refusal, and source discovery are verified with the issue’s evidence.

Written by the indexing model from the issue text.

Description

enhancement

Evidence at d082ef2e3

Each figure names the command or the read that gave it.

  • git rev-list --count e7d38d1e3..d082ef2e3 is 390 (ran). The main checkout's build tree was configured at e7d38d1e3:
    build/mingw-release/build.ninja of the main checkout names that commit (ran grep -l e7d38d1e3).
  • git diff --name-only e7d38d1e3 d082ef2e3 -- '*.cpp' '*.h' | wc -l is 839 (ran).
  • A fresh worktree at cca701054 was refused its seed. cca701054 does not contain the seeder's spelling fix 4b8add1be
    (git merge-base --is-ancestor 4b8add1be cca701054 exits 1). The seeder's documented exit status is 0 for not-seeded
    (git show cca701054:tools/seed_build_tree.py, line 47), so the setup did not stop. That worktree's build log holds 615
    compiled objects: 608 Building CXX object lines and 7 Building C object lines (ran grep -c).
  • A fresh worktree at e1af72182, seeded from the build checkout, built once. Its gate record reads edges_run 12,
    objects_compiled 4, ccache_hits 0, ccache_misses 4. The four objects are src/core/build_identity.cpp,
    src/runtime/host/host_identity.cpp, src/runtime/lifecycle/initialize.cpp and src/runtime/compat/ws_bridge.cpp (the
    build log's Building CXX object lines).
  • At d082ef2e3 the gate's end record carries duration_s as a whole number (DurationS int,
    tools/internal/buildgate/buildgate.go, read with git show). git grep for objects_compiled, ccache_hits and
    ccache_misses under tools/internal/buildgate finds nothing at that commit, so the record has no compile or cache counts.
  • src/runtime/CMakeLists.txt at d082ef2e3 lists the runtime's sources in two sets, PATCHES_SOURCES (line 48) and
    PATCHES_HEADERS (line 313). A probe source added with no edit to those sets was absent from the target-to-source map of
    the configured tree: 0 of 1,576 linked-output rows (cmake_sources_map.py). With the directory's glob in place the same
    probe had 2 rows.

Not shown

  • The objects a seeded worktree compiles for any base other than e1af72182. That is the one base measured.
  • The cache counts of the cca701054 build. Its gate record was not located, so no cache count is claimed for it.
  • Whether ccache entries are shared by two worktrees with different paths. One experiment gave a hit for one name and a
    miss for the other; the cause was not isolated.
  • Whether the map is identical after every directory's glob. This issue does not re-measure it.

Falsifier

The cost claim is wrong if, at d082ef2e3's setup, a fresh worktree's first build seeded from the build checkout compiles no
more objects than the sources that differ from the build checkout's commit and their dependents. The seed would then already
work, and the work below would not be needed.

Work

  1. tools/worktree-setup.sh and tools/seed_build_tree.py: the seed and every fill read the build checkout and no other
    source. A refused seed stops the setup with exit 1 and a logged reason.
  2. One shared ccache for every gated build: the gate sets CCACHE_DIR for a command that names none (tools/internal/buildgate),
    tools/ccache_config.sh writes base_dir, and tools/ccache.conf sets max_size to 60G.
  3. One build record per gated command in <work root>/logs/slot-build.jsonl, with duration_ms, edges_run,
    objects_compiled, ccache_hits and ccache_misses.
  4. tools/cmd/new-worktree takes -base <rev>, and a local base needs no fetch.
  5. Each runtime directory's CMakeLists.txt globs its own sources into nevr_runtime (patch, lifecycle, server, ext, hook,
    log, content, combat, frame, cargo, compat), and the top file adds one add_subdirectory per directory.
    tools/verify_patch_source_inventory.py is removed with its references. Later units: src/runtime/host, src/cdn,
    src/core, the runtime test targets and the combat bindings call.
  6. The go-tools recipe skips its build when the hash of tools/**/*.go, go.mod and go.sum matches its stamp.

Related

#649 (a shared, capped ccache across worktrees), #1936 (a second worktree does not reuse the shared cache) and #975 (the seeder
and a tree built at another commit) cover parts of this. None is closed by this issue's work; each is left open until its own
evidence lands.

Dominant language
C++
Stars
3
Forks
5
Avg merge
4h 37m
Merged PRs (30d)
524

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EchoTools/nevr-runtime

All issues in EchoTools/nevr-runtime

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.