authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-07-01 13:36:54-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-07-01 13:36:54-07:00
loga30f029d53b5080351ce531b10535bb37776854e
tree1d39ea26ef79d9b078bdbf8d71a0c585451e2d68
parent23a4fc3db71c68c0ceea9ff56701fa6bffd3766c

std.Build: ignore configuration failure when lazy deps exist


1 files changed, 15 insertions(+), 12 deletions(-)

lib/std/Build.zig+15-12
...@@ -2110,15 +2110,15 @@ fn markNeededLazyDep(b: *Build, pkg_hash: []const u8) void {...@@ -2110,15 +2110,15 @@ fn markNeededLazyDep(b: *Build, pkg_hash: []const u8) void {
2110}2110}
21112111
2112/// When this function is called, it means that the current build does, in2112/// When this function is called, it means that the current build does, in
2113/// fact, require this dependency. If the dependency is already fetched, it2113/// fact, require this dependency. If the dependency is already fetched, it is
2114/// proceeds in the same manner as `dependency`. However if the dependency was2114/// returned. However if the dependency is not yet fetched, then when the build
2115/// not fetched, then when the build script is finished running, the build will2115/// script is finished running, the build will not proceed to the make phase.
2116/// not proceed to the make phase. Instead, the parent process will2116/// Instead, the parent process will additionally fetch all the lazy
2117/// additionally fetch all the lazy dependencies that were actually required by2117/// dependencies that were actually required by running the build script,
2118/// running the build script, rebuild the build script, and then run it again.2118/// rebuild the build script, and then run it again. In other words, if this
2119/// In other words, if this function returns `null` it means that the only2119/// function returns `null` it means that the only purpose of completing the
2120/// purpose of completing the configure phase is to find out all the other lazy2120/// configure phase is to find out all the other lazy dependencies that are
2121/// dependencies that are also required.2121/// also required.
2122///2122///
2123/// It is allowed to use this function for non-lazy dependencies, in which case2123/// It is allowed to use this function for non-lazy dependencies, in which case
2124/// it will never return `null`. This allows toggling laziness via2124/// it will never return `null`. This allows toggling laziness via
...@@ -2358,12 +2358,15 @@ pub inline fn runPackageScript(b: *Build, comptime build_zig: anytype) void {...@@ -2358,12 +2358,15 @@ pub inline fn runPackageScript(b: *Build, comptime build_zig: anytype) void {
2358 result catch |err| switch (err) {2358 result catch |err| switch (err) {
2359 error.LazyDependencyNeeded => assert(b.graph.needed_lazy_dependencies.count() != 0),2359 error.LazyDependencyNeeded => assert(b.graph.needed_lazy_dependencies.count() != 0),
2360 else => {2360 else => {
2361 if (@errorReturnTrace()) |trace| std.debug.dumpErrorReturnTrace(trace);
2362 if (b.dep_prefix.len == 0) {2361 if (b.dep_prefix.len == 0) {
2363 process.fatal("package {q} configuration failed: {t}", .{ b.dep_prefix, err });2362 log.err("package {q} configuration failed: {t}", .{ b.dep_prefix, err });
2364 } else {2363 } else {
2365 process.fatal("configuration failed: {t}", .{err});2364 log.err("configuration failed: {t}", .{err});
2366 }2365 }
2366 if (@errorReturnTrace()) |trace| std.debug.dumpErrorReturnTrace(trace);
2367 const lazy_count = b.graph.needed_lazy_dependencies.count();
2368 if (lazy_count == 0) process.exit(1);
2369 log.info("{d} lazy dependencies detected; fetching and retrying configuration", .{lazy_count});
2367 },2370 },
2368 };2371 };
2369}2372}