#Autodoc: How to emit docs using `zig build` as opposed to `zig build-exe`?

1 messages · Page 1 of 1 (latest)

halcyon bridge
#

I know I can emit docs using zig build-exe -femit-docs. Is there a way to do this in build.zig though? I have a build step I run through CI as zig build docs that used to work but now I suspect needs to be specifically told to emit docs.

    const docs = b.addStaticLibrary(.{
        .name = "vaxis",
        .root_source_file = root_source_file,
        .target = target,
        .optimize = optimize,
    });
    const build_docs = b.addInstallDirectory(.{
        .source_dir = docs.getEmittedDocs(),
        .install_dir = .prefix,
        .install_subdir = "docs",
    });
    const build_docs_step = b.step("docs", "Build the vaxis library docs");
    build_docs_step.dependOn(&build_docs.step);
cyan iron
#

getEmittedDocs() should work fine. Also, maybe you could use addObject() instead of addSharedLibrary()? Also, you said it "used to work". What does it do now? In what sense does it not work?