zig

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

commit 1b4ea80654a71324faba01da0cc04c09fb7e7f77 (tree)
parent 0820aa4a46ee346282269f2a273f1059418e8702
Author: Meghan Denny <hello@nektro.net>
Date:   Thu, 18 Apr 2024 11:24:42 -0700

do more robust import

Co-authored-by: Carl Ã…stholm <carl@astholm.se>
Diffstat:
Mtest/standalone/dependencyFromBuildZig/build.zig | 6+-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/test/standalone/dependencyFromBuildZig/build.zig b/test/standalone/dependencyFromBuildZig/build.zig @@ -6,11 +6,7 @@ pub fn build(b: *std.Build) void { const dep1 = b.dependency("other", .{}); - const build_runner = @import("root"); - const deps = build_runner.dependencies; - const zon_decls = @typeInfo(deps.packages).Struct.decls; - const pkg = @field(deps.packages, zon_decls[0].name); - const dep2 = b.dependencyFromBuildZig(pkg.build_zig, .{}); + const dep2 = b.dependencyFromBuildZig(@import("other"), .{}); std.debug.assert(dep1.module("add") == dep2.module("add")); }