| author | |
| committer | |
| log | f829f848ddc390e6f14e8da3eee452bd7ead5a3a |
| tree | e42f5c4f5ba1738cbf8bcc7e730c8744bf68a001 |
| parent | 2c491d734ee82947b2a77c08c1c5328e7a5fe771 |
in the creation function, which had to change from init() to create().2 files changed, 10 insertions(+), 12 deletions(-)
lib/std/Build.zig+2-9| ... | ... | @@ -1220,12 +1220,7 @@ pub fn addInstallFileWithDir( |
| 1220 | 1220 | install_dir: InstallDir, |
| 1221 | 1221 | dest_rel_path: []const u8, |
| 1222 | 1222 | ) *InstallFileStep { |
| 1223 | if (dest_rel_path.len == 0) { | |
| 1224 | panic("dest_rel_path must be non-empty", .{}); | |
| 1225 | } | |
| 1226 | const install_step = self.allocator.create(InstallFileStep) catch @panic("OOM"); | |
| 1227 | install_step.* = InstallFileStep.init(self, source.dupe(self), install_dir, dest_rel_path); | |
| 1228 | return install_step; | |
| 1223 | return InstallFileStep.create(self, source.dupe(self), install_dir, dest_rel_path); | |
| 1229 | 1224 | } |
| 1230 | 1225 | |
| 1231 | 1226 | pub fn addInstallDirectory(self: *Build, options: InstallDirectoryOptions) *InstallDirStep { |
| ... | ... | @@ -1685,9 +1680,7 @@ pub const InstallDir = union(enum) { |
| 1685 | 1680 | /// Duplicates the install directory including the path if set to custom. |
| 1686 | 1681 | pub fn dupe(self: InstallDir, builder: *Build) InstallDir { |
| 1687 | 1682 | if (self == .custom) { |
| 1688 | // Written with this temporary to avoid RLS problems | |
| 1689 | const duped_path = builder.dupe(self.custom); | |
| 1690 | return .{ .custom = duped_path }; | |
| 1683 | return .{ .custom = builder.dupe(self.custom) }; | |
| 1691 | 1684 | } else { |
| 1692 | 1685 | return self; |
| 1693 | 1686 | } |
lib/std/Build/InstallFileStep.zig+8-3| ... | ... | @@ -3,6 +3,7 @@ const Step = std.Build.Step; |
| 3 | 3 | const FileSource = std.Build.FileSource; |
| 4 | 4 | const InstallDir = std.Build.InstallDir; |
| 5 | 5 | const InstallFileStep = @This(); |
| 6 | const assert = std.debug.assert; | |
| 6 | 7 | |
| 7 | 8 | pub const base_id = .install_file; |
| 8 | 9 | |
| ... | ... | @@ -14,14 +15,16 @@ dest_rel_path: []const u8, |
| 14 | 15 | /// package but is being installed by another. |
| 15 | 16 | dest_builder: *std.Build, |
| 16 | 17 | |
| 17 | pub fn init( | |
| 18 | pub fn create( | |
| 18 | 19 | owner: *std.Build, |
| 19 | 20 | source: FileSource, |
| 20 | 21 | dir: InstallDir, |
| 21 | 22 | dest_rel_path: []const u8, |
| 22 | ) InstallFileStep { | |
| 23 | ) *InstallFileStep { | |
| 24 | assert(dest_rel_path.len != 0); | |
| 23 | 25 | owner.pushInstalledFile(dir, dest_rel_path); |
| 24 | return InstallFileStep{ | |
| 26 | const self = owner.allocator.create(InstallFileStep) catch @panic("OOM"); | |
| 27 | self.* = .{ | |
| 25 | 28 | .step = Step.init(.{ |
| 26 | 29 | .id = base_id, |
| 27 | 30 | .name = owner.fmt("install {s} to {s}", .{ source.getDisplayName(), dest_rel_path }), |
| ... | ... | @@ -33,6 +36,8 @@ pub fn init( |
| 33 | 36 | .dest_rel_path = owner.dupePath(dest_rel_path), |
| 34 | 37 | .dest_builder = owner, |
| 35 | 38 | }; |
| 39 | source.addStepDependencies(&self.step); | |
| 40 | return self; | |
| 36 | 41 | } |
| 37 | 42 | |
| 38 | 43 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |