Skip to content

Commit cb0eb74

Browse files
committed
build: Add documentation generation step
Zig crashes when trying to generate documentation of capy, but it will help to debug the issue
1 parent 50606cc commit cb0eb74

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

build.zig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,22 @@ pub fn build(b: *std.Build) !void {
7272
.target = target,
7373
.optimize = optimize,
7474
});
75-
// tests.emit_docs = .emit;
7675
const run_tests = try install(tests, .{});
7776

7877
const test_step = b.step("test", "Run unit tests and also generate the documentation");
7978
test_step.dependOn(run_tests);
8079

80+
const docs = b.addTest(.{
81+
.root_source_file = FileSource.relative("src/main.zig"),
82+
.target = target,
83+
.optimize = optimize,
84+
});
85+
b.installDirectory(.{ .source_dir = docs.getEmittedDocs(), .install_dir = .{ .custom = "docs/" }, .install_subdir = "" });
86+
const run_docs = try install(docs, .{});
87+
88+
const docs_step = b.step("docs", "Generate documentation and run unit tests");
89+
docs_step.dependOn(run_docs);
90+
8191
const coverage_tests = b.addTest(.{
8292
.root_source_file = FileSource.relative("src/main.zig"),
8393
.target = target,

0 commit comments

Comments
 (0)