| ... | @@ -2037,6 +2037,7 @@ fn findPkgHashOrFatal(b: *Build, name: []const u8) []const u8 { | ... | @@ -2037,6 +2037,7 @@ fn findPkgHashOrFatal(b: *Build, name: []const u8) []const u8 { |
| 2037 | inline fn findImportPkgHashOrFatal(b: *Build, comptime asking_build_zig: type, comptime dep_name: []const u8) []const u8 { | 2037 | inline fn findImportPkgHashOrFatal(b: *Build, comptime asking_build_zig: type, comptime dep_name: []const u8) []const u8 { |
| 2038 | const build_runner = @import("root"); | 2038 | const build_runner = @import("root"); |
| 2039 | const deps = build_runner.dependencies; | 2039 | const deps = build_runner.dependencies; |
| | 2040 | const arena = b.graph.arena; |
| 2040 | | 2041 | |
| 2041 | const b_pkg_hash, const b_pkg_deps = comptime for (@typeInfo(deps.packages).@"struct".decls) |decl| { | 2042 | const b_pkg_hash, const b_pkg_deps = comptime for (@typeInfo(deps.packages).@"struct".decls) |decl| { |
| 2042 | const pkg_hash = decl.name; | 2043 | const pkg_hash = decl.name; |
| ... | @@ -2044,7 +2045,7 @@ inline fn findImportPkgHashOrFatal(b: *Build, comptime asking_build_zig: type, c | ... | @@ -2044,7 +2045,7 @@ inline fn findImportPkgHashOrFatal(b: *Build, comptime asking_build_zig: type, c |
| 2044 | if (@hasDecl(pkg, "build_zig") and pkg.build_zig == asking_build_zig) break .{ pkg_hash, pkg.deps }; | 2045 | if (@hasDecl(pkg, "build_zig") and pkg.build_zig == asking_build_zig) break .{ pkg_hash, pkg.deps }; |
| 2045 | } else .{ "", deps.root_deps }; | 2046 | } else .{ "", deps.root_deps }; |
| 2046 | if (!std.mem.eql(u8, b_pkg_hash, b.pkg_hash)) { | 2047 | if (!std.mem.eql(u8, b_pkg_hash, b.pkg_hash)) { |
| 2047 | const build_zig_path = b.root.join("build.zig") catch @panic("OOM"); | 2048 | const build_zig_path = b.root.join(arena, "build.zig") catch @panic("OOM"); |
| 2048 | panic("{} is not the struct that corresponds to {f}", .{ | 2049 | panic("{} is not the struct that corresponds to {f}", .{ |
| 2049 | asking_build_zig, build_zig_path, | 2050 | asking_build_zig, build_zig_path, |
| 2050 | }); | 2051 | }); |
| ... | @@ -2053,7 +2054,7 @@ inline fn findImportPkgHashOrFatal(b: *Build, comptime asking_build_zig: type, c | ... | @@ -2053,7 +2054,7 @@ inline fn findImportPkgHashOrFatal(b: *Build, comptime asking_build_zig: type, c |
| 2053 | if (std.mem.eql(u8, dep[0], dep_name)) return dep[1]; | 2054 | if (std.mem.eql(u8, dep[0], dep_name)) return dep[1]; |
| 2054 | }; | 2055 | }; |
| 2055 | | 2056 | |
| 2056 | const full_path = b.root.join("build.zig.zon") catch @panic("OOM"); | 2057 | const full_path = b.root.join(arena, "build.zig.zon") catch @panic("OOM"); |
| 2057 | panic("no dependency named {s} in {f}. All packages used in build.zig must be declared in this file", .{ | 2058 | panic("no dependency named {s} in {f}. All packages used in build.zig must be declared in this file", .{ |
| 2058 | dep_name, full_path, | 2059 | dep_name, full_path, |
| 2059 | }); | 2060 | }); |