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.

dependency

Declares that the current configuration does in fact require a potentially lazy dependency.

If the dependency is already fetched, it is returned. Otherwise, exits the configuration phase with intent to fetch the lazy dependency and rerun the configuration script.

If it is known to the caller at this point that additional lazy dependencies are also required, it would save time to call dependencyLazy instead, handling error.LazyDependencyNeeded in a way that marks multiple potentially lazy dependencies as required before eventually returning that error from the top level build function.

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

File

lib/std/Build.zig:2206

Code

pub fn dependency(b: *Build, name: []const u8, args: anytype) *Dependency {
    return dependencyLazy(b, name, args) catch |err| switch (err) {
        error.LazyDependencyNeeded => {
            assert(b.graph.needed_lazy_dependencies.count() != 0);
            serializeConfigurationExiting(b);
        },
    };
}