authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-02-18 11:31:31-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-02-18 19:33:47-05:00
log5e7b09ce9fbc95ec9fb9e277d262b9b5a5aa1917
tree5d916f4d7116d20ae84b1f2b7b9a98368239b14b
parent07630eb696a4c7097fadf9e0261411d591a82038

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

1 files changed, 5 insertions(+), 4 deletions(-)

lib/std/Build/RunStep.zig+5-4
......@@ -188,6 +188,10 @@ fn stdIoActionToBehavior(action: StdIoAction) std.ChildProcess.StdIo {
188188}
189189
190190fn needOutputCheck(self: RunStep) bool {
191 switch (self.condition) {
192 .always => return false,
193 .output_outdated => {},
194 }
191195 if (self.extra_file_dependencies.len > 0) return true;
192196
193197 for (self.argv.items) |arg| switch (arg) {
......@@ -195,10 +199,7 @@ fn needOutputCheck(self: RunStep) bool {
195199 else => continue,
196200 };
197201
198 return switch (self.condition) {
199 .always => false,
200 .output_outdated => true,
201 };
202 return false;
202203}
203204
204205fn make(step: *Step) !void {