Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take eagerness into account when deduplicating dependencies #21773

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

castholm
Copy link
Contributor

@castholm castholm commented Oct 22, 2024

Closes #21771

If the same dependency is first discovered as lazy and then later as eager, the existing entry needs to be updated to eager in order for b.dependency() to work.

Tested against the repro in the linked issue. With a master build of Zig it adds an available decl to the generated dependencies.zig, which makes the build system consider it lazy. With this fix the decl is absent and the dependency is correctly considered eager.

diff --git a/.zig-cache/o/0ac409a893112d8a0dadad72e466f606/dependencies.zig b/.zig-cache/o/abff17167087eb0d6564dda2732ee274/dependencies.zig
index 96c1b91..a39ff09 100644
--- a/.zig-cache/o/0ac409a893112d8a0dadad72e466f606/dependencies.zig
+++ b/.zig-cache/o/abff17167087eb0d6564dda2732ee274/dependencies.zig
@@ -1,6 +1,5 @@
 pub const packages = struct {
     pub const @"1220321cdb273d1f6e90b04fc747cae49dac1ae3d7db4125f590d2c0df5c4aadcc88" = struct {
-        pub const available = true;
         pub const build_root = "global_cache\\p\\1220321cdb273d1f6e90b04fc747cae49dac1ae3d7db4125f590d2c0df5c4aadcc88";
         pub const build_zig = @import("1220321cdb273d1f6e90b04fc747cae49dac1ae3d7db4125f590d2c0df5c4aadcc88");
         pub const deps: []const struct { []const u8, []const u8 } = &.{};

If the same dependency is first found as lazy and then later as eager,
the existing entry needs to be updated to eager in order for
`b.dependency()` to work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

build.zig fails to compile due to deduplicated lazy dependency
1 participant