std.build.WriteFileStep: fix regression in this branch
This branch makes WriteFileStep use the same hashing algorithm as our cache system, reducing the divergence between zig build and the cache system.
This commit is contained in:
@@ -135,7 +135,6 @@ fn make(step: *Step) !void {
|
||||
self.output_dir = try std.fs.path.join(gpa, &[_][]const u8{
|
||||
self.builder.cache_root, "o", &hash_basename,
|
||||
});
|
||||
|
||||
var dir = std.fs.cwd().makeOpenPath(self.output_dir, .{}) catch |err| {
|
||||
std.debug.print("unable to make path {s}: {s}\n", .{ self.output_dir, @errorName(err) });
|
||||
return err;
|
||||
|
||||
@@ -82,16 +82,15 @@ fn make(step: *Step) !void {
|
||||
}
|
||||
var digest: [16]u8 = undefined;
|
||||
hash.final(&digest);
|
||||
var hash_basename: [64]u8 = undefined;
|
||||
var hash_basename: [digest.len * 2]u8 = undefined;
|
||||
_ = std.fmt.bufPrint(
|
||||
&hash_basename,
|
||||
"{s}",
|
||||
.{std.fmt.fmtSliceHexLower(&digest)},
|
||||
) catch unreachable;
|
||||
|
||||
self.output_dir = try fs.path.join(self.builder.allocator, &[_][]const u8{
|
||||
self.builder.cache_root,
|
||||
"o",
|
||||
&hash_basename,
|
||||
self.builder.cache_root, "o", &hash_basename,
|
||||
});
|
||||
var dir = fs.cwd().makeOpenPath(self.output_dir, .{}) catch |err| {
|
||||
std.debug.print("unable to make path {s}: {s}\n", .{ self.output_dir, @errorName(err) });
|
||||
|
||||
Reference in New Issue
Block a user