authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-18 22:47:54 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-18 22:47:54 -07:00
logc035b13e98764f412198bb37944239f7cef4cc92
tree9154c27bdf62ed265eeab6247ea688b362b6888b
parent2f18c5bca1e43eba99e5a6ee00feeb746220d9bc

cmd/fetch: include the hash of build.zig in the root_files zig file name

this solved a problem in a monorepo of mine where multiple apps were sourcing from the same .zigmod directory

1 files changed, 2 insertions(+), 1 deletions(-)

src/common.zig+2-1
...@@ -31,7 +31,8 @@ pub fn collect_deps_deep(cachepath: string, mdir: std.fs.Dir, options: *CollectO...@@ -31,7 +31,8 @@ pub fn collect_deps_deep(cachepath: string, mdir: std.fs.Dir, options: *CollectO
31 var moduledeps = std.ArrayList(zigmod.Module).init(options.alloc);31 var moduledeps = std.ArrayList(zigmod.Module).init(options.alloc);
32 errdefer moduledeps.deinit();32 errdefer moduledeps.deinit();
33 if (m.root_files.len > 0) {33 if (m.root_files.len > 0) {
34 try moduledeps.append(try add_files_package(options.alloc, cachepath, "root", mdir, m.root_files));34 const builddotzig = try extras.hashFile(mdir, "build.zig", std.crypto.hash.Sha1);
35 try moduledeps.append(try add_files_package(options.alloc, cachepath, "root_" ++ &builddotzig, mdir, m.root_files));
35 }36 }
36 try moduledeps.append(try collect_deps(cachepath, mdir, .local, options));37 try moduledeps.append(try collect_deps(cachepath, mdir, .local, options));
37 for (m.rootdeps) |*d| {38 for (m.rootdeps) |*d| {