Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/std/Build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@ pub fn dependencyFromBuildZig(
const dep_name = for (b.available_deps) |dep| {
if (mem.eql(u8, dep[1], pkg_hash)) break dep[1];
} else break :find_dep;
return dependencyInner(b, dep_name, pkg.build_root, pkg.build_zig, pkg.deps, args);
return dependencyInner(b, dep_name, pkg.build_root, pkg.build_zig, pkg_hash, pkg.deps, args);
}

const full_path = b.pathFromRoot("build.zig.zon");
Expand Down
3 changes: 3 additions & 0 deletions test/standalone/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@
.install_headers = .{
.path = "install_headers",
},
.dependencyFromBuildZig = .{
.path = "dependencyFromBuildZig",
},
},
.paths = .{
"build.zig",
Expand Down
12 changes: 12 additions & 0 deletions test/standalone/dependencyFromBuildZig/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Test it");
b.default_step = test_step;

const dep1 = b.dependency("other", .{});

const dep2 = b.dependencyFromBuildZig(@import("other"), .{});

std.debug.assert(dep1.module("add") == dep2.module("add"));
}
10 changes: 10 additions & 0 deletions test/standalone/dependencyFromBuildZig/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.{
.name = "dependencyFromBuildZig",
.version = "0.0.0",
.dependencies = .{
.other = .{
.path = "other",
},
},
.paths = .{""},
}
3 changes: 3 additions & 0 deletions test/standalone/dependencyFromBuildZig/other/add.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn add(x: u32, y: u32) u32 {
return x + y;
}
7 changes: 7 additions & 0 deletions test/standalone/dependencyFromBuildZig/other/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
_ = b.addModule("add", .{
.root_source_file = b.path("add.add.zig"),
});
}
6 changes: 6 additions & 0 deletions test/standalone/dependencyFromBuildZig/other/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.{
.name = "other",
.version = "0.0.0",
.dependencies = .{},
.paths = .{""},
}