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.
This commit is contained in:
Andrew Kelley 2024-01-03 23:40:05 -07:00
parent fc79b22a98
commit 537e2808e0

View File

@ -263,7 +263,11 @@ fn addShallowDependencies(m: *Module, dependee: *Module) void {
};
for (dependee.link_objects.items) |link_object| switch (link_object) {
.other_step => |compile| addStepDependencies(m, dependee, &compile.step),
.other_step => |compile| {
addStepDependencies(m, dependee, &compile.step);
for (compile.installed_headers.items) |install_step|
addStepDependenciesOnly(m, install_step);
},
.static_path,
.assembly_file,