From 3082f4766486f3726c9431cc0b2f3d86456769bb Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Mon, 1 Jun 2026 18:21:23 -0700 Subject: [PATCH] update to zig 0.15.2 --- .github/workflows/push.yml | 2 +- README.md | 2 +- __snapshots__/explain.dot.txt | 26 +++--- __snapshots__/explain.mermaid.txt | 26 +++--- __snapshots__/explain.tree.txt | 89 +++++------------- build.zig | 11 ++- deps.zig | 149 +++++++++++++++--------------- docs/README.md | 2 +- docs/commands/install.md | 2 +- licenses.txt | 3 - src/cmd/ci.zig | 2 +- src/cmd/explain.zig | 11 +-- src/cmd/fetch.zig | 21 +++-- src/cmd/generate.zig | 22 +++-- src/cmd/init.zig | 4 +- src/cmd/install.zig | 17 +++- src/cmd/license.zig | 2 +- src/cmd/sum.zig | 2 +- src/cmd/version.zig | 4 +- src/cmd/zpm.zig | 19 ++-- src/cmd/zpm/add.zig | 24 +++-- src/cmd/zpm/search.zig | 3 +- src/cmd/zpm/showjson.zig | 3 +- src/cmd/zpm/tags.zig | 3 +- src/common.zig | 14 +-- src/main.zig | 7 +- src/util/funcs.zig | 7 +- src/util/modfile.zig | 2 +- src/util/module.zig | 4 +- zig.mod | 5 +- zigmod.lock | 38 ++++---- 31 files changed, 252 insertions(+), 274 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 1f747029252ebf020392612f4675e5e0a211aff8..25c648b6c942bd3820a0f9dd831290df4855adbf 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -20,7 +20,7 @@ jobs: uses: mlugg/setup-zig@v2 with: mirror: "http://mirrors.nektro.net/s3cgi" - version: "0.14.1" + version: "0.15.2" - run: zig version - run: zig env diff --git a/README.md b/README.md index 44cee4eb8e6c36d3305b6a5107fd56c1e406d507..8b3563671016fe0d3dccee84574e0049881f6b22 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ A package manager for the Zig programming language. ## Built With -- Zig `0.14.1` +- Zig `0.15.2` - See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock) ### Build from Source diff --git a/__snapshots__/explain.dot.txt b/__snapshots__/explain.dot.txt index ead825753c9f207f7c938dac3d2b255bd03b1c2b..64dba8900e7badd6d62d227bbba4bf8fb8f616e1 100644 --- a/__snapshots__/explain.dot.txt +++ b/__snapshots__/explain.dot.txt @@ -4,6 +4,7 @@ digraph { "root" -> "extras"; "root" -> "ansi"; "root" -> "nio"; + "root" -> "nfs"; "zigmod" -> "yaml"; "zigmod" -> "ansi"; "zigmod" -> "known-folders"; @@ -19,17 +20,7 @@ digraph { "zigmod" -> "nfs"; "detect-license" -> "licenses-text"; "detect-license" -> "leven"; - "licenses-text" -> "json"; - "json" -> "extras"; - "json" -> "tracer"; - "json" -> "intrusive-parser"; - "json" -> "nio"; - "tracer" -> "extras"; - "tracer" -> "sys-linux"; - "tracer" -> "nfs"; - "tracer" -> "nio"; - "tracer" -> "time"; - "sys-linux" -> "c"; + "detect-license" -> "nfs"; "nfs" -> "sys-linux"; "nfs" -> "nio"; "nfs" -> "time"; @@ -40,12 +31,21 @@ digraph { "time" -> "extras"; "time" -> "sys-linux"; "time" -> "sys-darwin"; - "intrusive-parser" -> "extras"; - "intrusive-parser" -> "nio"; "inquirer" -> "ansi"; "git" -> "time"; "git" -> "extras"; "git" -> "tracer"; "git" -> "nfs"; "git" -> "nio"; + "tracer" -> "extras"; + "tracer" -> "sys-linux"; + "tracer" -> "nfs"; + "tracer" -> "nio"; + "tracer" -> "time"; + "json" -> "extras"; + "json" -> "tracer"; + "json" -> "intrusive-parser"; + "json" -> "nio"; + "intrusive-parser" -> "extras"; + "intrusive-parser" -> "nio"; } diff --git a/__snapshots__/explain.mermaid.txt b/__snapshots__/explain.mermaid.txt index 0f3a597b42273d425b024dab46412c91dffd661b..abe22b43e9df31bbae6bc524d3deeb14acf28722 100644 --- a/__snapshots__/explain.mermaid.txt +++ b/__snapshots__/explain.mermaid.txt @@ -4,6 +4,7 @@ graph TD; root-->extras; root-->ansi; root-->nio; + root-->nfs; zigmod-->yaml; zigmod-->ansi; zigmod-->known-folders; @@ -19,17 +20,7 @@ graph TD; zigmod-->nfs; detect-license-->licenses-text; detect-license-->leven; - licenses-text-->json; - json-->extras; - json-->tracer; - json-->intrusive-parser; - json-->nio; - tracer-->extras; - tracer-->sys-linux; - tracer-->nfs; - tracer-->nio; - tracer-->time; - sys-linux-->c; + detect-license-->nfs; nfs-->sys-linux; nfs-->nio; nfs-->time; @@ -40,11 +31,20 @@ graph TD; time-->extras; time-->sys-linux; time-->sys-darwin; - intrusive-parser-->extras; - intrusive-parser-->nio; inquirer-->ansi; git-->time; git-->extras; git-->tracer; git-->nfs; git-->nio; + tracer-->extras; + tracer-->sys-linux; + tracer-->nfs; + tracer-->nio; + tracer-->time; + json-->extras; + json-->tracer; + json-->intrusive-parser; + json-->nio; + intrusive-parser-->extras; + intrusive-parser-->nio; diff --git a/__snapshots__/explain.tree.txt b/__snapshots__/explain.tree.txt index bead3c66321d8cc8d979323c766133fda3025e7f..a732f7a4201c3733a1a002728d6221d36910f203 100644 --- a/__snapshots__/explain.tree.txt +++ b/__snapshots__/explain.tree.txt @@ -7,110 +7,67 @@ root licenses detect-license licenses-text - json - extras - tracer - extras - sys-linux - c - nfs - sys-linux - c - nio - sys-linux - c - extras - sys-darwin - time - extras - sys-linux - c - sys-darwin - sys-darwin - nio - sys-linux - c - extras - sys-darwin - time - extras - sys-linux - c - sys-darwin - intrusive-parser - extras - nio - sys-linux - c - extras - sys-darwin - nio - sys-linux - c - extras - sys-darwin leven + nfs + sys-linux + nio + sys-linux + extras + sys-darwin + time + extras + sys-linux + sys-darwin + sys-darwin inquirer ansi ini time extras sys-linux - c sys-darwin extras git time extras sys-linux - c sys-darwin extras tracer extras sys-linux - c nfs sys-linux - c nio sys-linux - c extras sys-darwin time extras sys-linux - c sys-darwin sys-darwin nio sys-linux - c extras sys-darwin time extras sys-linux - c sys-darwin nfs sys-linux - c nio sys-linux - c extras sys-darwin time extras sys-linux - c sys-darwin sys-darwin nio sys-linux - c extras sys-darwin @@ -119,60 +76,48 @@ root tracer extras sys-linux - c nfs sys-linux - c nio sys-linux - c extras sys-darwin time extras sys-linux - c sys-darwin sys-darwin nio sys-linux - c extras sys-darwin time extras sys-linux - c sys-darwin intrusive-parser extras nio sys-linux - c extras sys-darwin nio sys-linux - c extras sys-darwin nio sys-linux - c extras sys-darwin nfs sys-linux - c nio sys-linux - c extras sys-darwin time extras sys-linux - c sys-darwin sys-darwin win32 @@ -180,6 +125,16 @@ root ansi nio sys-linux - c extras sys-darwin + nfs + sys-linux + nio + sys-linux + extras + sys-darwin + time + extras + sys-linux + sys-darwin + sys-darwin diff --git a/build.zig b/build.zig index 43d6f6ea0759e9b2b402d328a40c2a9c29b2f42f..94c0812d4d7794ea4a917df76584095f3dfb88fe 100644 --- a/build.zig +++ b/build.zig @@ -7,15 +7,17 @@ pub fn build(b: *std.Build) void { b.reference_trace = 256; const target = b.standardTargetOptions(.{}); - const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug; + const mode = b.option(std.builtin.OptimizeMode, "mode", "") orelse .Debug; const use_full_name = b.option(bool, "use-full-name", "") orelse false; const with_arch_os = b.fmt("-{s}-{s}", .{ @tagName(target.result.cpu.arch), @tagName(target.result.os.tag) }); const exe_name = b.fmt("{s}{s}", .{ "zigmod", if (use_full_name) with_arch_os else "" }); const exe = b.addExecutable(.{ .name = exe_name, - .root_source_file = b.path("src/main.zig"), - .target = target, - .optimize = mode, + .root_module = b.createModule(.{ + .root_source_file = b.path("src/main.zig"), + .target = target, + .optimize = mode, + }), }); const tag = b.option(string, "tag", ""); const strip = b.option(bool, "strip", "Build without debug info.") orelse false; @@ -27,6 +29,7 @@ pub fn build(b: *std.Build) void { exe_options.addOption(string, "version", tag orelse std.mem.trimRight(u8, b.run(&.{ "git", "describe", "--tags" }), "\n")); deps.addAllTo(exe); + exe.linkLibC(); exe.root_module.strip = strip; // exe.use_llvm = !disable_llvm; // exe.use_lld = !disable_llvm; diff --git a/deps.zig b/deps.zig index ef094042867e85903908698e81fbb46345e69a27..d83e8adcfdba135f1a93864aa8d6a9ce45734e6a 100644 --- a/deps.zig +++ b/deps.zig @@ -55,27 +55,27 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step { if (path.* != null) path.* = b.fmt("{s}/zigmod/deps{s}", .{ root, path.*.? }); } step.dependOn(&GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "ec98bb4d9eea532320a8551720a9e3ec6de64994").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "ab427a4de4f875eaa39ee56a29114fc020431546").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "5f89211a749aef6bf518889c0467ceb24825c055").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "a1a066da88dab50873a56f0349dc12dc76542077").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "0cf756c80a4bc1b0459bc81bf8071891f12c3738").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-git", "2b3f83cd341764f979969603e4f77e62f353b6a3").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "4cddefa42744d61067567b0b36b5d2bb376e5ae3").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-intrusive-parser", "a31b480914d15f3d13cdfb586aac950c73beebdd").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-json", "fb918b08846233573467f5df41fcc3b733155663").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "618eddde4ffbc6d34100e4bc6aa654d41161537a").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "16cef5e32b3f8bbcf1064c599615290a720b6547").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "ba0f00dfb23d28c301e4b54d0a278def2c38dc7b").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nfs", "6743e4e3b03cd3e8175a11f328e530edd054f2f1").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nio", "72fb20a7c5f6f466ced5c3bc731864ee69bc7682").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-darwin", "c8ef1a85dfb5e1891454650f88d56bfaa0834304").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-linux", "7c161d74c77ef9d482bb71273163fd454674240b").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "0f4db4c980146e4a3fc86a9a9070452a25ff9317").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "3a5fdea4ffd387a53ac2a42fb503557cdbe20696").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "c20de5ff5a7211007b57f8ae8914319debb473c4").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "e229c738bbf5cf0d5464bf9178c17813069a7028").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "d1c2ebf3f6c9b0d3aaa74a123d2f0a5657242431").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "e8ea5d969e1062d0be161f7a70e293b52aebc3f3").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "2cb1b3d619b10f4ad2c870f0359adb0c6129ca67").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-git", "8fdfc351842785192cad01aead798d85e25d1a48").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "3270255ea4c6d919853527e6a73baecfdee6867d").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-intrusive-parser", "c21ce202c557a710fba6a2333f33bee7bbea114c").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-json", "27d7354d9dc44982f1de40706721aee7d9c998a5").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "d97ef94cacf5c109b7f4b9e01a7e6645d8c8e09a").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "f0a95c802d6f955f131dae121550b2ec0acb97ff").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "88dc9ae4c338c652dc231ea477b8e0b56ac36743").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nfs", "4c6b77b141abab5f6ac70ea712521f062b54df65").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nio", "42f22d588059efa1e212f97402e94d81d675f28d").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-darwin", "3565d27455bd6c9f4650ea691cf4de47f9d229e7").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-linux", "3f07f214aac54bcf8f84975a2312cd91ac67fa04").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "c05c69b92a00b1afd07cb193f5069250e34ce488").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "afa0f6df50960f3772b4e0b311ff86521da3e6d5").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "fbf3642e7a9e354e2f48751b69ae1c41c0d7b062").step); step.dependOn(&GitExactStep.create(b, "https://github.com/madler/zlib", "da607da739fa6047df13e66a2af6b8bec7c2a498").step); step.dependOn(&GitExactStep.create(b, "https://github.com/yaml/libyaml", "2c891fc7a770e8ba2fec34fc6b545c672beb37e6").step); - step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "aa24df42183ad415d10bc0a33e6238c437fc0f59").step); + step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "83d39161eac2ed6f37ad3cb4d9dd518696ce90bb").step); return step; } @@ -126,10 +126,13 @@ pub const Package = struct { .target = exe.root_module.resolved_target, }); const target = result.resolved_target.?.result; - const dummy_library = b.addStaticLibrary(.{ + const dummy_library = b.addLibrary(.{ + .linkage = .static, .name = b.fmt("dummy-{s}", .{self.name}), - .target = exe.root_module.resolved_target orelse b.graph.host, - .optimize = exe.root_module.optimize.?, + .root_module = b.createModule(.{ + .target = exe.root_module.resolved_target orelse b.graph.host, + .optimize = exe.root_module.optimize.?, + }), }); dummy_library.step.dependOn(fetch_step); var links: u32 = 0; @@ -145,6 +148,7 @@ pub const Package = struct { switch (jtem) { .path => result.addIncludePath(jtem.path), .path_system, .path_after, .framework_path, .framework_path_system, .other_step, .config_header_step => {}, + .embed_path => {}, } } } @@ -159,7 +163,7 @@ pub const Package = struct { links += 1; } for (self.system_libs) |item| { - if (std.zig.target.isLibCLibName(target, item)) continue; + if (std.zig.target.isLibCLibName(&target, item)) continue; dummy_library.linkSystemLibrary(item); links += 1; } @@ -181,8 +185,8 @@ pub const Package = struct { }; fn checkMinZig(current: std.SemanticVersion, exe: *std.Build.Step.Compile) void { - const min = std.SemanticVersion.parse("0.14.1") 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})); + const min = std.SemanticVersion.parse("0.15.2") catch return; + if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{f} does not meet the minimum build requirement of v{f}", .{current, min})); } pub const package_data = struct { @@ -192,106 +196,103 @@ pub const package_data = struct { .entry = "/git/github.com/marlersoft/zigwin32/ec98bb4d9eea532320a8551720a9e3ec6de64994/win32.zig", }; pub var _u7sysdckdymi = Package{ - .store = "/git/github.com/nektro/arqv-ini/ab427a4de4f875eaa39ee56a29114fc020431546", + .store = "/git/github.com/nektro/arqv-ini/e229c738bbf5cf0d5464bf9178c17813069a7028", .name = "ini", - .entry = "/git/github.com/nektro/arqv-ini/ab427a4de4f875eaa39ee56a29114fc020431546/src/ini.zig", + .entry = "/git/github.com/nektro/arqv-ini/e229c738bbf5cf0d5464bf9178c17813069a7028/src/ini.zig", }; pub var _s84v9o48ucb0 = Package{ - .store = "/git/github.com/nektro/zig-ansi/5f89211a749aef6bf518889c0467ceb24825c055", + .store = "/git/github.com/nektro/zig-ansi/d1c2ebf3f6c9b0d3aaa74a123d2f0a5657242431", .name = "ansi", - .entry = "/git/github.com/nektro/zig-ansi/5f89211a749aef6bf518889c0467ceb24825c055/src/lib.zig", + .entry = "/git/github.com/nektro/zig-ansi/d1c2ebf3f6c9b0d3aaa74a123d2f0a5657242431/src/lib.zig", }; pub var _f7dubzb7cyqe = Package{ - .store = "/git/github.com/nektro/zig-extras/0cf756c80a4bc1b0459bc81bf8071891f12c3738", + .store = "/git/github.com/nektro/zig-extras/2cb1b3d619b10f4ad2c870f0359adb0c6129ca67", .name = "extras", - .entry = "/git/github.com/nektro/zig-extras/0cf756c80a4bc1b0459bc81bf8071891f12c3738/src/lib.zig", + .entry = "/git/github.com/nektro/zig-extras/2cb1b3d619b10f4ad2c870f0359adb0c6129ca67/src/lib.zig", }; pub var _c1xirp1ota5p = Package{ - .store = "/git/github.com/nektro/zig-inquirer/4cddefa42744d61067567b0b36b5d2bb376e5ae3", + .store = "/git/github.com/nektro/zig-inquirer/3270255ea4c6d919853527e6a73baecfdee6867d", .name = "inquirer", - .entry = "/git/github.com/nektro/zig-inquirer/4cddefa42744d61067567b0b36b5d2bb376e5ae3/src/lib.zig", + .entry = "/git/github.com/nektro/zig-inquirer/3270255ea4c6d919853527e6a73baecfdee6867d/src/lib.zig", .deps = &[_]*Package{ &_s84v9o48ucb0 }, }; pub var _96h80ezrvj7i = Package{ - .store = "/git/github.com/nektro/zig-leven/618eddde4ffbc6d34100e4bc6aa654d41161537a", + .store = "/git/github.com/nektro/zig-leven/d97ef94cacf5c109b7f4b9e01a7e6645d8c8e09a", .name = "leven", - .entry = "/git/github.com/nektro/zig-leven/618eddde4ffbc6d34100e4bc6aa654d41161537a/src/lib.zig", + .entry = "/git/github.com/nektro/zig-leven/d97ef94cacf5c109b7f4b9e01a7e6645d8c8e09a/src/lib.zig", }; pub var _0npcrzfdlrvk = Package{ - .store = "/git/github.com/nektro/zig-licenses/16cef5e32b3f8bbcf1064c599615290a720b6547", + .store = "/git/github.com/nektro/zig-licenses/f0a95c802d6f955f131dae121550b2ec0acb97ff", .name = "licenses", - .entry = "/git/github.com/nektro/zig-licenses/16cef5e32b3f8bbcf1064c599615290a720b6547/src/lib.zig", + .entry = "/git/github.com/nektro/zig-licenses/f0a95c802d6f955f131dae121550b2ec0acb97ff/src/lib.zig", + }; + pub var _pt88y5d80m25 = Package{ + .store = "/git/github.com/nektro/zig-licenses-text/88dc9ae4c338c652dc231ea477b8e0b56ac36743", + .name = "licenses-text", + .entry = "/git/github.com/nektro/zig-licenses-text/88dc9ae4c338c652dc231ea477b8e0b56ac36743/src/lib.zig", }; pub var _73bukkeci2u6 = Package{ - .store = "/git/github.com/nektro/zig-sys-darwin/c8ef1a85dfb5e1891454650f88d56bfaa0834304", + .store = "/git/github.com/nektro/zig-sys-darwin/3565d27455bd6c9f4650ea691cf4de47f9d229e7", .name = "sys-darwin", - .entry = "/git/github.com/nektro/zig-sys-darwin/c8ef1a85dfb5e1891454650f88d56bfaa0834304/sys_darwin.zig", + .entry = "/git/github.com/nektro/zig-sys-darwin/3565d27455bd6c9f4650ea691cf4de47f9d229e7/sys_darwin.zig", }; pub var _h7tv7ayhffak = Package{ - .store = "/git/github.com/nektro/zig-sys-linux/7c161d74c77ef9d482bb71273163fd454674240b", + .store = "/git/github.com/nektro/zig-sys-linux/3f07f214aac54bcf8f84975a2312cd91ac67fa04", .name = "sys-linux", - .entry = "/git/github.com/nektro/zig-sys-linux/7c161d74c77ef9d482bb71273163fd454674240b/mod.zig", - .deps = &[_]*Package{ }, - .system_libs = &.{ "c" }, + .entry = "/git/github.com/nektro/zig-sys-linux/3f07f214aac54bcf8f84975a2312cd91ac67fa04/mod.zig", }; pub var _kscsl0145t7x = Package{ - .store = "/git/github.com/nektro/zig-nio/72fb20a7c5f6f466ced5c3bc731864ee69bc7682", + .store = "/git/github.com/nektro/zig-nio/42f22d588059efa1e212f97402e94d81d675f28d", .name = "nio", - .entry = "/git/github.com/nektro/zig-nio/72fb20a7c5f6f466ced5c3bc731864ee69bc7682/nio.zig", + .entry = "/git/github.com/nektro/zig-nio/42f22d588059efa1e212f97402e94d81d675f28d/nio.zig", .deps = &[_]*Package{ &_h7tv7ayhffak, &_f7dubzb7cyqe, &_73bukkeci2u6 }, }; pub var _7l3oxw6nqqws = Package{ - .store = "/git/github.com/nektro/zig-intrusive-parser/a31b480914d15f3d13cdfb586aac950c73beebdd", + .store = "/git/github.com/nektro/zig-intrusive-parser/c21ce202c557a710fba6a2333f33bee7bbea114c", .name = "intrusive-parser", - .entry = "/git/github.com/nektro/zig-intrusive-parser/a31b480914d15f3d13cdfb586aac950c73beebdd/intrusive_parser.zig", + .entry = "/git/github.com/nektro/zig-intrusive-parser/c21ce202c557a710fba6a2333f33bee7bbea114c/intrusive_parser.zig", .deps = &[_]*Package{ &_f7dubzb7cyqe, &_kscsl0145t7x }, }; pub var _iecwp4b3bsfm = Package{ - .store = "/git/github.com/nektro/zig-time/0f4db4c980146e4a3fc86a9a9070452a25ff9317", + .store = "/git/github.com/nektro/zig-time/c05c69b92a00b1afd07cb193f5069250e34ce488", .name = "time", - .entry = "/git/github.com/nektro/zig-time/0f4db4c980146e4a3fc86a9a9070452a25ff9317/time.zig", + .entry = "/git/github.com/nektro/zig-time/c05c69b92a00b1afd07cb193f5069250e34ce488/time.zig", .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_73bukkeci2u6 }, }; pub var _vph9l0hxpeze = Package{ - .store = "/git/github.com/nektro/zig-nfs/6743e4e3b03cd3e8175a11f328e530edd054f2f1", + .store = "/git/github.com/nektro/zig-nfs/4c6b77b141abab5f6ac70ea712521f062b54df65", .name = "nfs", - .entry = "/git/github.com/nektro/zig-nfs/6743e4e3b03cd3e8175a11f328e530edd054f2f1/nfs.zig", + .entry = "/git/github.com/nektro/zig-nfs/4c6b77b141abab5f6ac70ea712521f062b54df65/nfs.zig", .deps = &[_]*Package{ &_h7tv7ayhffak, &_kscsl0145t7x, &_iecwp4b3bsfm, &_73bukkeci2u6 }, }; + pub var _2ovav391ivak = Package{ + .store = "/git/github.com/nektro/zig-detect-license/e8ea5d969e1062d0be161f7a70e293b52aebc3f3", + .name = "detect-license", + .entry = "/git/github.com/nektro/zig-detect-license/e8ea5d969e1062d0be161f7a70e293b52aebc3f3/src/lib.zig", + .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i, &_vph9l0hxpeze }, + }; pub var _ede2wygpe1iy = Package{ - .store = "/git/github.com/nektro/zig-tracer/3a5fdea4ffd387a53ac2a42fb503557cdbe20696", + .store = "/git/github.com/nektro/zig-tracer/afa0f6df50960f3772b4e0b311ff86521da3e6d5", .name = "tracer", - .entry = "/git/github.com/nektro/zig-tracer/3a5fdea4ffd387a53ac2a42fb503557cdbe20696/src/mod.zig", + .entry = "/git/github.com/nektro/zig-tracer/afa0f6df50960f3772b4e0b311ff86521da3e6d5/src/mod.zig", .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_vph9l0hxpeze, &_kscsl0145t7x, &_iecwp4b3bsfm }, }; pub var _0k64oe2nuzvj = Package{ - .store = "/git/github.com/nektro/zig-git/2b3f83cd341764f979969603e4f77e62f353b6a3", + .store = "/git/github.com/nektro/zig-git/8fdfc351842785192cad01aead798d85e25d1a48", .name = "git", - .entry = "/git/github.com/nektro/zig-git/2b3f83cd341764f979969603e4f77e62f353b6a3/git.zig", + .entry = "/git/github.com/nektro/zig-git/8fdfc351842785192cad01aead798d85e25d1a48/git.zig", .deps = &[_]*Package{ &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_ede2wygpe1iy, &_vph9l0hxpeze, &_kscsl0145t7x, &_0e2d06bb494b }, }; pub var _ocmr9rtohgcc = Package{ - .store = "/git/github.com/nektro/zig-json/fb918b08846233573467f5df41fcc3b733155663", + .store = "/git/github.com/nektro/zig-json/27d7354d9dc44982f1de40706721aee7d9c998a5", .name = "json", - .entry = "/git/github.com/nektro/zig-json/fb918b08846233573467f5df41fcc3b733155663/json.zig", + .entry = "/git/github.com/nektro/zig-json/27d7354d9dc44982f1de40706721aee7d9c998a5/json.zig", .deps = &[_]*Package{ &_f7dubzb7cyqe, &_ede2wygpe1iy, &_7l3oxw6nqqws, &_kscsl0145t7x }, }; - pub var _pt88y5d80m25 = Package{ - .store = "/git/github.com/nektro/zig-licenses-text/ba0f00dfb23d28c301e4b54d0a278def2c38dc7b", - .name = "licenses-text", - .entry = "/git/github.com/nektro/zig-licenses-text/ba0f00dfb23d28c301e4b54d0a278def2c38dc7b/src/lib.zig", - .deps = &[_]*Package{ &_ocmr9rtohgcc }, - }; - pub var _2ovav391ivak = Package{ - .store = "/git/github.com/nektro/zig-detect-license/a1a066da88dab50873a56f0349dc12dc76542077", - .name = "detect-license", - .entry = "/git/github.com/nektro/zig-detect-license/a1a066da88dab50873a56f0349dc12dc76542077/src/lib.zig", - .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i }, - }; pub var _g982zq6e8wsv = Package{ - .store = "/git/github.com/nektro/zig-yaml/c20de5ff5a7211007b57f8ae8914319debb473c4", + .store = "/git/github.com/nektro/zig-yaml/fbf3642e7a9e354e2f48751b69ae1c41c0d7b062", .name = "yaml", - .entry = "/git/github.com/nektro/zig-yaml/c20de5ff5a7211007b57f8ae8914319debb473c4/yaml.zig", + .entry = "/git/github.com/nektro/zig-yaml/fbf3642e7a9e354e2f48751b69ae1c41c0d7b062/yaml.zig", .deps = &[_]*Package{ &_8mdbh0zuneb0 }, }; pub var _0e2d06bb494b = Package{ @@ -307,9 +308,9 @@ pub const package_data = struct { .c_source_flags = &.{ "-DYAML_VERSION_MAJOR=0", "-DYAML_VERSION_MINOR=2", "-DYAML_VERSION_PATCH=5", "-DYAML_VERSION_STRING=\"0.2.5\"", "-DYAML_DECLARE_STATIC=1" }, }; pub var _2ta738wrqbaq = Package{ - .store = "/git/github.com/ziglibs/known-folders/aa24df42183ad415d10bc0a33e6238c437fc0f59", + .store = "/git/github.com/ziglibs/known-folders/83d39161eac2ed6f37ad3cb4d9dd518696ce90bb", .name = "known-folders", - .entry = "/git/github.com/ziglibs/known-folders/aa24df42183ad415d10bc0a33e6238c437fc0f59/known-folders.zig", + .entry = "/git/github.com/ziglibs/known-folders/83d39161eac2ed6f37ad3cb4d9dd518696ce90bb/known-folders.zig", }; pub var _89ujp8gq842x = Package{ .name = "zigmod", @@ -326,6 +327,7 @@ pub const packages = [_]*Package{ &package_data._f7dubzb7cyqe, &package_data._s84v9o48ucb0, &package_data._kscsl0145t7x, + &package_data._vph9l0hxpeze, }; pub const pkgs = struct { @@ -334,6 +336,7 @@ pub const pkgs = struct { pub const extras = &package_data._f7dubzb7cyqe; pub const ansi = &package_data._s84v9o48ucb0; pub const nio = &package_data._kscsl0145t7x; + pub const nfs = &package_data._vph9l0hxpeze; }; pub const imports = struct { diff --git a/docs/README.md b/docs/README.md index c53da759100bbff2d25d0216a4ce1c8c5b6d2001..85c11da2659f6a7b109b85ee4e5b5f0ea5b11257 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.14.1`. +The earliest Zig release this Zigmod was verified to work with is `0.15.2`. ## Download You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source. diff --git a/docs/commands/install.md b/docs/commands/install.md index 29b12405590b30aa6dd00e330e5cfa67b2114ba8..e33ec2e868c9bdcd2c2fffee0a7a9761c1ff4dad 100644 --- a/docs/commands/install.md +++ b/docs/commands/install.md @@ -22,6 +22,6 @@ zigmod install [git|hg|http] [url] ``` $ zigmod install git https://github.com/nektro/zigmod debug: modpath: /home/me/.cache/zigmod/deps/git/github.com/nektro/zigmod -debug: argv: { /home/me/.local/share/zig/0.14.1/zig, build, --prefix, /home/me/.zigmod } +debug: argv: { /home/me/.local/share/zig/0.15.2/zig, build, --prefix, /home/me/.zigmod } info: success! ``` diff --git a/licenses.txt b/licenses.txt index b03619ed05d999eb05a733931645a7804d16aaeb..51e232a781046fb1c51114e1633ff230b1de9b5a 100644 --- a/licenses.txt +++ b/licenses.txt @@ -29,6 +29,3 @@ MPL-2.0: Zlib: = https://spdx.org/licenses/Zlib - git https://github.com/madler/zlib - -Unspecified: -- system_lib c diff --git a/src/cmd/ci.zig b/src/cmd/ci.zig index 3a97b06288f65b9a9eedcd758988abefee9f60a6..87df53204c6e053f44ce109846af7986df0b07ee 100644 --- a/src/cmd/ci.zig +++ b/src/cmd/ci.zig @@ -28,7 +28,7 @@ pub fn do(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nfs.Dir) !void }; const top_module = try common.collect_deps_deep(cachepath, dir, &options); - var list = std.ArrayList(zigmod.Module).init(alloc); + var list = std.array_list.Managed(zigmod.Module).init(alloc); try common.collect_pkgs(top_module, &list); const fetch = @import("./fetch.zig"); diff --git a/src/cmd/explain.zig b/src/cmd/explain.zig index 7d9e3154989c0d67617ddefc71d31b31581e9766..8fae7a04d227357df01bedd87d15946b6b60c3a2 100644 --- a/src/cmd/explain.zig +++ b/src/cmd/explain.zig @@ -34,11 +34,10 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { }; const top_module = try common.collect_deps_deep(cachepath, dir, &options); - var seencache = std.ArrayList([48]u8).init(gpa); + var seencache = std.array_list.Managed([48]u8).init(gpa); defer seencache.deinit(); - const stdout = std.io.getStdOut(); - const w = stdout.writer(); + const w = nfs.stdout(); switch (format) { .tree => { @@ -59,14 +58,14 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { fn printTree(writer: anytype, module: zigmod.Module, depth: u16) !void { try writer.writeByteNTimes('\t', depth); try writer.writeAll(module.name); - try writer.writeByte('\n'); + try writer.writeAll("\n"); for (module.deps) |dep| { try printTree(writer, dep, depth + 1); } } -fn printMermaid(writer: anytype, module: zigmod.Module, seencache: *std.ArrayList([48]u8)) !void { +fn printMermaid(writer: anytype, module: zigmod.Module, seencache: *std.array_list.Managed([48]u8)) !void { for (seencache.items) |item| { if (std.mem.eql(u8, &module.id, &item)) { return; @@ -83,7 +82,7 @@ fn printMermaid(writer: anytype, module: zigmod.Module, seencache: *std.ArrayLis } } -fn printDot(writer: anytype, module: zigmod.Module, seencache: *std.ArrayList([48]u8)) !void { +fn printDot(writer: anytype, module: zigmod.Module, seencache: *std.array_list.Managed([48]u8)) !void { for (seencache.items) |item| { if (std.mem.eql(u8, &module.id, &item)) { return; diff --git a/src/cmd/fetch.zig b/src/cmd/fetch.zig index 9a13aa816c92b8051c313a92970807479f397add..0970f58207f8886d9cf97514d7c0d8f1e066e939 100644 --- a/src/cmd/fetch.zig +++ b/src/cmd/fetch.zig @@ -27,7 +27,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { }; const top_module = try common.collect_deps_deep(cachepath, dir, &options); - var list = std.ArrayList(zigmod.Module).init(gpa); + var list = std.array_list.Managed(zigmod.Module).init(gpa); try common.collect_pkgs(top_module, &list); try create_depszig(gpa, cachepath, dir, top_module, &list); @@ -44,7 +44,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { try license.do(cachepath, dir, &options, outfile); } -pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: nfs.Dir, top_module: zigmod.Module, list: *std.ArrayList(zigmod.Module)) !void { +pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: nfs.Dir, top_module: zigmod.Module, list: *std.array_list.Managed(zigmod.Module)) !void { const f = try dir.createFile("deps.zig", .{}); defer f.close(); @@ -107,6 +107,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: nfs.Dir, \\ switch (jtem) { \\ .path => result.addIncludePath(jtem.path), \\ .path_system, .path_after, .framework_path, .framework_path_system, .other_step, .config_header_step => {}, + \\ .embed_path => {}, \\ } \\ } \\ } @@ -120,7 +121,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: nfs.Dir, \\ link_lib_c = true; \\ } \\ for (self.system_libs) |item| { - \\ if (skip_libc and std.zig.target.isLibCLibName(target, item)) continue; + \\ if (skip_libc and std.zig.target.isLibCLibName(&target, item)) continue; \\ result.linkSystemLibrary(item, .{}); \\ exe.linkSystemLibrary(item); \\ link_lib_c = true; @@ -145,7 +146,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: nfs.Dir, try w.print( \\fn checkMinZig(current: std.SemanticVersion, exe: *std.Build.Step.Compile) void {{ \\ const min = std.SemanticVersion.parse("{?}") 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}})); + \\ if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{{f}} does not meet the minimum build requirement of v{{f}}", .{{current, min}})); \\}} \\ \\ @@ -156,8 +157,8 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: nfs.Dir, try w.writeAll("};\n\n"); try w.writeAll("pub const package_data = struct {\n"); - var duped = std.ArrayList(zigmod.Module).init(alloc); - var done = std.ArrayList(zigmod.Module).init(alloc); + var duped = std.array_list.Managed(zigmod.Module).init(alloc); + var done = std.array_list.Managed(zigmod.Module).init(alloc); for (list.items) |mod| { if (mod.type == .system_lib or mod.type == .framework) { continue; @@ -180,7 +181,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: nfs.Dir, try w.writeAll("};\n"); } -fn create_lockfile(alloc: std.mem.Allocator, list: *std.ArrayList(zigmod.Module), path: string, dir: nfs.Dir) !void { +fn create_lockfile(alloc: std.mem.Allocator, list: *std.array_list.Managed(zigmod.Module), path: string, dir: nfs.Dir) !void { const fl = try dir.createFile("zigmod.lock", .{}); defer fl.close(); @@ -214,8 +215,8 @@ fn diff_lockfile(alloc: std.mem.Allocator) !void { if (std.mem.startsWith(u8, line, "@@")) break; } - var rems = std.ArrayList(string).init(alloc); - var adds = std.ArrayList(string).init(alloc); + var rems = std.array_list.Managed(string).init(alloc); + var adds = std.array_list.Managed(string).init(alloc); while (try r.readUntilDelimiterOrEofAlloc(alloc, '\n', max)) |line_full| { const line = line_full[0 .. line_full.len - 1]; if (line[0] == ' ') continue; @@ -322,7 +323,7 @@ fn print_deps(w: nfs.File, m: zigmod.Module) !void { try w.writeAll("}"); } -fn print_pkg_data_to(w: nfs.File, notdone: *std.ArrayList(zigmod.Module), done: *std.ArrayList(zigmod.Module)) !void { +fn print_pkg_data_to(w: nfs.File, notdone: *std.array_list.Managed(zigmod.Module), done: *std.array_list.Managed(zigmod.Module)) !void { var len: usize = notdone.items.len; while (notdone.items.len > 0) { for (notdone.items, 0..) |mod, i| { diff --git a/src/cmd/generate.zig b/src/cmd/generate.zig index 192fabb8d7630087c9d5f1aaee75b07097abf2c4..15b21bc104d606306c14b1e8d174bb07d1e5e32d 100644 --- a/src/cmd/generate.zig +++ b/src/cmd/generate.zig @@ -27,7 +27,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { }; const top_module = try common.collect_deps_deep(cachepath, dir, &options); - var list = std.ArrayList(zigmod.Module).init(gpa); + var list = std.array_list.Managed(zigmod.Module).init(gpa); try common.collect_pkgs(top_module, &list); std.mem.sort(zigmod.Module, list.items, {}, zigmod.Module.lessThan); @@ -162,10 +162,13 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf \\ .target = exe.root_module.resolved_target, \\ }); \\ const target = result.resolved_target.?.result; - \\ const dummy_library = b.addStaticLibrary(.{ + \\ const dummy_library = b.addLibrary(.{ + \\ .linkage = .static, \\ .name = b.fmt("dummy-{s}", .{self.name}), - \\ .target = exe.root_module.resolved_target orelse b.graph.host, - \\ .optimize = exe.root_module.optimize.?, + \\ .root_module = b.createModule(.{ + \\ .target = exe.root_module.resolved_target orelse b.graph.host, + \\ .optimize = exe.root_module.optimize.?, + \\ }), \\ }); \\ dummy_library.step.dependOn(fetch_step); \\ var links: u32 = 0; @@ -181,6 +184,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf \\ switch (jtem) { \\ .path => result.addIncludePath(jtem.path), \\ .path_system, .path_after, .framework_path, .framework_path_system, .other_step, .config_header_step => {}, + \\ .embed_path => {}, \\ } \\ } \\ } @@ -195,7 +199,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf \\ links += 1; \\ } \\ for (self.system_libs) |item| { - \\ if (std.zig.target.isLibCLibName(target, item)) continue; + \\ if (std.zig.target.isLibCLibName(&target, item)) continue; \\ dummy_library.linkSystemLibrary(item); \\ links += 1; \\ } @@ -222,15 +226,15 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf try w.print( \\fn checkMinZig(current: std.SemanticVersion, exe: *std.Build.Step.Compile) void {{ \\ const min = std.SemanticVersion.parse("{?}") 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}})); + \\ if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{{f}} does not meet the minimum build requirement of v{{f}}", .{{current, min}})); \\}} \\ \\ , .{if (top_module.minZigVersion()) |sv| u.altSemanticVersion(sv) else null}); try w.writeAll("pub const package_data = struct {\n"); - var duped = std.ArrayList(zigmod.Module).init(alloc); - var done = std.ArrayList(zigmod.Module).init(alloc); + var duped = std.array_list.Managed(zigmod.Module).init(alloc); + var done = std.array_list.Managed(zigmod.Module).init(alloc); for (list) |mod| { if (mod.type == .system_lib or mod.type == .framework) { continue; @@ -278,7 +282,7 @@ fn print_deps(w: nfs.File, m: zigmod.Module) !void { try w.writeAll("}"); } -fn print_pkg_data_to(w: nfs.File, alloc: std.mem.Allocator, cachepath: [:0]const u8, notdone: *std.ArrayList(zigmod.Module), done: *std.ArrayList(zigmod.Module), options: *common.CollectOptions) !void { +fn print_pkg_data_to(w: nfs.File, alloc: std.mem.Allocator, cachepath: [:0]const u8, notdone: *std.array_list.Managed(zigmod.Module), done: *std.array_list.Managed(zigmod.Module), options: *common.CollectOptions) !void { var len: usize = notdone.items.len; while (notdone.items.len > 0) { for (notdone.items, 0..) |mod, i| { diff --git a/src/cmd/init.zig b/src/cmd/init.zig index 07d13513b2efd637e3c340ff60aa1781e0947040..b0a3262080385e25530447507b2ea0f786902b53 100644 --- a/src/cmd/init.zig +++ b/src/cmd/init.zig @@ -45,7 +45,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { }) else null; const entry = if (entry_bare) |ent| try gpa.dupeZ(u8, ent) else null; - const maybe_license_text = try detectlicense.detectInDir(gpa, cwd.to_std()); + const maybe_license_text = try detectlicense.detectInDir(gpa, cwd); const license = try inquirer.forString(stdout, stdin, "license:", gpa, maybe_license_text); const description = try inquirer.forString(stdout, stdin, "description:", gpa, null); @@ -312,7 +312,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { }; const top_module = try common.collect_deps_deep(cachepath, dir, &options); - var list = std.ArrayList(zigmod.Module).init(alloc); + var list = std.array_list.Managed(zigmod.Module).init(alloc); try common.collect_pkgs(top_module, &list); const fetch = @import("./fetch.zig"); diff --git a/src/cmd/install.zig b/src/cmd/install.zig index 12ac3297f26dd4ee73e7095922e6770ae36602cf..47d0167d757a723882ee920cfa5ef514fa5ad983 100644 --- a/src/cmd/install.zig +++ b/src/cmd/install.zig @@ -73,7 +73,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { zigpath, "build", "--prefix", try std.fs.path.join(gpa, &.{ homepath, ".zigmod" }), }; - std.log.debug("argv: {s}", .{argv}); + logargv(argv) catch return; var proc = std.process.Child.init(argv, gpa); proc.cwd = modpath; const term = try proc.spawnAndWait(); @@ -85,3 +85,18 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { } std.log.info("success!", .{}); } + +// needed this after moving to zig 0.15 +// /zig/0.15.2/lib/std/Io/Writer.zig:1122:51: error: expected type '[]const u8', found '[]const []const u8' +fn logargv(argv: []const []const u8) !void { + var buffer: [64]u8 = undefined; + const stderr = std.debug.lockStderrWriter(&buffer); + defer std.debug.unlockStderrWriter(); + try stderr.writeAll("debug: argv: {"); + for (argv, 0..) |v, i| { + if (i > 0) try stderr.writeAll(","); + try stderr.writeAll(" "); + try stderr.writeAll(v); + } + try stderr.writeAll(" }\n"); +} diff --git a/src/cmd/license.zig b/src/cmd/license.zig index 6455b3b962382b3acb55433a54c6605e3a15da2d..3f8bc8b584710f4a77978402cb2db0137349c987 100644 --- a/src/cmd/license.zig +++ b/src/cmd/license.zig @@ -10,7 +10,7 @@ const zigmod = @import("../lib.zig"); const u = @import("./../util/funcs.zig"); const common = @import("./../common.zig"); -const List = std.ArrayList(zigmod.Module); +const List = std.array_list.Managed(zigmod.Module); const Map = std.StringArrayHashMap(*List); // Inspired by: diff --git a/src/cmd/sum.zig b/src/cmd/sum.zig index 6bab3665e5cafaa407c4a7d1f3505f743e97e651..e1765d21d325e57241414efd8ea7f4ad26ef86a7 100644 --- a/src/cmd/sum.zig +++ b/src/cmd/sum.zig @@ -29,7 +29,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { const w = f; // - var module_list = std.ArrayList(zigmod.Module).init(gpa); + var module_list = std.array_list.Managed(zigmod.Module).init(gpa); try common.collect_pkgs(top_module, &module_list); for (module_list.items) |m| { diff --git a/src/cmd/version.zig b/src/cmd/version.zig index cafb1f06ef7a3ead344a73fa316f054d32b0f99a..8dc9d4bb8cd16c90362759d4579e1a95a293d259 100644 --- a/src/cmd/version.zig +++ b/src/cmd/version.zig @@ -18,8 +18,8 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { var gitversion = u.git_rev_HEAD(gpa, nfs.cwd()) catch ""; gitversion = if (gitversion.len > 0) gitversion[0..9] else gitversion; - const stdout = std.io.getStdOut(); - const w = stdout.writer(); + const stdout = nfs.stdout(); + const w = stdout; try w.writeAll("zigmod"); diff --git a/src/cmd/zpm.zig b/src/cmd/zpm.zig index ba75ac38bc5a020e889b7f3fd254731998a5baa3..74c2ac6ddcb52f2d406ec581a28e703e497f5929 100644 --- a/src/cmd/zpm.zig +++ b/src/cmd/zpm.zig @@ -61,22 +61,21 @@ pub fn server_fetch(url: string) !json.Document { var client: std.http.Client = .{ .allocator = gpa }; defer client.deinit(); - var req = try client.open(.GET, try std.Uri.parse(url), .{ - .server_header_buffer = &buf, + var req = try client.request(.GET, try std.Uri.parse(url), .{ + .headers = .{ .accept_encoding = .{ .override = "identity" } }, }); defer req.deinit(); - try req.send(); - try req.finish(); - try req.wait(); - if (req.response.status != .ok) u.fail("expected: 200 from '{s}' got: {s}", .{ url, @tagName(req.response.status) }); - return json.parse(gpa, "", nio.AnyReadable.fromStd(&req.reader()), .{ .support_trailing_commas = true, .maximum_depth = 100 }); + try req.sendBodiless(); + var resp = try req.receiveHead(&.{}); + if (resp.head.status != .ok) u.fail("expected: 200 from '{s}' got: {s}", .{ url, @tagName(resp.head.status) }); + return json.parse(gpa, "", nio.AnyReadable.fromStd(resp.reader(&buf)), .{ .support_trailing_commas = true, .maximum_depth = 100 }); } pub fn server_fetchArray(url: string) ![]const Package { const doc = try server_fetch(url); doc.acquire(); defer doc.release(); - var list = std.ArrayList(Package).init(gpa); + var list = std.array_list.Managed(Package).init(gpa); errdefer list.deinit(); for (doc.root.array()) |item| { @@ -97,7 +96,7 @@ pub fn server_fetchArray(url: string) ![]const Package { } fn valueStrArray(vals: json.Array) ![]string { - var list = std.ArrayList(string).init(gpa); + var list = std.array_list.Managed(string).init(gpa); errdefer list.deinit(); for (vals) |item| { @@ -108,7 +107,7 @@ fn valueStrArray(vals: json.Array) ![]string { } fn valueLinks(vals: json.ObjectIndex) ![]string { - var list = std.ArrayList(string).init(gpa); + var list = std.array_list.Managed(string).init(gpa); errdefer list.deinit(); if (vals.getS("github")) |x| try list.append(x); diff --git a/src/cmd/zpm/add.zig b/src/cmd/zpm/add.zig index 25c638463aed6c401c428cafa68309f3d1579137..74ff03b4372660ab632fa22c920c77a08c28ced8 100644 --- a/src/cmd/zpm/add.zig +++ b/src/cmd/zpm/add.zig @@ -42,31 +42,29 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { } } - var buf: [4096]u8 = @splat(0); + // var buf: [4096]u8 = @splat(0); var client: std.http.Client = .{ .allocator = gpa }; defer client.deinit(); const has_zigdotmod = blk: { const _url = try std.mem.join(gpa, "/", &.{ found.git, "blob", "HEAD", "zig.mod" }); - var _req = try client.open(.GET, try std.Uri.parse(_url), .{ - .server_header_buffer = &buf, + var _req = try client.request(.GET, try std.Uri.parse(_url), .{ + .headers = .{ .accept_encoding = .{ .override = "identity" } }, }); defer _req.deinit(); - try _req.send(); - try _req.finish(); - try _req.wait(); - break :blk _req.response.status == .ok; + try _req.sendBodiless(); + const resp = try _req.receiveHead(&.{}); + break :blk resp.head.status == .ok; }; const has_zigmodyml = blk: { const _url = try std.mem.join(gpa, "/", &.{ found.git, "blob", "HEAD", "zigmod.yml" }); - var _req = try client.open(.GET, try std.Uri.parse(_url), .{ - .server_header_buffer = &buf, + var _req = try client.request(.GET, try std.Uri.parse(_url), .{ + .headers = .{ .accept_encoding = .{ .override = "identity" } }, }); defer _req.deinit(); - try _req.send(); - try _req.finish(); - try _req.wait(); - break :blk _req.response.status == .ok; + try _req.sendBodiless(); + const resp = try _req.receiveHead(&.{}); + break :blk resp.head.status == .ok; }; _, const file = try zigmod.ModFile.openFile(nfs.cwd(), .{ .mode = .read_write }); diff --git a/src/cmd/zpm/search.zig b/src/cmd/zpm/search.zig index 174d85c3bbade4e4568c42dd0279c38660f1f8db..a4a174358f853b2eb810cff1becc6d84d37b6cde 100644 --- a/src/cmd/zpm/search.zig +++ b/src/cmd/zpm/search.zig @@ -1,6 +1,7 @@ const std = @import("std"); const gpa = std.heap.c_allocator; const extras = @import("extras"); +const nfs = @import("nfs"); const zpm = @import("./../zpm.zig"); @@ -11,7 +12,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { _ = self_name; _ = args; - const out = std.io.getStdOut().writer(); + const out = nfs.stdout(); const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, "packages" }); const list = try zpm.server_fetchArray(url); diff --git a/src/cmd/zpm/showjson.zig b/src/cmd/zpm/showjson.zig index b6be07131f6d46e56055784c766464e3a1666415..9b3f89c84f494cc411f77b8380756909292cff2d 100644 --- a/src/cmd/zpm/showjson.zig +++ b/src/cmd/zpm/showjson.zig @@ -1,5 +1,6 @@ const std = @import("std"); const gpa = std.heap.c_allocator; +const nfs = @import("nfs"); const zpm = @import("./../zpm.zig"); @@ -9,7 +10,7 @@ const zpm = @import("./../zpm.zig"); pub fn execute(self_name: []const u8, args: [][:0]u8) !void { _ = self_name; - const out = std.io.getStdOut().writer(); + const out = nfs.stdout(); const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, args[0] }); const doc = try zpm.server_fetch(url); diff --git a/src/cmd/zpm/tags.zig b/src/cmd/zpm/tags.zig index 789d284445742517e6ef6d1c69d0ee25cb022100..e311084ccbb61ed84e2d72da9cc7a3ae308a636e 100644 --- a/src/cmd/zpm/tags.zig +++ b/src/cmd/zpm/tags.zig @@ -1,6 +1,7 @@ const std = @import("std"); const gpa = std.heap.c_allocator; const extras = @import("extras"); +const nfs = @import("nfs"); const zpm = @import("./../zpm.zig"); @@ -11,7 +12,7 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { _ = self_name; _ = args; - const out = std.io.getStdOut().writer(); + const out = nfs.stdout(); const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, "tags" }); const doc = try zpm.server_fetch(url); diff --git a/src/common.zig b/src/common.zig index 3da2f36439dca2ea15814e374ee96309cdb23a12..5378e7f69edff0688c8a5510f1984bd2c32107a9 100644 --- a/src/common.zig +++ b/src/common.zig @@ -19,11 +19,11 @@ pub const CollectOptions = struct { update: bool, lock: ?[]const [4]string = null, alloc: std.mem.Allocator, - already_fetched: *std.ArrayList(string) = undefined, + already_fetched: *std.array_list.Managed(string) = undefined, pub fn init(self: *CollectOptions) !void { - self.already_fetched = try self.alloc.create(std.ArrayList(string)); - self.already_fetched.* = std.ArrayList(string).init(self.alloc); + self.already_fetched = try self.alloc.create(std.array_list.Managed(string)); + self.already_fetched.* = std.array_list.Managed(string).init(self.alloc); } }; @@ -32,7 +32,7 @@ pub fn collect_deps_deep(cachepath: [:0]const u8, mdir: nfs.Dir, options: *Colle const m = try zigmod.ModFile.from_dir(options.alloc, mdir, "."); try options.init(); - var moduledeps = std.ArrayList(zigmod.Module).init(options.alloc); + var moduledeps = std.array_list.Managed(zigmod.Module).init(options.alloc); errdefer moduledeps.deinit(); if (m.root_files.len > 0) { try gen_files_package(options.alloc, cachepath, mdir, m.root_files); @@ -65,7 +65,7 @@ pub fn collect_deps(cachepath: [:0]const u8, mdir: nfs.Dir, mdir_path: string, d try nfs.cwd().makePath(cachepath); const m = try zigmod.ModFile.from_dir(options.alloc, mdir, mdir_path); - var moduledeps = std.ArrayList(zigmod.Module).init(options.alloc); + var moduledeps = std.array_list.Managed(zigmod.Module).init(options.alloc); errdefer moduledeps.deinit(); if (m.files.len > 0) { try gen_files_package(options.alloc, cachepath, mdir, m.files); @@ -91,7 +91,7 @@ pub fn collect_deps(cachepath: [:0]const u8, mdir: nfs.Dir, mdir_path: string, d }; } -pub fn collect_pkgs(mod: zigmod.Module, list: *std.ArrayList(zigmod.Module)) anyerror!void { +pub fn collect_pkgs(mod: zigmod.Module, list: *std.array_list.Managed(zigmod.Module)) anyerror!void { if (extras.containsAggregate(zigmod.Module, list.items, mod)) { return; } @@ -336,7 +336,7 @@ pub fn gen_files_package(alloc: std.mem.Allocator, cachepath: string, mdir: nfs. } pub fn parse_lockfile(alloc: std.mem.Allocator, dir: nfs.Dir) ![]const [4]string { - var list = std.ArrayList([4]string).init(alloc); + var list = std.array_list.Managed([4]string).init(alloc); const max = std.math.maxInt(usize); if (!try dir.exists("zigmod.lock")) return &[_][4]string{}; var f = try dir.openFile("zigmod.lock", .{}); diff --git a/src/main.zig b/src/main.zig index 9ed7b3d008c90be3ec3b74c02ea28fcc12f3dffe..6b743f4097aaa0a0f5044046268f71d218d52627 100644 --- a/src/main.zig +++ b/src/main.zig @@ -5,6 +5,7 @@ pub const build_options = @import("build_options"); const zigmod = @import("zigmod"); const win32 = @import("win32"); const nio = @import("nio"); +const nfs = @import("nfs"); // // @@ -56,7 +57,7 @@ pub fn main() !void { } } - var sub_cmd_args = std.ArrayList(string).init(gpa); + var sub_cmd_args = std.array_list.Managed(string).init(gpa); try sub_cmd_args.append(try nio.fmt.allocPrint(gpa, "zigmod-{s}", .{args[0]})); for (args[1..]) |item| { try sub_cmd_args.append(item); @@ -67,8 +68,8 @@ pub fn main() !void { fail("unknown command \"{s}\" for \"zigmod\"", .{args[0]}); }, }; - try std.io.getStdOut().writeAll(result.stdout); - try std.io.getStdErr().writeAll(result.stderr); + try nfs.stdout().writeAll(result.stdout); + try nfs.stderr().writeAll(result.stderr); } // diff --git a/src/util/funcs.zig b/src/util/funcs.zig index f8eb7a377386dabe56252197a0ef604daf65f903..4bdae6c10af6d2ebb16ee6b4a3edfdc5ae34d87b 100644 --- a/src/util/funcs.zig +++ b/src/util/funcs.zig @@ -34,7 +34,7 @@ pub fn try_index(comptime T: type, array: []const T, n: usize, def: T) T { } pub fn split(alloc: std.mem.Allocator, in: string, delim: u8) ![]string { - var list = std.ArrayList(string).init(alloc); + var list = std.array_list.Managed(string).init(alloc); errdefer list.deinit(); var iter = std.mem.splitScalar(u8, in, delim); @@ -47,7 +47,7 @@ pub fn split(alloc: std.mem.Allocator, in: string, delim: u8) ![]string { pub fn file_list(alloc: std.mem.Allocator, dpath: [:0]const u8) ![][:0]u8 { var dir = try nfs.cwd().openDir(dpath, .{}); defer dir.close(); - var list = std.ArrayList([:0]u8).init(alloc); + var list = std.array_list.Managed([:0]u8).init(alloc); errdefer list.deinit(); errdefer for (list.items) |x| alloc.free(x); var walker = try dir.walk(alloc); @@ -76,7 +76,7 @@ pub fn run_cmd(alloc: std.mem.Allocator, dir: ?string, args: []const string) !u3 } pub fn list_remove(alloc: std.mem.Allocator, input: []string, search: string) ![]string { - var list = std.ArrayList(string).init(alloc); + var list = std.array_list.Managed(string).init(alloc); errdefer list.deinit(); for (input) |item| { if (!std.mem.eql(u8, item, search)) { @@ -249,7 +249,6 @@ const StringEscape = struct { ' ', '!', '#'...'&', '('...'[', ']'...'~' => try writer.writeAll(&.{c}), else => { try writer.print("\\x{x:0>2}", .{c}); - // try writer.printInt(c, 16, .lower, .{ .width = 2, .fill = '0' }); }, }; } diff --git a/src/util/modfile.zig b/src/util/modfile.zig index d033cda8c874d1b010a67df45efcc03540e1a883..745f1e36becd3ecd9cd34c88d9410498ec0a48ff 100644 --- a/src/util/modfile.zig +++ b/src/util/modfile.zig @@ -95,7 +95,7 @@ pub const ModFile = struct { } fn dep_list_by_name(alloc: std.mem.Allocator, mapping: yaml.Mapping, props: []const string, for_build: bool) std.mem.Allocator.Error![]zigmod.Dep { - var dep_list = std.ArrayList(zigmod.Dep).init(alloc); + var dep_list = std.array_list.Managed(zigmod.Dep).init(alloc); errdefer dep_list.deinit(); for (props) |prop| { diff --git a/src/util/module.zig b/src/util/module.zig index 576b0f51bc27fb6a80a1231d07f3a32603c3c879..8ebf25fb2247308c201e00fe8e742062d40484b3 100644 --- a/src/util/module.zig +++ b/src/util/module.zig @@ -33,7 +33,7 @@ pub const Module = struct { pub const ROOT: [48]u8 = ("root" ++ (" " ** 44)).*; pub fn from(alloc: std.mem.Allocator, dep: zigmod.Dep, cachepath: [:0]const u8, options: *common.CollectOptions) !Module { - var moddeps = std.ArrayList(Module).init(alloc); + var moddeps = std.array_list.Managed(Module).init(alloc); errdefer moddeps.deinit(); for (dep.deps) |*d| { @@ -71,7 +71,7 @@ pub const Module = struct { pub fn get_hash(self: Module, alloc: std.mem.Allocator, cdpath: string) !string { const file_list_1 = try u.file_list(alloc, try std.mem.concatWithSentinel(alloc, u8, &.{ cdpath, "/", self.clean_path }, 0)); - var file_list_2 = std.ArrayList(string).init(alloc); + var file_list_2 = std.array_list.Managed(string).init(alloc); errdefer file_list_2.deinit(); for (file_list_1) |item| { const _a = extras.trimPrefix(item, cdpath); diff --git a/zig.mod b/zig.mod index 54b7acd5325e4be9a450396ea6be4814358eac92..371a608ca75692a6daa034939c822a2ddc126b33 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.14.1 +min_zig_version: 0.15.2 min_zigmod_version: r96 dependencies: - src: git https://github.com/nektro/zig-yaml @@ -13,7 +13,7 @@ dependencies: name: known-folders main: known-folders.zig license: MIT - version: commit-aa24df42183ad415d10bc0a33e6238c437fc0f59 + version: commit-83d39161eac2ed6f37ad3cb4d9dd518696ce90bb - src: git https://github.com/nektro/zig-licenses - src: git https://github.com/nektro/zig-detect-license - src: git https://github.com/nektro/zig-inquirer @@ -35,3 +35,4 @@ root_dependencies: - src: git https://github.com/nektro/zig-extras - src: git https://github.com/nektro/zig-ansi - src: git https://github.com/nektro/zig-nio + - src: git https://github.com/nektro/zig-nfs diff --git a/zigmod.lock b/zigmod.lock index 277548674cd8a29791da929fe73ae3193457a350..ea0b4dc560ee266050fe77c96a37645be7fccd3d 100644 --- a/zigmod.lock +++ b/zigmod.lock @@ -1,23 +1,23 @@ 2 git https://github.com/marlersoft/zigwin32 commit-ec98bb4d9eea532320a8551720a9e3ec6de64994 -git https://github.com/nektro/arqv-ini commit-ab427a4de4f875eaa39ee56a29114fc020431546 -git https://github.com/nektro/zig-ansi commit-5f89211a749aef6bf518889c0467ceb24825c055 -git https://github.com/nektro/zig-detect-license commit-a1a066da88dab50873a56f0349dc12dc76542077 -git https://github.com/nektro/zig-extras commit-0cf756c80a4bc1b0459bc81bf8071891f12c3738 -git https://github.com/nektro/zig-git commit-2b3f83cd341764f979969603e4f77e62f353b6a3 -git https://github.com/nektro/zig-inquirer commit-4cddefa42744d61067567b0b36b5d2bb376e5ae3 -git https://github.com/nektro/zig-intrusive-parser commit-a31b480914d15f3d13cdfb586aac950c73beebdd -git https://github.com/nektro/zig-json commit-fb918b08846233573467f5df41fcc3b733155663 -git https://github.com/nektro/zig-leven commit-618eddde4ffbc6d34100e4bc6aa654d41161537a -git https://github.com/nektro/zig-licenses commit-16cef5e32b3f8bbcf1064c599615290a720b6547 -git https://github.com/nektro/zig-licenses-text commit-ba0f00dfb23d28c301e4b54d0a278def2c38dc7b -git https://github.com/nektro/zig-nfs commit-6743e4e3b03cd3e8175a11f328e530edd054f2f1 -git https://github.com/nektro/zig-nio commit-72fb20a7c5f6f466ced5c3bc731864ee69bc7682 -git https://github.com/nektro/zig-sys-darwin commit-c8ef1a85dfb5e1891454650f88d56bfaa0834304 -git https://github.com/nektro/zig-sys-linux commit-7c161d74c77ef9d482bb71273163fd454674240b -git https://github.com/nektro/zig-time commit-0f4db4c980146e4a3fc86a9a9070452a25ff9317 -git https://github.com/nektro/zig-tracer commit-3a5fdea4ffd387a53ac2a42fb503557cdbe20696 -git https://github.com/nektro/zig-yaml commit-c20de5ff5a7211007b57f8ae8914319debb473c4 +git https://github.com/nektro/arqv-ini commit-e229c738bbf5cf0d5464bf9178c17813069a7028 +git https://github.com/nektro/zig-ansi commit-d1c2ebf3f6c9b0d3aaa74a123d2f0a5657242431 +git https://github.com/nektro/zig-detect-license commit-e8ea5d969e1062d0be161f7a70e293b52aebc3f3 +git https://github.com/nektro/zig-extras commit-2cb1b3d619b10f4ad2c870f0359adb0c6129ca67 +git https://github.com/nektro/zig-git commit-8fdfc351842785192cad01aead798d85e25d1a48 +git https://github.com/nektro/zig-inquirer commit-3270255ea4c6d919853527e6a73baecfdee6867d +git https://github.com/nektro/zig-intrusive-parser commit-c21ce202c557a710fba6a2333f33bee7bbea114c +git https://github.com/nektro/zig-json commit-27d7354d9dc44982f1de40706721aee7d9c998a5 +git https://github.com/nektro/zig-leven commit-d97ef94cacf5c109b7f4b9e01a7e6645d8c8e09a +git https://github.com/nektro/zig-licenses commit-f0a95c802d6f955f131dae121550b2ec0acb97ff +git https://github.com/nektro/zig-licenses-text commit-88dc9ae4c338c652dc231ea477b8e0b56ac36743 +git https://github.com/nektro/zig-nfs commit-4c6b77b141abab5f6ac70ea712521f062b54df65 +git https://github.com/nektro/zig-nio commit-42f22d588059efa1e212f97402e94d81d675f28d +git https://github.com/nektro/zig-sys-darwin commit-3565d27455bd6c9f4650ea691cf4de47f9d229e7 +git https://github.com/nektro/zig-sys-linux commit-3f07f214aac54bcf8f84975a2312cd91ac67fa04 +git https://github.com/nektro/zig-time commit-c05c69b92a00b1afd07cb193f5069250e34ce488 +git https://github.com/nektro/zig-tracer commit-afa0f6df50960f3772b4e0b311ff86521da3e6d5 +git https://github.com/nektro/zig-yaml commit-fbf3642e7a9e354e2f48751b69ae1c41c0d7b062 git https://github.com/madler/zlib tag-v1.3.2 git https://github.com/yaml/libyaml tag-0.2.5 -git https://github.com/ziglibs/known-folders commit-aa24df42183ad415d10bc0a33e6238c437fc0f59 +git https://github.com/ziglibs/known-folders commit-83d39161eac2ed6f37ad3cb4d9dd518696ce90bb -- 2.54.0