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.
pub fn dependency(b: *Build, name: []const u8, args: anytype) *Dependency
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);
},
};
}