mirror of
https://github.com/ziglang/zig.git
synced 2025-02-16 09:30:17 +00:00
build: retry when nested lazy dependency causes missing artifact
Consider root build.zig having a mandatory dependency on package A which in turns has a lazy dependency on package B. When the root build.zig calls const artifact = dep_a.artifact("a_artifact"); This might cause an error, as package B needs to be fetched before the artifact can be built. However, the hard panic in Dependency.artifact() is seen as a fatal error which _prevents_ the parent `zig build` process from fetching missing dependencies and trying once more. Handle this more gracefully by checking if we already know there were missing lazy dependencies, which might come from package A. In the case we still reach a fixed point with a missing artifact, panic as before.
This commit is contained in:
parent
d3ba5f397d
commit
d1bf035017
@ -1889,6 +1889,10 @@ pub const Dependency = struct {
|
||||
}
|
||||
}
|
||||
return found orelse {
|
||||
if (d.builder.graph.needed_lazy_dependencies.entries.len != 0) {
|
||||
// The artifact might become available after missing lazy dependencies have been resolved.
|
||||
process.exit(3);
|
||||
}
|
||||
for (d.builder.install_tls.step.dependencies.items) |dep_step| {
|
||||
const inst = dep_step.cast(Step.InstallArtifact) orelse continue;
|
||||
log.info("available artifact: '{s}'", .{inst.artifact.name});
|
||||
|
Loading…
Reference in New Issue
Block a user