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 {
21102110}
21112111
21122112/// When this function is called, it means that the current build does, in
2113/// fact, require this dependency. If the dependency is already fetched, it
2114/// proceeds in the same manner as `dependency`. However if the dependency was
2115/// not fetched, then when the build script is finished running, the build will
2116/// not proceed to the make phase. Instead, the parent process will
2117/// additionally fetch all the lazy dependencies that were actually required by
2118/// running the build script, rebuild the build script, and then run it again.
2119/// In other words, if this function returns `null` it means that the only
2120/// purpose of completing the configure phase is to find out all the other lazy
2121/// dependencies that are also required.
2113/// fact, require this dependency. If the dependency is already fetched, it is
2114/// returned. However if the dependency is not yet fetched, then when the build
2115/// script is finished running, the build will not proceed to the make phase.
2116/// Instead, the parent process will additionally fetch all the lazy
2117/// dependencies that were actually required by running the build script,
2118/// rebuild the build script, and then run it again. In other words, if this
2119/// function returns `null` it means that the only purpose of completing the
2120/// configure phase is to find out all the other lazy dependencies that are
2121/// also required.
21222122///
21232123/// It is allowed to use this function for non-lazy dependencies, in which case
21242124/// 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 {
23582358 result catch |err| switch (err) {
23592359 error.LazyDependencyNeeded => assert(b.graph.needed_lazy_dependencies.count() != 0),
23602360 else => {
2361 if (@errorReturnTrace()) |trace| std.debug.dumpErrorReturnTrace(trace);
23622361 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 });
23642363 } else {
2365 process.fatal("configuration failed: {t}", .{err});
2364 log.err("configuration failed: {t}", .{err});
23662365 }
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});
23672370 },
23682371 };
23692372}