Skip to content

Commit 656b61d

Browse files
committed
fix stale cache issue
1 parent 648a47a commit 656b61d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

build.zig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,17 @@ fn linkPlatform(b: *std.Build, target: std.Build.ResolvedTarget, app_mod: *std.B
418418
// resources/ folder — the exe is fully self-contained.
419419
fn addWindowsAssetEmbed(b: *std.Build, app_mod: *std.Build.Module, frontend_build: *std.Build.Step.Run) void {
420420
const gen = b.addSystemCommand(&.{ "node", "scripts/embed-assets.mjs" });
421-
gen.addArg(b.pathFromRoot("frontend/out"));
421+
// Pass frontend/out as a *tracked directory* input, not a bare path string.
422+
// This Run step produces an output file, so Zig caches it keyed on its inputs —
423+
// and addDirectoryArg hashes the directory's CONTENTS into that key. With a
424+
// plain addArg(path) the key was just the (constant) argv, so Zig happily reused
425+
// a previously generated keyparty_assets.c whenever the args matched, embedding a
426+
// STALE frontend even though npm had just rebuilt frontend/out. (dependOn only
427+
// orders the steps; it does not feed contents into the cache key.) That cached
428+
// C survives across CI runs too, since mlugg/setup-zig caches the Zig cache —
429+
// which is why fresh source kept shipping an old embedded UI. Tracking the dir
430+
// makes a frontend change a cache miss, so the embed is regenerated.
431+
gen.addDirectoryArg(b.path("frontend/out"));
422432
const gen_c = gen.addOutputFileArg("keyparty_assets.c");
423433
gen.step.dependOn(&frontend_build.step); // needs the built frontend on disk
424434

0 commit comments

Comments
 (0)