Skip to content

Commit 9c2736d

Browse files
committed
Updated build.zig to support new LazyPath syntax
1 parent 8b5be24 commit 9c2736d

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

build.zig

+11-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const std = @import("std");
22
const builtin = @import("builtin");
33

44
pub fn build(b: *std.Build) !void {
5-
65
const target = b.standardTargetOptions(.{});
76
const optimize = b.standardOptimizeOption(.{});
87

@@ -23,7 +22,7 @@ pub fn build(b: *std.Build) !void {
2322
{
2423
const exe = b.addExecutable(.{
2524
.name = "test",
26-
.root_source_file = .{ .path = "test.zig" },
25+
.root_source_file = b.path("test.zig"),
2726
.target = target,
2827
.optimize = optimize,
2928
});
@@ -87,7 +86,7 @@ fn addZigupExe(
8786
if (target.result.os.tag == .windows) {
8887
const exe = b.addExecutable(.{
8988
.name = "win32exelink",
90-
.root_source_file = .{ .path = "win32exelink.zig" },
89+
.root_source_file = b.path("win32exelink.zig"),
9190
.target = target,
9291
.optimize = optimize,
9392
});
@@ -100,7 +99,7 @@ fn addZigupExe(
10099

101100
const exe = b.addExecutable(.{
102101
.name = "zigup",
103-
.root_source_file = .{ .path = "zigup.zig" },
102+
.root_source_file = b.path("zigup.zig"),
104103
.target = target,
105104
.optimize = optimize,
106105
});
@@ -117,7 +116,7 @@ fn ci(
117116
test_step: *std.Build.Step,
118117
host_zip_exe: *std.Build.Step.Compile,
119118
) !void {
120-
const ci_targets = [_][]const u8 {
119+
const ci_targets = [_][]const u8{
121120
"x86_64-linux",
122121
"x86_64-macos",
123122
"x86_64-windows",
@@ -140,8 +139,7 @@ fn ci(
140139
));
141140
const optimize: std.builtin.OptimizeMode =
142141
// Compile in ReleaseSafe on Windows for faster extraction
143-
if (target.result.os.tag == .windows) .ReleaseSafe
144-
else .Debug;
142+
if (target.result.os.tag == .windows) .ReleaseSafe else .Debug;
145143
const zigup_exe = addZigupExe(b, target, optimize);
146144
const zigup_exe_install = b.addInstallArtifact(zigup_exe, .{
147145
.dest_dir = .{ .override = .{ .custom = ci_target_str } },
@@ -150,7 +148,7 @@ fn ci(
150148

151149
const test_exe = b.addExecutable(.{
152150
.name = b.fmt("test-{s}", .{ci_target_str}),
153-
.root_source_file = .{ .path = "test.zig" },
151+
.root_source_file = b.path("test.zig"),
154152
.target = target,
155153
.optimize = optimize,
156154
});
@@ -172,9 +170,7 @@ fn ci(
172170
}
173171

174172
if (builtin.os.tag == .linux) {
175-
make_archive_step.dependOn(makeCiArchiveStep(
176-
b, ci_target_str, target.result, zigup_exe_install, host_zip_exe
177-
));
173+
make_archive_step.dependOn(makeCiArchiveStep(b, ci_target_str, target.result, zigup_exe_install, host_zip_exe));
178174
}
179175
}
180176
}
@@ -197,10 +193,10 @@ fn makeCiArchiveStep(
197193
zip.addArg(out_zip_file);
198194
zip.addArg("zigup.exe");
199195
zip.addArg("zigup.pdb");
200-
zip.cwd = .{ .path = b.getInstallPath(
196+
zip.cwd = .{ .cwd_relative = b.getInstallPath(
201197
exe_install.dest_dir.?,
202198
".",
203-
)};
199+
) };
204200
zip.step.dependOn(&exe_install.step);
205201
return &zip.step;
206202
}
@@ -215,10 +211,10 @@ fn makeCiArchiveStep(
215211
targz,
216212
"zigup",
217213
});
218-
tar.cwd = .{ .path = b.getInstallPath(
214+
tar.cwd = .{ .cwd_relative = b.getInstallPath(
219215
exe_install.dest_dir.?,
220216
".",
221-
)};
217+
) };
222218
tar.step.dependOn(&exe_install.step);
223219
return &tar.step;
224220
}

0 commit comments

Comments
 (0)