Skip to content

Commit d0c06ca

Browse files
authored
Merge pull request #19208 from ziglang/rework-autodoc
Redesign How Autodoc Works
2 parents eaca862 + 1397341 commit d0c06ca

36 files changed

+7392
-25207
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# Autodoc
2-
/src/Autodoc.zig @kristoff-it
3-
/src/autodoc/* @kristoff-it
4-
/lib/docs/* @kristoff-it
5-
61
# std.json
72
/lib/std/json* @thejoshwolfe
83

.github/ISSUE_TEMPLATE/autodoc-issue.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,6 @@ else()
907907
endif()
908908

909909
# -Dno-langref is currently hardcoded because building the langref takes too damn long
910-
# -Dno-autodocs is currently hardcoded because the C backend generates a miscompilation
911-
# that prevents it from working.
912910
# To obtain these two forms of documentation, run zig build against stage3 rather than stage2.
913911
set(ZIG_BUILD_ARGS
914912
--zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
@@ -918,7 +916,6 @@ set(ZIG_BUILD_ARGS
918916
${ZIG_STATIC_ARG}
919917
${ZIG_NO_LIB_ARG}
920918
"-Dno-langref"
921-
"-Dno-autodocs"
922919
${ZIG_SINGLE_THREADED_ARG}
923920
${ZIG_PIE_ARG}
924921
"-Dtarget=${ZIG_TARGET_TRIPLE}"

build.zig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn build(b: *std.Build) !void {
3131
const test_step = b.step("test", "Run all the tests");
3232
const skip_install_lib_files = b.option(bool, "no-lib", "skip copying of lib/ files and langref to installation prefix. Useful for development") orelse false;
3333
const skip_install_langref = b.option(bool, "no-langref", "skip copying of langref to the installation prefix") orelse skip_install_lib_files;
34-
const skip_install_autodocs = b.option(bool, "no-autodocs", "skip copying of standard library autodocs to the installation prefix") orelse skip_install_lib_files;
34+
const std_docs = b.option(bool, "std-docs", "include standard library autodocs") orelse false;
3535
const no_bin = b.option(bool, "no-bin", "skip emitting compiler binary") orelse false;
3636

3737
const docgen_exe = b.addExecutable(.{
@@ -55,17 +55,19 @@ pub fn build(b: *std.Build) !void {
5555
b.getInstallStep().dependOn(&install_langref.step);
5656
}
5757

58-
const autodoc_test = b.addTest(.{
58+
const autodoc_test = b.addObject(.{
59+
.name = "std",
5960
.root_source_file = .{ .path = "lib/std/std.zig" },
6061
.target = target,
6162
.zig_lib_dir = .{ .path = "lib" },
63+
.optimize = .Debug,
6264
});
6365
const install_std_docs = b.addInstallDirectory(.{
6466
.source_dir = autodoc_test.getEmittedDocs(),
6567
.install_dir = .prefix,
6668
.install_subdir = "doc/std",
6769
});
68-
if (!skip_install_autodocs) {
70+
if (std_docs) {
6971
b.getInstallStep().dependOn(&install_std_docs.step);
7072
}
7173

0 commit comments

Comments
 (0)