Skip to content

Commit

Permalink
std.Build.Step.Compile: getEmittedDocs API enhancements
Browse files Browse the repository at this point in the history
 * Allow calling it multiple times.
 * Rename it. Sorry, this is to coincide with #16353.
  • Loading branch information
andrewrk committed Jul 24, 2023
1 parent 2919d3d commit 90c6c21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn build(b: *std.Build) !void {
autodoc_test.overrideZigLibDir("lib");
autodoc_test.emit_bin = .no_emit; // https://github.com/ziglang/zig/issues/16351
const install_std_docs = b.addInstallDirectory(.{
.source_dir = autodoc_test.getOutputDocs(),
.source_dir = autodoc_test.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "doc/std",
});
Expand Down
4 changes: 2 additions & 2 deletions lib/std/Build/Step/Compile.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,8 @@ pub fn getOutputPdbSource(self: *Compile) FileSource {
return .{ .generated = &self.output_pdb_path_source };
}

pub fn getOutputDocs(self: *Compile) FileSource {
assert(self.generated_docs == null); // This function may only be called once.
pub fn getEmittedDocs(self: *Compile) FileSource {
if (self.generated_docs) |g| return .{ .generated = g };
const arena = self.step.owner.allocator;
const generated_file = arena.create(GeneratedFile) catch @panic("OOM");
generated_file.* = .{ .step = &self.step };
Expand Down

0 comments on commit 90c6c21

Please sign in to comment.