| ... | ... | @@ -2153,16 +2153,9 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2153 | 2153 | try comp.flush(main_progress_node); |
| 2154 | 2154 | if (comp.totalErrorCount() != 0) return; |
| 2155 | 2155 | |
| 2156 | | // TODO: do this in a separate job during performAllTheWork(). The |
| 2157 | | // file copies at the end of generate() can also be extracted to |
| 2158 | | // separate jobs |
| 2159 | | if (!build_options.only_c and !build_options.only_core_functionality) { |
| 2160 | | if (comp.bin_file.options.docs_emit) |emit| { |
| 2161 | | var dir = try emit.directory.handle.makeOpenPath(emit.sub_path, .{}); |
| 2162 | | defer dir.close(); |
| 2163 | | try Autodoc.generate(module, dir); |
| 2164 | | } |
| 2165 | | } |
| 2156 | // Note the placement of this logic is relying on the call to |
| 2157 | // `wholeCacheModeSetBinFilePath` above. |
| 2158 | try maybeGenerateAutodocs(comp, main_progress_node); |
| 2166 | 2159 | } else { |
| 2167 | 2160 | try comp.flush(main_progress_node); |
| 2168 | 2161 | if (comp.totalErrorCount() != 0) return; |
| ... | ... | @@ -2177,6 +2170,10 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2177 | 2170 | comp.bin_file.lock = man.toOwnedLock(); |
| 2178 | 2171 | } else { |
| 2179 | 2172 | try comp.flush(main_progress_node); |
| 2173 | |
| 2174 | if (comp.totalErrorCount() == 0) { |
| 2175 | try maybeGenerateAutodocs(comp, main_progress_node); |
| 2176 | } |
| 2180 | 2177 | } |
| 2181 | 2178 | |
| 2182 | 2179 | // Unload all source files to save memory. |
| ... | ... | @@ -2193,6 +2190,26 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2193 | 2190 | } |
| 2194 | 2191 | } |
| 2195 | 2192 | |
| 2193 | fn maybeGenerateAutodocs(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 2194 | const mod = comp.bin_file.options.module orelse return; |
| 2195 | // TODO: do this in a separate job during performAllTheWork(). The |
| 2196 | // file copies at the end of generate() can also be extracted to |
| 2197 | // separate jobs |
| 2198 | if (!build_options.only_c and !build_options.only_core_functionality) { |
| 2199 | if (comp.bin_file.options.docs_emit) |emit| { |
| 2200 | var dir = try emit.directory.handle.makeOpenPath(emit.sub_path, .{}); |
| 2201 | defer dir.close(); |
| 2202 | |
| 2203 | var sub_prog_node = prog_node.start("Generating documentation", 0); |
| 2204 | sub_prog_node.activate(); |
| 2205 | sub_prog_node.context.refresh(); |
| 2206 | defer sub_prog_node.end(); |
| 2207 | |
| 2208 | try Autodoc.generate(mod, dir); |
| 2209 | } |
| 2210 | } |
| 2211 | } |
| 2212 | |
| 2196 | 2213 | fn flush(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 2197 | 2214 | // This is needed before reading the error flags. |
| 2198 | 2215 | comp.bin_file.flush(comp, prog_node) catch |err| switch (err) { |