fix(cache): handle missing cache hits when chaining two run steps
fixes #19817 This is the same as #19974 but un-bittrotted
This improves the efficiency of the cache when chaining multiple commands like
const step1 = b.addRunArtifact(tool_fast);
step1.addFileArg(b.path("src/input.c"));
const output1 = step1.addOutputFileArg("output1.h");
const step2 = b.addRunArtifact(tool_slow);
step2.addFileArg(output1);
const chained_output = step2.addOutputFileArg("output2.h");
assume that step2 takes much long time than step1 if we make a change to "src/input.c" which produces an identical "output1.h" as a previous input, one would expect step2 not to rerun as the cached output2.h only depends on the content of output1.h
However, this does not work yet as the hash of src/input.c leaks into the file name of the cached output1.h, which the second run step interprets as a different cache key. Not using the ".zig-build/o/{HASH}" part of the file name in the hash key fixes this.
https://github.com/bfredl/zig-run4run is updated for zig 0.16 as a demonstration. e.g. in src/foo.c changing implementation_of_foo() to new_implementation_of_foo() should only rerun the first step, not the second.