authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-09 22:04:09-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:14-07:00
log857296a9f4bc56c3bf710b11a0868c4cf15b6ff3
treeb060b6846b7f5cc1e5e3e08ac87f127ff468966d
parentf829f848ddc390e6f14e8da3eee452bd7ead5a3a

build.zig: update docgen to modern build system API

it still writes the output to zig-cache/langref.html but now it does that explicitly as a legacy step with the intention of having that removed in the future. It also outputs the langref to the install prefix.

1 files changed, 12 insertions(+), 9 deletions(-)

build.zig+12-9
......@@ -40,19 +40,22 @@ pub fn build(b: *std.Build) !void {
4040 });
4141 docgen_exe.single_threaded = single_threaded;
4242
43 const langref_out_path = try b.cache_root.join(b.allocator, &.{"langref.html"});
44 const docgen_cmd = docgen_exe.run();
45 docgen_cmd.addArgs(&[_][]const u8{
46 "--zig",
47 b.zig_exe,
48 "doc" ++ fs.path.sep_str ++ "langref.html.in",
49 langref_out_path,
50 });
51 docgen_cmd.step.dependOn(&docgen_exe.step);
43 const docgen_cmd = b.addRunArtifact(docgen_exe);
44 docgen_cmd.addArgs(&.{ "--zig", b.zig_exe });
45 docgen_cmd.addFileSourceArg(.{ .path = "doc/langref.html.in" });
46 const langref_file = docgen_cmd.addOutputFileArg("langref.html");
47 const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "langref.html");
48 b.getInstallStep().dependOn(&install_langref.step);
5249
5350 const docs_step = b.step("docs", "Build documentation");
5451 docs_step.dependOn(&docgen_cmd.step);
5552
53 // This is for legacy reasons, to be removed after our CI scripts are upgraded to use
54 // the file from the install prefix instead.
55 const legacy_write_to_cache = b.addWriteFiles();
56 legacy_write_to_cache.addCopyFileToSource(langref_file, "zig-cache/langref.html");
57 docs_step.dependOn(&legacy_write_to_cache.step);
58
5659 const check_case_exe = b.addExecutable(.{
5760 .name = "check-case",
5861 .root_source_file = .{ .path = "test/src/Cases.zig" },