authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-09-07 16:15:19 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-09-07 16:15:49 -07:00
log2c004d07b20f8b9d7369426721d4fc4b107a435f
tree2a6958185dcae4f34183fc0f5cbf8ac721a4eb66
parenta9c075a8176a61e1af28cc951a438915679e3c40

upgrade to Zig 0.13


15 files changed, 22 insertions(+), 19 deletions(-)

.github/workflows/nightly.yml+1-1
...@@ -27,7 +27,7 @@ jobs:...@@ -27,7 +27,7 @@ jobs:
27 uses: mlugg/setup-zig@v127 uses: mlugg/setup-zig@v1
28 with:28 with:
29 mirror: "http://mirrors.nektro.net/s3cgi"29 mirror: "http://mirrors.nektro.net/s3cgi"
30 version: "0.12.0"30 version: "0.13.0"
3131
32 - run: zig version32 - run: zig version
33 - run: zig env33 - run: zig env
.github/workflows/push.yml+1-1
...@@ -20,7 +20,7 @@ jobs:...@@ -20,7 +20,7 @@ jobs:
20 uses: mlugg/setup-zig@v120 uses: mlugg/setup-zig@v1
21 with:21 with:
22 mirror: "http://mirrors.nektro.net/s3cgi"22 mirror: "http://mirrors.nektro.net/s3cgi"
23 version: "0.12.0"23 version: "0.13.0"
2424
25 - run: zig version25 - run: zig version
26 - run: zig env26 - run: zig env
.gitignore+3-1
...@@ -1,3 +1,5 @@...@@ -1,3 +1,5 @@
1zig-*1zig-cache
2.zig-cache
3zig-out
2.zigmod4.zigmod
3bin5bin
README.md+1-1
...@@ -16,7 +16,7 @@ A package manager for the Zig programming language....@@ -16,7 +16,7 @@ A package manager for the Zig programming language.
16- https://github.com/nektro/zigmod/releases16- https://github.com/nektro/zigmod/releases
1717
18## Built With18## Built With
19- Zig master (at least `0.12.0`)19- Zig `0.13.0`
20- See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock)20- See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock)
2121
22### Build from Source22### Build from Source
build.zig+1-1
...@@ -11,7 +11,7 @@ pub fn build(b: *std.Build) void {...@@ -11,7 +11,7 @@ pub fn build(b: *std.Build) void {
11 const exe_name = b.fmt("{s}{s}", .{ "zigmod", if (use_full_name) with_arch_os else "" });11 const exe_name = b.fmt("{s}{s}", .{ "zigmod", if (use_full_name) with_arch_os else "" });
12 const exe = b.addExecutable(.{12 const exe = b.addExecutable(.{
13 .name = exe_name,13 .name = exe_name,
14 .root_source_file = .{ .path = "src/main.zig" },14 .root_source_file = b.path("src/main.zig"),
15 .target = target,15 .target = target,
16 .optimize = mode,16 .optimize = mode,
17 });17 });
deps.zig+3-3
...@@ -40,7 +40,7 @@ pub const GitExactStep = struct {...@@ -40,7 +40,7 @@ pub const GitExactStep = struct {
40 return result;40 return result;
41 }41 }
4242
43 fn make(step: *std.Build.Step, prog_node: *std.Progress.Node) !void {43 fn make(step: *std.Build.Step, prog_node: std.Progress.Node) !void {
44 _ = step;44 _ = step;
45 _ = prog_node;45 _ = prog_node;
46 }46 }
...@@ -126,7 +126,7 @@ pub const Package = struct {...@@ -126,7 +126,7 @@ pub const Package = struct {
126 });126 });
127 dummy_library.step.dependOn(fetch_step);127 dummy_library.step.dependOn(fetch_step);
128 if (self.entry) |capture| {128 if (self.entry) |capture| {
129 result.root_source_file = .{ .path = capture };129 result.root_source_file = .{ .cwd_relative = capture };
130 }130 }
131 for (self.deps) |item| {131 for (self.deps) |item| {
132 const module_dep = item.module(exe, fetch_step);132 const module_dep = item.module(exe, fetch_step);
...@@ -168,7 +168,7 @@ pub const Package = struct {...@@ -168,7 +168,7 @@ pub const Package = struct {
168};168};
169169
170fn checkMinZig(current: std.SemanticVersion, exe: *std.Build.Step.Compile) void {170fn checkMinZig(current: std.SemanticVersion, exe: *std.Build.Step.Compile) void {
171 const min = std.SemanticVersion.parse("0.12.0") catch return;171 const min = std.SemanticVersion.parse("0.13.0") catch return;
172 if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{current, min}));172 if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{current, min}));
173}173}
174174
docs/README.md+1-1
...@@ -10,7 +10,7 @@ The rest of this documentation will assume you already have Zig installed....@@ -10,7 +10,7 @@ The rest of this documentation will assume you already have Zig installed.
1010
11As Zig is still in development itself, if you plan to contribute to Zigmod you will need a master download of Zig. Those can be obtained from https://ziglang.org/download/#release-master.11As Zig is still in development itself, if you plan to contribute to Zigmod you will need a master download of Zig. Those can be obtained from https://ziglang.org/download/#release-master.
1212
13The earliest Zig release this Zigmod was verified to work with is `0.12.0`.13The earliest Zig release this Zigmod was verified to work with is `0.13.0`.
1414
15## Download15## Download
16You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source.16You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source.
src/cmd/aquila/install.zig+1-1
...@@ -70,7 +70,7 @@ pub fn execute(self_name: []const u8, args: [][]u8) !void {...@@ -70,7 +70,7 @@ pub fn execute(self_name: []const u8, args: [][]u8) !void {
70 "--prefix", try std.fs.path.join(gpa, &.{ homepath, ".zigmod" }),70 "--prefix", try std.fs.path.join(gpa, &.{ homepath, ".zigmod" }),
71 "--cache-dir", try std.fs.path.join(gpa, &.{ cache.?, "zigmod", "zig" }),71 "--cache-dir", try std.fs.path.join(gpa, &.{ cache.?, "zigmod", "zig" }),
72 };72 };
73 var proc = std.ChildProcess.init(argv, gpa);73 var proc = std.process.Child.init(argv, gpa);
74 proc.cwd = modpath;74 proc.cwd = modpath;
75 const term = try proc.spawnAndWait();75 const term = try proc.spawnAndWait();
76 switch (term) {76 switch (term) {
src/cmd/aquila/update.zig+1-1
...@@ -56,7 +56,7 @@ pub fn execute(self_name: []const u8, args: [][]u8) !void {...@@ -56,7 +56,7 @@ pub fn execute(self_name: []const u8, args: [][]u8) !void {
56 "--prefix", try std.fs.path.join(gpa, &.{ homepath, ".zigmod" }),56 "--prefix", try std.fs.path.join(gpa, &.{ homepath, ".zigmod" }),
57 "--cache-dir", try std.fs.path.join(gpa, &.{ cache.?, "zigmod", "zig" }),57 "--cache-dir", try std.fs.path.join(gpa, &.{ cache.?, "zigmod", "zig" }),
58 };58 };
59 var proc = std.ChildProcess.init(argv, gpa);59 var proc = std.process.Child.init(argv, gpa);
60 proc.cwd = modpath;60 proc.cwd = modpath;
61 const term = try proc.spawnAndWait();61 const term = try proc.spawnAndWait();
62 switch (term) {62 switch (term) {
src/cmd/fetch.zig+1-1
...@@ -329,7 +329,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(zigmod.Modul...@@ -329,7 +329,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(zigmod.Modul
329 });329 });
330 if (mod.main.len > 0 and !std.mem.eql(u8, &mod.id, &zigmod.Module.ROOT)) {330 if (mod.main.len > 0 and !std.mem.eql(u8, &mod.id, &zigmod.Module.ROOT)) {
331 try w.print(331 try w.print(
332 \\ .import = .{{ "{s}", .{{ .path = dirs._{s} ++ "/{s}" }} }},332 \\ .import = .{{ "{s}", .{{ .cwd_relative = dirs._{s} ++ "/{s}" }} }},
333 \\333 \\
334 , .{334 , .{
335 mod.name,335 mod.name,
src/cmd/generate.zig+2-2
...@@ -83,7 +83,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D...@@ -83,7 +83,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
83 \\ return result;83 \\ return result;
84 \\ }84 \\ }
85 \\85 \\
86 \\ fn make(step: *std.Build.Step, prog_node: *std.Progress.Node) !void {86 \\ fn make(step: *std.Build.Step, prog_node: std.Progress.Node) !void {
87 \\ _ = step;87 \\ _ = step;
88 \\ _ = prog_node;88 \\ _ = prog_node;
89 \\ }89 \\ }
...@@ -162,7 +162,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D...@@ -162,7 +162,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
162 \\ });162 \\ });
163 \\ dummy_library.step.dependOn(fetch_step);163 \\ dummy_library.step.dependOn(fetch_step);
164 \\ if (self.entry) |capture| {164 \\ if (self.entry) |capture| {
165 \\ result.root_source_file = .{ .path = capture };165 \\ result.root_source_file = .{ .cwd_relative = capture };
166 \\ }166 \\ }
167 \\ for (self.deps) |item| {167 \\ for (self.deps) |item| {
168 \\ const module_dep = item.module(exe, fetch_step);168 \\ const module_dep = item.module(exe, fetch_step);
src/cmd/init.zig+2-1
...@@ -147,7 +147,8 @@ pub fn execute(self_name: []const u8, args: [][]u8) !void {...@@ -147,7 +147,8 @@ pub fn execute(self_name: []const u8, args: [][]u8) !void {
147 if (len > 0 and (try file.reader().readByte()) != '\n') {147 if (len > 0 and (try file.reader().readByte()) != '\n') {
148 try w.writeAll("\n");148 try w.writeAll("\n");
149 }149 }
150 if (!exists) try w.writeAll("zig-*\n");150 if (!exists) try w.writeAll(".zig-cache\n");
151 if (!exists) try w.writeAll("zig-out\n");
151 try w.writeAll(".zigmod\n");152 try w.writeAll(".zigmod\n");
152 try w.writeAll("deps.zig\n");153 try w.writeAll("deps.zig\n");
153 try w.writeAll("files.zig\n");154 try w.writeAll("files.zig\n");
src/main.zig+1-1
...@@ -56,7 +56,7 @@ pub fn main() !void {...@@ -56,7 +56,7 @@ pub fn main() !void {
56 for (args[1..]) |item| {56 for (args[1..]) |item| {
57 try sub_cmd_args.append(item);57 try sub_cmd_args.append(item);
58 }58 }
59 const result = std.ChildProcess.run(.{ .allocator = gpa, .argv = sub_cmd_args.items }) catch |e| switch (e) {59 const result = std.process.Child.run(.{ .allocator = gpa, .argv = sub_cmd_args.items }) catch |e| switch (e) {
60 else => |ee| return ee,60 else => |ee| return ee,
61 error.FileNotFound => {61 error.FileNotFound => {
62 fail("unknown command \"{s}\" for \"zigmod\"", .{args[0]});62 fail("unknown command \"{s}\" for \"zigmod\"", .{args[0]});
src/util/funcs.zig+2-2
...@@ -53,8 +53,8 @@ pub fn file_list(alloc: std.mem.Allocator, dpath: string) ![]const string {...@@ -53,8 +53,8 @@ pub fn file_list(alloc: std.mem.Allocator, dpath: string) ![]const string {
53 return try extras.fileList(alloc, dir);53 return try extras.fileList(alloc, dir);
54}54}
5555
56pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.ChildProcess.RunResult {56pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.process.Child.RunResult {
57 return std.ChildProcess.run(.{ .allocator = alloc, .cwd = dir, .argv = args, .max_output_bytes = std.math.maxInt(usize) }) catch |e| switch (e) {57 return std.process.Child.run(.{ .allocator = alloc, .cwd = dir, .argv = args, .max_output_bytes = std.math.maxInt(usize) }) catch |e| switch (e) {
58 error.FileNotFound => {58 error.FileNotFound => {
59 u.fail("\"{s}\" command not found", .{args[0]});59 u.fail("\"{s}\" command not found", .{args[0]});
60 },60 },
zig.mod+1-1
...@@ -3,7 +3,7 @@ name: zigmod...@@ -3,7 +3,7 @@ name: zigmod
3main: src/lib.zig3main: src/lib.zig
4license: MIT4license: MIT
5description: A package manager for the Zig programming language.5description: A package manager for the Zig programming language.
6min_zig_version: 0.12.06min_zig_version: 0.13.0
7dependencies:7dependencies:
8 - src: git https://github.com/nektro/zig-yaml8 - src: git https://github.com/nektro/zig-yaml
9 - src: git https://github.com/nektro/zig-ansi9 - src: git https://github.com/nektro/zig-ansi