Skip to content

Conversation

GasInfinity
Copy link
Contributor

@GasInfinity GasInfinity commented Sep 26, 2025

It applies the same logic std.Build.Step.WriteFile uses. However some run steps want the cache directory as an argument thus breaking things.

Closes #20935

@GasInfinity
Copy link
Contributor Author

😅 Oops, I did a simple test locally and it worked. I'll check CI failures later, sorry!

@GasInfinity
Copy link
Contributor Author

Looks like this was what triggered the failures, trying to cache the cache directory...

pub fn enableTestRunnerMode(run: *Run) void {
const b = run.step.owner;
run.stdio = .zig_test;
run.addPrefixedDirectoryArg("--cache-dir=", .{ .cwd_relative = b.cache_root.path orelse "." });
run.addArgs(&.{
b.fmt("--seed=0x{x}", .{b.graph.random_seed}),
"--listen=-",
});
}

The tmp directory gets added to the cache and then it gets deleted, thus causing those FileNotFound errors.

One simple fix is ignoring non-existent files when populating hashes. However I don't think caching the cache directory is a good idea.

@GasInfinity GasInfinity force-pushed the step-run-cache-directory branch 2 times, most recently from dfb213d to bab6878 Compare September 26, 2025 18:21
* adds each file by walking like what `std.Build.Step.WriteFile` does.
* adds `addPathArg` for uncached `LazyPath`s as caching the cache
  directory must not be done.
@GasInfinity GasInfinity force-pushed the step-run-cache-directory branch from bab6878 to 751617c Compare September 26, 2025 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add recursive directory contents when using RunStep.addDirectoryArg and friends

1 participant