From 046eb90846a97391398a469bad3e0bf37c96c700 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Wed, 26 Apr 2023 12:43:48 -0700 Subject: [PATCH] meta: update to zig master --- .github/workflows/nightly.yml | 2 +- .github/workflows/push.yml | 2 +- README.md | 2 +- build.zig | 5 ++--- deps.zig | 20 +++++++++++++------- docs/README.md | 2 +- src/cmd/fetch.zig | 6 +++--- src/cmd/generate.zig | 18 ++++++++++++------ zig.mod | 2 +- 9 files changed, 35 insertions(+), 24 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index be1978c5d431cdc3e467f5a8ecb6e260c3c37947..4c52a76f906d49e14c69b316c18f0f79e600ebd7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -26,7 +26,7 @@ jobs: - name: Setup Zig uses: goto-bus-stop/setup-zig@v1 with: - version: "0.11.0-dev.1898+1a4a0b5e9" + version: "0.11.0-dev.2777+b95cdf0ae" - run: zig version - run: zig env diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8cfe963493b65eca9aee4263ada6e5c23b2ab328..e1a3c3ab2dbe0cf494fc6ffa6d424c55f4a179bb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Zig uses: goto-bus-stop/setup-zig@v1 with: - version: "0.11.0-dev.1898+1a4a0b5e9" + version: "0.11.0-dev.2777+b95cdf0ae" - run: zig version - run: zig env diff --git a/README.md b/README.md index d30bf78e25864ef041b345a56633824b0032c2f5..dd110ae5c2713c61ac60e66af6b04e929812c802 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A package manager for the Zig programming language. - https://github.com/nektro/zigmod/releases ## Built With -- Zig master (at least `0.11.0-dev.1898+1a4a0b5e9`) +- Zig master (at least `0.11.0-dev.2777+b95cdf0ae`) - See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock) ### Build from Source diff --git a/build.zig b/build.zig index ec53764245ebb95f69a5320a2845e752de735d8e..4f743d382dd2914dd9e75495edd28eb32f99df0f 100644 --- a/build.zig +++ b/build.zig @@ -4,7 +4,6 @@ const builtin = @import("builtin"); const deps = @import("./deps.zig"); pub fn build(b: *std.build.Builder) void { - b.prominent_compile_errors = true; const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const use_full_name = b.option(bool, "use-full-name", "") orelse false; @@ -17,9 +16,9 @@ pub fn build(b: *std.build.Builder) void { exe_options.addOption(string, "version", b.option(string, "tag", "") orelse "dev"); deps.addAllTo(exe); - exe.install(); + b.installArtifact(exe); - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); diff --git a/deps.zig b/deps.zig index 305ddb0909cdc4f5d481a2e9403588634bedd19f..50ded8fb04a03cfa6ff1281ea1c7d7faab6b045b 100644 --- a/deps.zig +++ b/deps.zig @@ -13,7 +13,12 @@ pub const GitExactStep = struct { pub fn create(b: *std.build.Builder, url: string, commit: string) *GitExactStep { var result = b.allocator.create(GitExactStep) catch @panic("memory"); result.* = GitExactStep{ - .step = std.build.Step.init(.custom, b.fmt("git clone {s} @ {s}", .{ url, commit }), b.allocator, make), + .step = std.build.Step.init(.{ + .id = .custom, + .name = b.fmt("git clone {s} @ {s}", .{ url, commit }), + .owner = b, + .makeFn = make, + }), .builder = b, .url = url, .commit = commit, @@ -36,13 +41,14 @@ pub const GitExactStep = struct { return result; } - fn make(step: *std.build.Step) !void { + fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void { _ = step; + _ = prog_node; } }; pub fn fetch(exe: *std.build.LibExeObjStep) void { - const b = exe.builder; + const b = exe.step.owner; inline for (comptime std.meta.declarations(package_data)) |decl| { const path = &@field(package_data, decl.name).entry; const root = if (@field(package_data, decl.name).store) |_| b.cache_root.path.? else "."; @@ -84,7 +90,7 @@ fn flip(foo: anytype) !void { pub fn addAllTo(exe: *std.build.LibExeObjStep) void { checkMinZig(builtin.zig_version, exe); fetch(exe); - const b = exe.builder; + const b = exe.step.owner; @setEvalBranchQuota(1_000_000); for (packages) |pkg| { const moddep = pkg.zp(b); @@ -100,7 +106,7 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void { llc = true; } for (pkg.frameworks) |item| { - if (!builtin.target.isDarwin()) @panic(exe.builder.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item})); + if (!builtin.target.isDarwin()) @panic(exe.step.owner.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item})); exe.linkFramework(item); llc = true; } @@ -152,8 +158,8 @@ pub const Package = struct { }; fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void { - const min = std.SemanticVersion.parse("0.11.0-dev.1681+0bb178bbb") catch return; - if (current.order(min).compare(.lt)) @panic(exe.builder.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{current, min})); + const min = std.SemanticVersion.parse("0.11.0-dev.2777+b95cdf0ae") catch return; + 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})); } pub const package_data = struct { diff --git a/docs/README.md b/docs/README.md index bd5c85ee3b4ddd167a0cf2f4104e302577b39f0c..22ae38aefce569fb47756262eb9a1fc7197e93f6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,7 +10,7 @@ The rest of this documentation will assume you already have Zig installed. As 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. -The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.1898+1a4a0b5e9`. +The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.2777+b95cdf0ae`. ## Download You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source. diff --git a/src/cmd/fetch.zig b/src/cmd/fetch.zig index e891a005e432a2f8cd3950e996c4aa13a0748366..d2b384ed536cd42c2cc1157f5a6f71b6c7f4c0d3 100644 --- a/src/cmd/fetch.zig +++ b/src/cmd/fetch.zig @@ -49,7 +49,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D try w.writeAll( \\pub fn addAllTo(exe: *std.build.LibExeObjStep) void { \\ checkMinZig(builtin.zig_version, exe); - \\ const b = exe.builder; + \\ const b = exe.step.owner; \\ @setEvalBranchQuota(1_000_000); \\ for (packages) |pkg| { \\ const moddep = pkg.zp(b); @@ -64,7 +64,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\ llc = true; \\ } \\ for (pkg.frameworks) |item| { - \\ if (!builtin.target.isDarwin()) @panic(exe.builder.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item})); + \\ if (!builtin.target.isDarwin()) @panic(b.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item})); \\ exe.linkFramework(item); \\ llc = true; \\ } @@ -126,7 +126,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D try w.print( \\fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {{ \\ const min = std.SemanticVersion.parse("{?}") catch return; - \\ if (current.order(min).compare(.lt)) @panic(exe.builder.fmt("Your Zig version v{{}} does not meet the minimum build requirement of v{{}}", .{{current, min}})); + \\ 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}})); \\}} \\ \\ diff --git a/src/cmd/generate.zig b/src/cmd/generate.zig index 7316510a847dc1a9310ac174f0657a9e4f106c2f..bfa359b8af766a25ae2b797d8e29937285abaa6a 100644 --- a/src/cmd/generate.zig +++ b/src/cmd/generate.zig @@ -52,7 +52,12 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\ pub fn create(b: *std.build.Builder, url: string, commit: string) *GitExactStep { \\ var result = b.allocator.create(GitExactStep) catch @panic("memory"); \\ result.* = GitExactStep{ - \\ .step = std.build.Step.init(.custom, b.fmt("git clone {s} @ {s}", .{ url, commit }), b.allocator, make), + \\ .step = std.build.Step.init(.{ + \\ .id = .custom, + \\ .name = b.fmt("git clone {s} @ {s}", .{ url, commit }), + \\ .owner = b, + \\ .makeFn = make, + \\ }), \\ .builder = b, \\ .url = url, \\ .commit = commit, @@ -77,13 +82,14 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\ return result; \\ } \\ - \\ fn make(step: *std.build.Step) !void { + \\ fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void { \\ _ = step; + \\ _ = prog_node; \\ } \\}; \\ \\pub fn fetch(exe: *std.build.LibExeObjStep) void { - \\ const b = exe.builder; + \\ const b = exe.step.owner; \\ inline for (comptime std.meta.declarations(package_data)) |decl| { \\ const path = &@field(package_data, decl.name).entry; \\ const root = if (@field(package_data, decl.name).store) |_| b.cache_root.path.? else "."; @@ -119,7 +125,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\pub fn addAllTo(exe: *std.build.LibExeObjStep) void { \\ checkMinZig(builtin.zig_version, exe); \\ fetch(exe); - \\ const b = exe.builder; + \\ const b = exe.step.owner; \\ @setEvalBranchQuota(1_000_000); \\ for (packages) |pkg| { \\ const moddep = pkg.zp(b); @@ -135,7 +141,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D \\ llc = true; \\ } \\ for (pkg.frameworks) |item| { - \\ if (!builtin.target.isDarwin()) @panic(exe.builder.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item})); + \\ if (!builtin.target.isDarwin()) @panic(exe.step.owner.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item})); \\ exe.linkFramework(item); \\ llc = true; \\ } @@ -192,7 +198,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D try w.print( \\fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {{ \\ const min = std.SemanticVersion.parse("{?}") catch return; - \\ if (current.order(min).compare(.lt)) @panic(exe.builder.fmt("Your Zig version v{{}} does not meet the minimum build requirement of v{{}}", .{{current, min}})); + \\ 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}})); \\}} \\ \\ diff --git a/zig.mod b/zig.mod index 1f0b5d4ddc35d57d0c92f1e2e65004c963854341..a10df22f566013e304e51de798f2d309a94fec6b 100644 --- a/zig.mod +++ b/zig.mod @@ -3,7 +3,7 @@ name: zigmod main: src/lib.zig license: MIT description: A package manager for the Zig programming language. -min_zig_version: 0.11.0-dev.1898+1a4a0b5e9 +min_zig_version: 0.11.0-dev.2777+b95cdf0ae dependencies: - src: git https://github.com/nektro/zig-yaml - src: git https://github.com/nektro/zig-ansi -- 2.54.0