| ... | ... | @@ -8,9 +8,6 @@ const InstallDirStep = @This(); |
| 8 | 8 | |
| 9 | 9 | step: Step, |
| 10 | 10 | options: Options, |
| 11 | | /// This is used by the build system when a file being installed comes from one |
| 12 | | /// package but is being installed by another. |
| 13 | | dest_builder: *std.Build, |
| 14 | 11 | |
| 15 | 12 | pub const base_id = .install_dir; |
| 16 | 13 | |
| ... | ... | @@ -55,7 +52,6 @@ pub fn create(owner: *std.Build, options: Options) *InstallDirStep { |
| 55 | 52 | .makeFn = make, |
| 56 | 53 | }), |
| 57 | 54 | .options = options.dupe(owner), |
| 58 | | .dest_builder = owner, |
| 59 | 55 | }; |
| 60 | 56 | options.source_dir.addStepDependencies(&self.step); |
| 61 | 57 | return self; |
| ... | ... | @@ -63,15 +59,14 @@ pub fn create(owner: *std.Build, options: Options) *InstallDirStep { |
| 63 | 59 | |
| 64 | 60 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 65 | 61 | _ = prog_node; |
| 62 | const b = step.owner; |
| 66 | 63 | const self: *InstallDirStep = @fieldParentPtr("step", step); |
| 67 | | const dest_builder = self.dest_builder; |
| 68 | | const arena = dest_builder.allocator; |
| 69 | | const dest_prefix = dest_builder.getInstallPath(self.options.install_dir, self.options.install_subdir); |
| 70 | | const src_builder = self.step.owner; |
| 71 | | const src_dir_path = self.options.source_dir.getPath2(src_builder, step); |
| 72 | | var src_dir = src_builder.build_root.handle.openDir(src_dir_path, .{ .iterate = true }) catch |err| { |
| 64 | const arena = b.allocator; |
| 65 | const dest_prefix = b.getInstallPath(self.options.install_dir, self.options.install_subdir); |
| 66 | const src_dir_path = self.options.source_dir.getPath2(b, step); |
| 67 | var src_dir = b.build_root.handle.openDir(src_dir_path, .{ .iterate = true }) catch |err| { |
| 73 | 68 | return step.fail("unable to open source directory '{}{s}': {s}", .{ |
| 74 | | src_builder.build_root, src_dir_path, @errorName(err), |
| 69 | b.build_root, src_dir_path, @errorName(err), |
| 75 | 70 | }); |
| 76 | 71 | }; |
| 77 | 72 | defer src_dir.close(); |
| ... | ... | @@ -104,20 +99,20 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 104 | 99 | .file => { |
| 105 | 100 | for (self.options.blank_extensions) |ext| { |
| 106 | 101 | if (mem.endsWith(u8, entry.path, ext)) { |
| 107 | | try dest_builder.truncateFile(dest_path); |
| 102 | try b.truncateFile(dest_path); |
| 108 | 103 | continue :next_entry; |
| 109 | 104 | } |
| 110 | 105 | } |
| 111 | 106 | |
| 112 | 107 | const prev_status = fs.Dir.updateFile( |
| 113 | | src_builder.build_root.handle, |
| 108 | b.build_root.handle, |
| 114 | 109 | src_sub_path, |
| 115 | 110 | cwd, |
| 116 | 111 | dest_path, |
| 117 | 112 | .{}, |
| 118 | 113 | ) catch |err| { |
| 119 | 114 | return step.fail("unable to update file from '{}{s}' to '{s}': {s}", .{ |
| 120 | | src_builder.build_root, src_sub_path, dest_path, @errorName(err), |
| 115 | b.build_root, src_sub_path, dest_path, @errorName(err), |
| 121 | 116 | }); |
| 122 | 117 | }; |
| 123 | 118 | all_cached = all_cached and prev_status == .fresh; |