mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-09 23:29:03 +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,
|
install_dir: InstallDir,
|
||||||
dest_rel_path: []const u8,
|
dest_rel_path: []const u8,
|
||||||
) *InstallFileStep {
|
) *InstallFileStep {
|
||||||
if (dest_rel_path.len == 0) {
|
return InstallFileStep.create(self, source.dupe(self), install_dir, dest_rel_path);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addInstallDirectory(self: *Build, options: InstallDirectoryOptions) *InstallDirStep {
|
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.
|
/// Duplicates the install directory including the path if set to custom.
|
||||||
pub fn dupe(self: InstallDir, builder: *Build) InstallDir {
|
pub fn dupe(self: InstallDir, builder: *Build) InstallDir {
|
||||||
if (self == .custom) {
|
if (self == .custom) {
|
||||||
// Written with this temporary to avoid RLS problems
|
return .{ .custom = builder.dupe(self.custom) };
|
||||||
const duped_path = builder.dupe(self.custom);
|
|
||||||
return .{ .custom = duped_path };
|
|
||||||
} else {
|
} else {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ const Step = std.Build.Step;
|
||||||
const FileSource = std.Build.FileSource;
|
const FileSource = std.Build.FileSource;
|
||||||
const InstallDir = std.Build.InstallDir;
|
const InstallDir = std.Build.InstallDir;
|
||||||
const InstallFileStep = @This();
|
const InstallFileStep = @This();
|
||||||
|
const assert = std.debug.assert;
|
||||||
|
|
||||||
pub const base_id = .install_file;
|
pub const base_id = .install_file;
|
||||||
|
|
||||||
|
|
@ -14,14 +15,16 @@ dest_rel_path: []const u8,
|
||||||
/// package but is being installed by another.
|
/// package but is being installed by another.
|
||||||
dest_builder: *std.Build,
|
dest_builder: *std.Build,
|
||||||
|
|
||||||
pub fn init(
|
pub fn create(
|
||||||
owner: *std.Build,
|
owner: *std.Build,
|
||||||
source: FileSource,
|
source: FileSource,
|
||||||
dir: InstallDir,
|
dir: InstallDir,
|
||||||
dest_rel_path: []const u8,
|
dest_rel_path: []const u8,
|
||||||
) InstallFileStep {
|
) *InstallFileStep {
|
||||||
|
assert(dest_rel_path.len != 0);
|
||||||
owner.pushInstalledFile(dir, dest_rel_path);
|
owner.pushInstalledFile(dir, dest_rel_path);
|
||||||
return InstallFileStep{
|
const self = owner.allocator.create(InstallFileStep) catch @panic("OOM");
|
||||||
|
self.* = .{
|
||||||
.step = Step.init(.{
|
.step = Step.init(.{
|
||||||
.id = base_id,
|
.id = base_id,
|
||||||
.name = owner.fmt("install {s} to {s}", .{ source.getDisplayName(), dest_rel_path }),
|
.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_rel_path = owner.dupePath(dest_rel_path),
|
||||||
.dest_builder = owner,
|
.dest_builder = owner,
|
||||||
};
|
};
|
||||||
|
source.addStepDependencies(&self.step);
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue