authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-03 23:40:05-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-04 03:44:26-08:00
log537e2808e04fc34bb2015433895a57c15118eb28
tree028b2081c157ede4a4fb00c7f75b05d6a6c4eea9
parentfc79b22a981a5d8c1f0f27b2c68afc6c3c5b7474

build system: fix missing step dependencies on lib

When depending on a module that depends on a static library, there was a missing step dependency on the static library, which caused a compile error due to missing header file. This fixes the problem by adding the proper step dependencies. Reviewing this code, I'm starting to wonder if it might be simpler to have Module instances create dummy Step objects to better model dependencies and dependees, rather than trying to maintain this graph without an actual node. That would be an improvement for a future commit.

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

lib/std/Build/Module.zig+5-1
...@@ -263,7 +263,11 @@ fn addShallowDependencies(m: *Module, dependee: *Module) void {...@@ -263,7 +263,11 @@ fn addShallowDependencies(m: *Module, dependee: *Module) void {
263 };263 };
264264
265 for (dependee.link_objects.items) |link_object| switch (link_object) {265 for (dependee.link_objects.items) |link_object| switch (link_object) {
266 .other_step => |compile| addStepDependencies(m, dependee, &compile.step),266 .other_step => |compile| {
267 addStepDependencies(m, dependee, &compile.step);
268 for (compile.installed_headers.items) |install_step|
269 addStepDependenciesOnly(m, install_step);
270 },
267271
268 .static_path,272 .static_path,
269 .assembly_file,273 .assembly_file,