Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a step to generate documentation to build.zig which zig init generates #22644

Open
sorairolake opened this issue Jan 28, 2025 · 0 comments · May be fixed by #22690
Open

Add a step to generate documentation to build.zig which zig init generates #22644

sorairolake opened this issue Jan 28, 2025 · 0 comments · May be fixed by #22690

Comments

@sorairolake
Copy link
Contributor

sorairolake commented Jan 28, 2025

Zig can generate documentation from doc comments.

For the library package, I think it would be useful to have a step in zig build to generate documentation. But there is no such step for build.zig which zig init generates.

So I think it would be useful to have a step like the following in build.zig which zig init generates:

zig/build.zig

Lines 51 to 68 in bf6ee7c

const autodoc_test = b.addObject(.{
.name = "std",
.zig_lib_dir = b.path("lib"),
.root_module = b.createModule(.{
.root_source_file = b.path("lib/std/std.zig"),
.target = target,
.optimize = .Debug,
}),
});
const install_std_docs = b.addInstallDirectory(.{
.source_dir = autodoc_test.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "doc/std",
});
//if (enable_tidy) install_std_docs.step.dependOn(check_autodocs);
if (std_docs) {
b.getInstallStep().dependOn(&install_std_docs.step);
}

For those unfamiliar with the Zig build system, I think it is easier to edit a template rather than writing such a step from scratch.

@sorairolake sorairolake linked a pull request Jan 31, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant