mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.Build.InstallFileStep: add missing step dependencies
in the creation function, which had to change from init() to create().
This commit is contained in:
parent
2c491d734e
commit
f829f848dd
2 changed files with 10 additions and 12 deletions
|
|
@ -1220,12 +1220,7 @@ pub fn addInstallFileWithDir(
|
|||
install_dir: InstallDir,
|
||||
dest_rel_path: []const u8,
|
||||
) *InstallFileStep {
|
||||
if (dest_rel_path.len == 0) {
|
||||
panic("dest_rel_path must be non-empty", .{});
|
||||
}
|
||||
const install_step = self.allocator.create(InstallFileStep) catch @panic("OOM");
|
||||
install_step.* = InstallFileStep.init(self, source.dupe(self), install_dir, dest_rel_path);
|
||||
return install_step;
|
||||
return InstallFileStep.create(self, source.dupe(self), install_dir, dest_rel_path);
|
||||
}
|
||||
|
||||
pub fn addInstallDirectory(self: *Build, options: InstallDirectoryOptions) *InstallDirStep {
|
||||
|
|
@ -1685,9 +1680,7 @@ pub const InstallDir = union(enum) {
|
|||
/// Duplicates the install directory including the path if set to custom.
|
||||
pub fn dupe(self: InstallDir, builder: *Build) InstallDir {
|
||||
if (self == .custom) {
|
||||
// Written with this temporary to avoid RLS problems
|
||||
const duped_path = builder.dupe(self.custom);
|
||||
return .{ .custom = duped_path };
|
||||
return .{ .custom = builder.dupe(self.custom) };
|
||||
} else {
|
||||
return self;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ const Step = std.Build.Step;
|
|||
const FileSource = std.Build.FileSource;
|
||||
const InstallDir = std.Build.InstallDir;
|
||||
const InstallFileStep = @This();
|
||||
const assert = std.debug.assert;
|
||||
|
||||
pub const base_id = .install_file;
|
||||
|
||||
|
|
@ -14,14 +15,16 @@ dest_rel_path: []const u8,
|
|||
/// package but is being installed by another.
|
||||
dest_builder: *std.Build,
|
||||
|
||||
pub fn init(
|
||||
pub fn create(
|
||||
owner: *std.Build,
|
||||
source: FileSource,
|
||||
dir: InstallDir,
|
||||
dest_rel_path: []const u8,
|
||||
) InstallFileStep {
|
||||
) *InstallFileStep {
|
||||
assert(dest_rel_path.len != 0);
|
||||
owner.pushInstalledFile(dir, dest_rel_path);
|
||||
return InstallFileStep{
|
||||
const self = owner.allocator.create(InstallFileStep) catch @panic("OOM");
|
||||
self.* = .{
|
||||
.step = Step.init(.{
|
||||
.id = base_id,
|
||||
.name = owner.fmt("install {s} to {s}", .{ source.getDisplayName(), dest_rel_path }),
|
||||
|
|
@ -33,6 +36,8 @@ pub fn init(
|
|||
.dest_rel_path = owner.dupePath(dest_rel_path),
|
||||
.dest_builder = owner,
|
||||
};
|
||||
source.addStepDependencies(&self.step);
|
||||
return self;
|
||||
}
|
||||
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue