| ... | ... | @@ -70,7 +70,8 @@ pub fn make( |
| 70 | 70 | man.hash.add(conf_run.flags.color); |
| 71 | 71 | man.hash.add(conf_run.flags.disable_zig_progress); |
| 72 | 72 | |
| 73 | | var dep_file_count: usize = 0; |
| 73 | var any_dep_files = false; |
| 74 | var any_output_args = false; |
| 74 | 75 | |
| 75 | 76 | for (conf_run.args.slice) |arg_index| { |
| 76 | 77 | const arg = arg_index.get(conf); |
| ... | ... | @@ -161,9 +162,10 @@ pub fn make( |
| 161 | 162 | man.hash.addBytesZ(prefix); |
| 162 | 163 | man.hash.addBytesZ(basename); |
| 163 | 164 | man.hash.addBytesZ(suffix); |
| 164 | | |
| 165 | 165 | man.hash.add(arg.flags.dep_file); |
| 166 | | dep_file_count += @intFromBool(arg.flags.dep_file); |
| 166 | |
| 167 | any_dep_files = any_dep_files or arg.flags.dep_file; |
| 168 | any_output_args = true; |
| 167 | 169 | |
| 168 | 170 | // Add a placeholder into the argument list because we need the |
| 169 | 171 | // manifest hash to be updated with all arguments before the |
| ... | ... | @@ -233,7 +235,14 @@ pub fn make( |
| 233 | 235 | _ = man.hash.addBytes(try cwd_path.toString(arena)); |
| 234 | 236 | } |
| 235 | 237 | |
| 236 | | const has_side_effects = conf_run.flags.has_side_effects; |
| 238 | // Whether the Run step has side effects *other than* updating the output arguments. |
| 239 | const has_side_effects = conf_run.flags.has_side_effects or switch (conf_run.flags.stdio) { |
| 240 | .infer_from_args => !any_output_args and |
| 241 | conf_run.captured_stdout.value == null and |
| 242 | conf_run.captured_stderr.value == null, |
| 243 | .inherit => true, |
| 244 | .check, .zig_test => false, |
| 245 | }; |
| 237 | 246 | |
| 238 | 247 | if (!has_side_effects and try step.cacheHitAndWatch(maker, &man)) { |
| 239 | 248 | // Cache hit; skip running command. |
| ... | ... | @@ -244,7 +253,7 @@ pub fn make( |
| 244 | 253 | return; |
| 245 | 254 | } |
| 246 | 255 | |
| 247 | | if (dep_file_count == 0) { |
| 256 | if (!any_dep_files) { |
| 248 | 257 | // We already know the final output paths; use them directly. |
| 249 | 258 | const digest = if (has_side_effects) man.hash.final() else man.final(); |
| 250 | 259 | const output_dir_path = "o" ++ Dir.path.sep_str ++ &digest; |