zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 537e2808e04fc34bb2015433895a57c15118eb28 (tree)
parent fc79b22a981a5d8c1f0f27b2c68afc6c3c5b7474
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed,  3 Jan 2024 23:40:05 -0700

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.

Diffstat:
Mlib/std/Build/Module.zig | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig @@ -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,