pub fn dependencyLazy(b: *Build, name: []const u8, args: anytype) error b: *Buildname: []const u8args1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973pub fn dependencyLazy(b: *Build, name: []const u8, args: anytype) error{LazyDependencyNeeded}!*Dependency {
const pkg_hash = findPkgHashOrFatal(b, name);
const entry = package_map.get(pkg_hash) orelse unreachable;
if (!entry.available) {
markNeededLazyDep(b, pkg_hash);
return error.LazyDependencyNeeded;
}
var map: PackageOptions.Map = .empty;
PackageOptions.fromArgs(b.graph.arena, &map, args);
return dependencyResolved(b, name, entry, &map);
}
Declares that the current configuration does in fact require a potentially lazy dependency.
If the dependency is already fetched, it is returned. However if the dependency is not yet fetched, then when the build script is finished running, the toolchain will not proceed to the make phase. Instead, the parent process will additionally fetch all the lazy dependencies that were actually required by running the build script, recompile the build script, and then run it again. In other words, if this function returns
error.LazyDependencyNeededit means that the only purpose of completing the configure phase is to find out all the other lazy dependencies that are also required. In this case, one must propagate the error all the way up and return it from the main build function.For non-lazy dependencies, this always succeeds.