motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit 5e7b09ce9fbc95ec9fb9e277d262b9b5a5aa1917 (tree)
parent 07630eb696a4c7097fadf9e0261411d591a82038
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sat, 18 Feb 2023 11:31:31 -0700

std.Build.RunStep: fix default caching logic

RunStep is supposed to auto-detect whether the intend is for
side-effects or for producing an output file. The auto-detection logic
was incorrect, and this commit fixes it.

I tested this manually locally. Automated testing will require a more
significant investment in the test harness, which I will work on in a
future enhancement.

closes #14666

Diffstat:
Mlib/std/Build/RunStep.zig | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/std/Build/RunStep.zig b/lib/std/Build/RunStep.zig @@ -188,6 +188,10 @@ fn stdIoActionToBehavior(action: StdIoAction) std.ChildProcess.StdIo { } fn needOutputCheck(self: RunStep) bool { + switch (self.condition) { + .always => return false, + .output_outdated => {}, + } if (self.extra_file_dependencies.len > 0) return true; for (self.argv.items) |arg| switch (arg) { @@ -195,10 +199,7 @@ fn needOutputCheck(self: RunStep) bool { else => continue, }; - return switch (self.condition) { - .always => false, - .output_outdated => true, - }; + return false; } fn make(step: *Step) !void {