Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

dependencyLazy

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.LazyDependencyNeeded it 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.

Build.dependencyLazy
pub fn dependencyLazy(b: *Build, name: []const u8, args: anytype) error

File

lib/std/Build.zig:2153

Code

pub 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;
    }
    return dependencyResolved(b, name, entry, userInputOptionsFromArgs(b.graph.arena, args));
}