Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

dependency

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

Params

  • b: *Build
  • name: []const u8
  • args

File

Build.zig:2019
2019
2020
2021
2022
2023
2024
2025
2026
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);
        },
    };
}