feature. See also
. The project being documented here (as the example) is the Zig library itself.
Build.createChild
fn createChild(
parent: *Build,
dep_name: []const u8,
root: Cache.Path,
pkg_hash: []const u8,
pkg_deps: AvailableDeps,
user_input_options: UserInputOptionsMap,
) error
File
Code
fn createChild(
parent: *Build,
dep_name: []const u8,
root: Cache.Path,
pkg_hash: []const u8,
pkg_deps: AvailableDeps,
user_input_options: UserInputOptionsMap,
) error{OutOfMemory}!*Build {
const arena = parent.graph.arena;
const child = try arena.create(Build);
child.* = .{
.graph = parent.graph,
.root = root,
.allocator = arena,
.install_tls = .{
.step = .init(.{
.tag = .top_level,
.name = "install",
.owner = child,
}),
.description = "Copy build artifacts to prefix path",
},
.uninstall_tls = .{
.step = .init(.{
.tag = .top_level,
.name = "uninstall",
.owner = child,
}),
.description = "Remove build artifacts from prefix path",
},
.user_input_options = user_input_options,
.invalid_user_input = false,
.default_step = undefined,
.top_level_steps = .{},
.debug_log_scopes = parent.debug_log_scopes,
.enable_darling = parent.enable_darling,
.enable_qemu = parent.enable_qemu,
.enable_rosetta = parent.enable_rosetta,
.enable_wasmtime = parent.enable_wasmtime,
.enable_wine = parent.enable_wine,
.dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }),
.modules = .empty,
.named_writefiles = .empty,
.named_lazy_paths = .empty,
.pkg_hash = pkg_hash,
.available_deps = pkg_deps,
};
try child.top_level_steps.put(arena, child.install_tls.step.name, &child.install_tls);
try child.top_level_steps.put(arena, child.uninstall_tls.step.name, &child.uninstall_tls);
child.default_step = &child.install_tls.step;
return child;
}