| ... | @@ -3330,6 +3330,13 @@ pub fn performAllTheWork( | ... | @@ -3330,6 +3330,13 @@ pub fn performAllTheWork( |
| 3330 | comp.work_queue_wait_group.reset(); | 3330 | comp.work_queue_wait_group.reset(); |
| 3331 | defer comp.work_queue_wait_group.wait(); | 3331 | defer comp.work_queue_wait_group.wait(); |
| 3332 | | 3332 | |
| | 3333 | if (!build_options.only_c and !build_options.only_core_functionality) { |
| | 3334 | if (comp.docs_emit != null) { |
| | 3335 | try taskDocsCopy(comp, &comp.work_queue_wait_group); |
| | 3336 | try taskDocsWasm(comp, &comp.work_queue_wait_group); |
| | 3337 | } |
| | 3338 | } |
| | 3339 | |
| 3333 | { | 3340 | { |
| 3334 | const astgen_frame = tracy.namedFrame("astgen"); | 3341 | const astgen_frame = tracy.namedFrame("astgen"); |
| 3335 | defer astgen_frame.end(); | 3342 | defer astgen_frame.end(); |
| ... | @@ -3744,6 +3751,46 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v | ... | @@ -3744,6 +3751,46 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v |
| 3744 | } | 3751 | } |
| 3745 | } | 3752 | } |
| 3746 | | 3753 | |
| | 3754 | fn taskDocsCopy(comp: *Compilation, wg: *WaitGroup) !void { |
| | 3755 | wg.start(); |
| | 3756 | errdefer wg.finish(); |
| | 3757 | try comp.thread_pool.spawn(workerDocsCopy, .{ comp, wg }); |
| | 3758 | } |
| | 3759 | |
| | 3760 | fn taskDocsWasm(comp: *Compilation, wg: *WaitGroup) !void { |
| | 3761 | wg.start(); |
| | 3762 | errdefer wg.finish(); |
| | 3763 | try comp.thread_pool.spawn(workerDocsWasm, .{ comp, wg }); |
| | 3764 | } |
| | 3765 | |
| | 3766 | fn workerDocsCopy(comp: *Compilation, wg: *WaitGroup) void { |
| | 3767 | defer wg.finish(); |
| | 3768 | |
| | 3769 | const emit = comp.docs_emit.?; |
| | 3770 | var out_dir = emit.directory.handle.makeOpenPath(emit.sub_path, .{}) catch |err| { |
| | 3771 | // TODO create an error to be reported instead of logging |
| | 3772 | log.err("unable to create output directory '{}{s}': {s}", .{ |
| | 3773 | emit.directory, emit.sub_path, @errorName(err), |
| | 3774 | }); |
| | 3775 | return; |
| | 3776 | }; |
| | 3777 | defer out_dir.close(); |
| | 3778 | |
| | 3779 | for (&[_][]const u8{ "docs/main.js", "docs/index.html" }) |sub_path| { |
| | 3780 | const basename = std.fs.path.basename(sub_path); |
| | 3781 | comp.zig_lib_directory.handle.copyFile(sub_path, out_dir, basename, .{}) catch |err| { |
| | 3782 | log.err("unable to copy {s}: {s}", .{ sub_path, @errorName(err) }); |
| | 3783 | }; |
| | 3784 | } |
| | 3785 | } |
| | 3786 | |
| | 3787 | fn workerDocsWasm(comp: *Compilation, wg: *WaitGroup) void { |
| | 3788 | defer wg.finish(); |
| | 3789 | |
| | 3790 | _ = comp; |
| | 3791 | log.err("TODO workerDocsWasm", .{}); |
| | 3792 | } |
| | 3793 | |
| 3747 | const AstGenSrc = union(enum) { | 3794 | const AstGenSrc = union(enum) { |
| 3748 | root, | 3795 | root, |
| 3749 | import: struct { | 3796 | import: struct { |