| ... | ... | @@ -833,7 +833,7 @@ fn makeStepNames( |
| 833 | 833 | var pending_count: usize = 0; |
| 834 | 834 | var total_compile_errors: usize = 0; |
| 835 | 835 | |
| 836 | | var cleanup_task = io.async(cleanTmpFiles, .{ io, step_stack.keys() }); |
| 836 | var cleanup_task = io.async(cleanTmpFiles, .{ maker, step_stack.keys() }); |
| 837 | 837 | defer cleanup_task.await(io); |
| 838 | 838 | |
| 839 | 839 | for (step_stack.keys()) |step_index| { |
| ... | ... | @@ -1677,17 +1677,20 @@ fn fatalWithHint(comptime f: []const u8, args: anytype) noreturn { |
| 1677 | 1677 | fatal(f, args); |
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | | fn cleanTmpFiles(io: Io, steps: []const Configuration.Step.Index) void { |
| 1681 | | std.log.err("TODO implement cleanTmpFiles", .{}); |
| 1682 | | if (true) return; |
| 1680 | fn cleanTmpFiles(maker: *Maker, steps: []const Configuration.Step.Index) void { |
| 1681 | const graph = maker.graph; |
| 1682 | const io = graph.io; |
| 1683 | const conf = &maker.scanned_config.configuration; |
| 1683 | 1684 | |
| 1684 | 1685 | for (steps) |step_index| { |
| 1685 | | const wf = step_index.cast(std.Build.Step.WriteFile) orelse continue; |
| 1686 | | if (wf.mode != .tmp) continue; |
| 1687 | | const path = wf.generated_directory.path orelse continue; |
| 1688 | | Dir.cwd().deleteTree(io, path) catch |err| { |
| 1689 | | log.warn("failed to delete {s}: {t}", .{ path, err }); |
| 1690 | | }; |
| 1686 | const conf_step = step_index.ptr(conf); |
| 1687 | const wf = conf_step.extended.cast(conf, Configuration.Step.WriteFile) orelse continue; |
| 1688 | if (wf.flags.mode != .tmp) continue; |
| 1689 | const step = maker.stepByIndex(step_index); |
| 1690 | if (step.state != .success) continue; |
| 1691 | const tmp_path = generatedPath(maker, wf.generated_directory).*; |
| 1692 | tmp_path.root_dir.handle.deleteTree(io, tmp_path.subPathOrDot()) catch |err| |
| 1693 | log.warn("failed to delete temporary path {f}: {t}", .{ tmp_path, err }); |
| 1691 | 1694 | } |
| 1692 | 1695 | } |
| 1693 | 1696 | |