Skip to content

Commit 5a04ade

Browse files
committed
deps.zig: fix bug from having multiple exes that depend on c code
1 parent 778d8d5 commit 5a04ade

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/cmd/fetch.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
6767
\\ exe.linkSystemLibrary(libname);
6868
\\ exe.linkLibC();
6969
\\ }
70+
\\ // clear module memo cache so addAllTo can be called more than once in the same build.zig
71+
\\ inline for (comptime std.meta.declarations(package_data)) |decl| @field(package_data, decl.name).module_memo = null;
7072
\\}
7173
\\
7274
\\var link_lib_c = false;

src/cmd/generate.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
133133
\\ const module = pkg.module(exe, fetch_step);
134134
\\ exe.root_module.addImport(pkg.name, module);
135135
\\ }
136+
\\ // clear module memo cache so addAllTo can be called more than once in the same build.zig
137+
\\ inline for (comptime std.meta.declarations(package_data)) |decl| @field(package_data, decl.name).module_memo = null;
136138
\\}
137139
\\
138140
\\var link_lib_c = false;

0 commit comments

Comments
 (0)