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