mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
std.Build: use create() instead of init() for Step.RemoveDir
This commit is contained in:
parent
809e7aa4fc
commit
b403ca0aab
@ -971,9 +971,7 @@ pub fn addWriteFiles(b: *Build) *Step.WriteFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn addRemoveDirTree(self: *Build, dir_path: []const u8) *Step.RemoveDir {
|
pub fn addRemoveDirTree(self: *Build, dir_path: []const u8) *Step.RemoveDir {
|
||||||
const remove_dir_step = self.allocator.create(Step.RemoveDir) catch @panic("OOM");
|
return Step.RemoveDir.create(self, dir_path);
|
||||||
remove_dir_step.* = Step.RemoveDir.init(self, dir_path);
|
|
||||||
return remove_dir_step;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addFmt(b: *Build, options: Step.Fmt.Options) *Step.Fmt {
|
pub fn addFmt(b: *Build, options: Step.Fmt.Options) *Step.Fmt {
|
||||||
|
|||||||
@ -8,8 +8,9 @@ pub const base_id = .remove_dir;
|
|||||||
step: Step,
|
step: Step,
|
||||||
dir_path: []const u8,
|
dir_path: []const u8,
|
||||||
|
|
||||||
pub fn init(owner: *std.Build, dir_path: []const u8) RemoveDir {
|
pub fn create(owner: *std.Build, dir_path: []const u8) *RemoveDir {
|
||||||
return RemoveDir{
|
const self = owner.allocator.create(RemoveDir) catch @panic("OOM");
|
||||||
|
self.* = .{
|
||||||
.step = Step.init(.{
|
.step = Step.init(.{
|
||||||
.id = .remove_dir,
|
.id = .remove_dir,
|
||||||
.name = owner.fmt("RemoveDir {s}", .{dir_path}),
|
.name = owner.fmt("RemoveDir {s}", .{dir_path}),
|
||||||
@ -18,6 +19,7 @@ pub fn init(owner: *std.Build, dir_path: []const u8) RemoveDir {
|
|||||||
}),
|
}),
|
||||||
.dir_path = owner.dupePath(dir_path),
|
.dir_path = owner.dupePath(dir_path),
|
||||||
};
|
};
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user