Skip to content

Commit 49d6cbc

Browse files
authored
fix(build): self-heal stale build.ninja + bump 0.0.58 (#142)
* fix(build): self-heal stale build.ninja on 'missing and no known rule' When a dependency package under the registry is reinstalled/moved but keeps the same version string, the build fingerprint (which does not yet cover registry dep state) is unchanged, so the cached build.ninja is reused. Ninja then aborts with 'missing and no known rule to make it' and the build hard-fails, forcing the user to run `mcpp clean` by hand. Add that signature to is_stale_ninja_failure so try_fast_build drops to a full graph regeneration (same invocation) instead of failing — the stale graph is rewritten against the current dep state and the build proceeds. (Folding registry dep state into the fingerprint to avoid the regen entirely is a larger follow-up; see .agents/docs/2026-06-22 §T-j.) * chore: bump version 0.0.57 -> 0.0.58 Release carrying the follow-up batch: scanner raw-string fix (#138), first-run progress (#139), toolchain effective-resolution (#140), doctor runtime-dep check (#141), and the build.ninja self-heal above.
1 parent cced0fd commit 49d6cbc

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

mcpp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mcpp"
3-
version = "0.0.57"
3+
version = "0.0.58"
44
description = "Modern C++ build & package management tool"
55
license = "Apache-2.0"
66
authors = ["mcpp-community"]

src/build/execute.cppm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,14 @@ bool is_stale_ninja_failure(std::string_view output) {
155155
return output.find("loading 'build.ninja'") != std::string_view::npos
156156
|| output.find("loading build.ninja") != std::string_view::npos
157157
|| output.find("unknown target") != std::string_view::npos
158-
|| output.find("manifest 'build.ninja' still dirty") != std::string_view::npos;
158+
|| output.find("manifest 'build.ninja' still dirty") != std::string_view::npos
159+
// A cached build.ninja can reference an input (e.g. a dependency
160+
// source under the registry) that moved or was reinstalled since the
161+
// graph was generated — the build fingerprint does not yet cover
162+
// registry dep state, so the stale graph is reused. Ninja then aborts
163+
// with this signature. Treat it as stale → drop to a full regen
164+
// instead of hard-failing and forcing the user to `mcpp clean`.
165+
|| output.find("missing and no known rule to make") != std::string_view::npos;
159166
}
160167

161168
// Compile a prepared BuildContext. Shared between `mcpp build` and `mcpp run`

src/toolchain/fingerprint.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import mcpp.toolchain.detect;
1818

1919
export namespace mcpp::toolchain {
2020

21-
inline constexpr std::string_view MCPP_VERSION = "0.0.57";
21+
inline constexpr std::string_view MCPP_VERSION = "0.0.58";
2222

2323
struct FingerprintInputs {
2424
Toolchain toolchain;

0 commit comments

Comments
 (0)