feature. See also
. The project being documented here (as the example) is the Zig library itself.
Compile.updateGeneratedFile
fn updateGeneratedFile(
maker: *Maker,
arena: Allocator,
conf_comp: *const Configuration.Step.Compile,
out_path: std.Build.Cache.Path,
target: *const Configuration.TargetQuery,
opt_gf: ?Configuration.GeneratedFileIndex,
ea: std.zig.EmitArtifact,
) Allocator.Error!void
File
Code
fn updateGeneratedFile(
maker: *Maker,
arena: Allocator,
conf_comp: *const Configuration.Step.Compile,
out_path: std.Build.Cache.Path,
target: *const Configuration.TargetQuery,
opt_gf: ?Configuration.GeneratedFileIndex,
ea: std.zig.EmitArtifact,
) Allocator.Error!void {
const gf = opt_gf orelse return;
const graph = maker.graph;
const conf = &maker.scanned_config.configuration;
const name = try ea.cacheName(arena, .{
.root_name = conf_comp.root_name.slice(conf),
.cpu_arch = target.flags.cpu_arch.unwrap().?,
.os_tag = target.flags.os_tag.unwrap().?,
.ofmt = target.flags.object_format.unwrap().?,
.abi = target.flags.abi.unwrap().?,
.output_mode = switch (conf_comp.flags3.kind) {
.lib => .Lib,
.obj, .test_obj => .Obj,
.exe, .@"test" => .Exe,
},
.link_mode = conf_comp.flags2.linkage.unwrap(),
.version = if (conf_comp.version.value) |v|
std.SemanticVersion.parse(v.slice(conf)) catch unreachable
else
null,
});
maker.generatedPath(gf).* = try out_path.join(graph.arena, name);
}