authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-23 21:13:58-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-24 02:37:25-07:00
loge8fa19960243a99cef5d9af94c3db52173787a4e
treece9216bc3b770fd91c33579fe1a6f45ab8243141
parent575a7cccc0d9da542bd611f73e570d840f261bf5

std.Build.Step.Compile: getEmittedDocs API enhancements

* Allow calling it multiple times. * Rename it. Sorry, this is to coincide with #16353.

2 files changed, 3 insertions(+), 3 deletions(-)

build.zig+1-1
...@@ -61,7 +61,7 @@ pub fn build(b: *std.Build) !void {...@@ -61,7 +61,7 @@ pub fn build(b: *std.Build) !void {
61 autodoc_test.overrideZigLibDir("lib");61 autodoc_test.overrideZigLibDir("lib");
62 autodoc_test.emit_bin = .no_emit; // https://github.com/ziglang/zig/issues/1635162 autodoc_test.emit_bin = .no_emit; // https://github.com/ziglang/zig/issues/16351
63 const install_std_docs = b.addInstallDirectory(.{63 const install_std_docs = b.addInstallDirectory(.{
64 .source_dir = autodoc_test.getOutputDocs(),64 .source_dir = autodoc_test.getEmittedDocs(),
65 .install_dir = .prefix,65 .install_dir = .prefix,
66 .install_subdir = "doc/std",66 .install_subdir = "doc/std",
67 });67 });
lib/std/Build/Step/Compile.zig+2-2
...@@ -1004,8 +1004,8 @@ pub fn getOutputPdbSource(self: *Compile) FileSource {...@@ -1004,8 +1004,8 @@ pub fn getOutputPdbSource(self: *Compile) FileSource {
1004 return .{ .generated = &self.output_pdb_path_source };1004 return .{ .generated = &self.output_pdb_path_source };
1005}1005}
10061006
1007pub fn getOutputDocs(self: *Compile) FileSource {1007pub fn getEmittedDocs(self: *Compile) FileSource {
1008 assert(self.generated_docs == null); // This function may only be called once.1008 if (self.generated_docs) |g| return .{ .generated = g };
1009 const arena = self.step.owner.allocator;1009 const arena = self.step.owner.allocator;
1010 const generated_file = arena.create(GeneratedFile) catch @panic("OOM");1010 const generated_file = arena.create(GeneratedFile) catch @panic("OOM");
1011 generated_file.* = .{ .step = &self.step };1011 generated_file.* = .{ .step = &self.step };