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.

addDirectoryWatchInput

Any changes inside the directory will trigger invalidation.

See also addDirectoryWatchInputFromPath which takes a Path instead.

Paths derived from this directory should also be manually added via addDirectoryWatchInputFromPath if and only if this function returns true.

Step.addDirectoryWatchInput
pub fn addDirectoryWatchInput(step: *Step, maker: *Maker, lazy_directory: LazyPath) Allocator.Error!bool

File

Code

pub fn addDirectoryWatchInput(step: *Step, maker: *Maker, lazy_directory: LazyPath) Allocator.Error!bool {
    const graph = maker.graph;
    const arena = graph.arena; // TODO don't leak into the process arena
    switch (lazy_directory) {
        .source_path => |source_path| {
            const conf = &maker.scanned_config.configuration;
            const sub_path = source_path.sub_path.slice(conf);
            const pkg_path = try maker.packagePath(arena, source_path.owner, sub_path);
            try addDirectoryWatchInputFromPath(step, maker, pkg_path);
        },
        .relative => |relative| {
            const resolved_path = try maker.relativePath(arena, relative);
            try addDirectoryWatchInputFromPath(step, maker, resolved_path);
        },
        // Nothing to watch because this dependency edge is modeled instead via `dependants`.
        .generated => return false,
    }
    return true;
}