Copy files matching the specified exclude/include patterns to the specified subdirectory relative to this step's generated directory.
The returned value is a lazy path to the generated subdirectory.
pub fn addCopyDirectory(
wf: *WriteFile,
src_path: std.Build.LazyPath,
sub_path: []const u8,
options: CopyDirectoryOptions,
) std.Build.LazyPath
pub fn addCopyDirectory(
wf: *WriteFile,
src_path: std.Build.LazyPath,
sub_path: []const u8,
options: CopyDirectoryOptions,
) std.Build.LazyPath {
const graph = wf.step.owner.graph;
const wc = &graph.wip_configuration;
const arena = graph.arena;
wf.directories.append(arena, .{
.sub_path = wc.addString(sub_path) catch @panic("OOM"),
.src_path = src_path.dupe(graph),
.exclude_extensions = if (options.exclude_extensions.len != 0)
.init(wc.addStringList(options.exclude_extensions) catch @panic("OOM"))
else
.none,
.include_extensions = if (options.include_extensions) |list|
.init(wc.addStringList(list) catch @panic("OOM"))
else
.none,
}) catch @panic("OOM");
wf.maybeUpdateName();
src_path.addStepDependencies(&wf.step);
return .{
.generated = .{
.index = wf.generated_directory,
.sub_path = graph.dupePath(sub_path),
},
};
}