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.

dependOnFileContents

Indicates that the build.zig logic depends on a particular file's contents.

If the file is created, deleted, or has its contents changed, the configure phase will be repeated. If the inode or mtime change, but the file contents remain the same, it will not cause the configure logic to be repeated.

This is an alternative to Graph.poisonCache that avoids making every invocation of zig build into a cache miss.

Only a subset of LazyPath are supported:

If the file would be inside one of the search prefixes, then the dependency cannot be tracked; Graph.poisonCache must be used instead.

Build.dependOnFileContents
pub fn dependOnFileContents(b: *Build, lazy_path: LazyPath) void

File

lib/std/Build.zig:2806

Code

pub fn dependOnFileContents(b: *Build, lazy_path: LazyPath) void {
    validateConfigureDependency(lazy_path);
    const graph = b.graph;
    graph.configure_dependencies.append(graph.arena, .{
        .lazy_path = lazy_path.dupe(graph),
        .mode = .contents,
    }) catch @panic("OOM");
}