aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step/InstallFile.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-05-04 14:29:17 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2024-05-05 09:42:51 -0400
commite3424332d3fa1264e1f6861b76bb0d1b2996728d (patch)
tree2d786805328dd51b8d8e804ab6b655fc398d2f3f /lib/std/Build/Step/InstallFile.zig
parentd582575aba5264aaa02a8af0cdb7da7c4f4c6220 (diff)
downloadzig-e3424332d3fa1264e1f6861b76bb0d1b2996728d.tar.gz
zig-e3424332d3fa1264e1f6861b76bb0d1b2996728d.zip
Build: cleanup
* `doc/langref` formatting * upgrade `.{ .path = "..." }` to `b.path("...")` * avoid using arguments named `self` * make `Build.Step.Id` usage more consistent * add `Build.pathResolve` * use `pathJoin` and `pathResolve` everywhere * make sure `Build.LazyPath.getPath2` returns an absolute path
Diffstat (limited to 'lib/std/Build/Step/InstallFile.zig')
-rw-r--r--lib/std/Build/Step/InstallFile.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/std/Build/Step/InstallFile.zig b/lib/std/Build/Step/InstallFile.zig
index 1ad9fa7d5d..6fa6d6bc99 100644
--- a/lib/std/Build/Step/InstallFile.zig
+++ b/lib/std/Build/Step/InstallFile.zig
@@ -5,7 +5,7 @@ const InstallDir = std.Build.InstallDir;
const InstallFile = @This();
const assert = std.debug.assert;
-pub const base_id = .install_file;
+pub const base_id: Step.Id = .install_file;
step: Step,
source: LazyPath,
@@ -20,8 +20,8 @@ pub fn create(
) *InstallFile {
assert(dest_rel_path.len != 0);
owner.pushInstalledFile(dir, dest_rel_path);
- const self = owner.allocator.create(InstallFile) catch @panic("OOM");
- self.* = .{
+ const install_file = owner.allocator.create(InstallFile) catch @panic("OOM");
+ install_file.* = .{
.step = Step.init(.{
.id = base_id,
.name = owner.fmt("install {s} to {s}", .{ source.getDisplayName(), dest_rel_path }),
@@ -32,16 +32,16 @@ pub fn create(
.dir = dir.dupe(owner),
.dest_rel_path = owner.dupePath(dest_rel_path),
};
- source.addStepDependencies(&self.step);
- return self;
+ source.addStepDependencies(&install_file.step);
+ return install_file;
}
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
_ = prog_node;
const b = step.owner;
- const self: *InstallFile = @fieldParentPtr("step", step);
- const full_src_path = self.source.getPath2(b, step);
- const full_dest_path = b.getInstallPath(self.dir, self.dest_rel_path);
+ const install_file: *InstallFile = @fieldParentPtr("step", step);
+ const full_src_path = install_file.source.getPath2(b, step);
+ const full_dest_path = b.getInstallPath(install_file.dir, install_file.dest_rel_path);
const cwd = std.fs.cwd();
const prev = std.fs.Dir.updateFile(cwd, full_src_path, cwd, full_dest_path, .{}) catch |err| {
return step.fail("unable to update file from '{s}' to '{s}': {s}", .{