Skip to content

Commit b148d61

Browse files
committed
fix: don't need to hash contents directly
1 parent d24570c commit b148d61

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

src/EmbedFile.zig

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fn make(step: *std.Build.Step, prog_node: std.Progress.Node) !void {
115115
var man = b.graph.cache.obtain();
116116
defer man.deinit();
117117

118-
man.hash.add(@as(u32, 0x904702ab));
118+
man.hash.add(@as(u32, 0xff4702ab));
119119

120120
// embed_file.wf.generated_directory.path.? is an absolute path
121121
const len = b.cache_root.path.?.len;
@@ -128,20 +128,16 @@ fn make(step: *std.Build.Step, prog_node: std.Progress.Node) !void {
128128
man.hash.addOptional(decl.alignment);
129129
man.hash.add(decl.kind);
130130
switch (decl.kind) {
131-
.file => {
132-
const idx = try man.addFile(b.cache_root.join(gpa, &.{ gen_dir_path, decl.name }) catch @panic("OOM"), null);
133-
man.hash.addBytes(man.files.keys()[idx].contents.?);
134-
},
131+
.file => _ = try man.addFile(b.cache_root.join(gpa, &.{ gen_dir_path, decl.name }) catch @panic("OOM"), std.math.maxInt(usize)),
135132
.directory => {
136133
var sub_dir = try dir.openDir(decl.name, .{ .iterate = true });
137134
defer sub_dir.close();
138135

139136
var it = try sub_dir.walk(gpa);
140-
while (try it.next()) |entry|
141-
if (entry.kind == .file) {
142-
const idx = try man.addFile(b.cache_root.join(gpa, &.{ gen_dir_path, decl.name, entry.path }) catch @panic("OOM"), null);
143-
man.hash.addBytes(man.files.keys()[idx].contents.?);
144-
};
137+
while (try it.next()) |entry| {
138+
if (entry.kind == .file)
139+
_ = try man.addFile(b.cache_root.join(gpa, &.{ gen_dir_path, decl.name, entry.path }) catch @panic("OOM"), std.math.maxInt(usize));
140+
}
145141
},
146142
}
147143
}

0 commit comments

Comments
 (0)