| author | |
| committer | |
| log | 3c221463fd89caf08ee1bd24ea03d49e0c6e7f07 |
| tree | 78bfd794a0ae85017b422cc1a42045d68a248607 |
| parent | 544397ce6d2926858217eb013dfcfcd0a5b3e3c6 |
| parent | 1b4ea80654a71324faba01da0cc04c09fb7e7f77 |
| signature |
std: fix and add test for Build.dependencyFromBuildZig7 files changed, 42 insertions(+), 1 deletions(-)
lib/std/Build.zig+1-1| ... | ... | @@ -1975,7 +1975,7 @@ pub fn dependencyFromBuildZig( |
| 1975 | 1975 | const dep_name = for (b.available_deps) |dep| { |
| 1976 | 1976 | if (mem.eql(u8, dep[1], pkg_hash)) break dep[1]; |
| 1977 | 1977 | } else break :find_dep; |
| 1978 | return dependencyInner(b, dep_name, pkg.build_root, pkg.build_zig, pkg.deps, args); | |
| 1978 | return dependencyInner(b, dep_name, pkg.build_root, pkg.build_zig, pkg_hash, pkg.deps, args); | |
| 1979 | 1979 | } |
| 1980 | 1980 | |
| 1981 | 1981 | const full_path = b.pathFromRoot("build.zig.zon"); |
test/standalone/build.zig.zon+3| ... | ... | @@ -158,6 +158,9 @@ |
| 158 | 158 | .install_headers = .{ |
| 159 | 159 | .path = "install_headers", |
| 160 | 160 | }, |
| 161 | .dependencyFromBuildZig = .{ | |
| 162 | .path = "dependencyFromBuildZig", | |
| 163 | }, | |
| 161 | 164 | }, |
| 162 | 165 | .paths = .{ |
| 163 | 166 | "build.zig", |
test/standalone/dependencyFromBuildZig/build.zig created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | pub fn build(b: *std.Build) void { | |
| 4 | const test_step = b.step("test", "Test it"); | |
| 5 | b.default_step = test_step; | |
| 6 | ||
| 7 | const dep1 = b.dependency("other", .{}); | |
| 8 | ||
| 9 | const dep2 = b.dependencyFromBuildZig(@import("other"), .{}); | |
| 10 | ||
| 11 | std.debug.assert(dep1.module("add") == dep2.module("add")); | |
| 12 | } |
test/standalone/dependencyFromBuildZig/build.zig.zon created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | .{ | |
| 2 | .name = "dependencyFromBuildZig", | |
| 3 | .version = "0.0.0", | |
| 4 | .dependencies = .{ | |
| 5 | .other = .{ | |
| 6 | .path = "other", | |
| 7 | }, | |
| 8 | }, | |
| 9 | .paths = .{""}, | |
| 10 | } |
test/standalone/dependencyFromBuildZig/other/add.zig created+3| ... | ... | @@ -0,0 +1,3 @@ |
| 1 | pub fn add(x: u32, y: u32) u32 { | |
| 2 | return x + y; | |
| 3 | } |
test/standalone/dependencyFromBuildZig/other/build.zig created+7| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | pub fn build(b: *std.Build) void { | |
| 4 | _ = b.addModule("add", .{ | |
| 5 | .root_source_file = b.path("add.add.zig"), | |
| 6 | }); | |
| 7 | } |
test/standalone/dependencyFromBuildZig/other/build.zig.zon created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | .{ | |
| 2 | .name = "other", | |
| 3 | .version = "0.0.0", | |
| 4 | .dependencies = .{}, | |
| 5 | .paths = .{""}, | |
| 6 | } |