| author | |
| committer | |
| log | 3c9d4d8ee6aee72d5cfa302479d5f72c2a7c2105 |
| tree | 2c7c33d673a16a560d8bfa9b897ee35109605ac4 |
| parent | a1ccc65916b5b78d9b259ba462ffabe3597ae973 |
| signature |
27 files changed, 605 insertions(+), 151 deletions(-)
.github/workflows/push.yml+1-1| ... | ... | @@ -20,7 +20,7 @@ jobs: |
| 20 | 20 | uses: mlugg/setup-zig@v2 |
| 21 | 21 | with: |
| 22 | 22 | mirror: "http://mirrors.nektro.net/s3cgi" |
| 23 | version: "0.15.2" | |
| 23 | version: "0.16.0" | |
| 24 | 24 | |
| 25 | 25 | - run: zig version |
| 26 | 26 | - run: zig env |
README.md+1-1| ... | ... | @@ -22,7 +22,7 @@ A package manager for the Zig programming language. |
| 22 | 22 | |
| 23 | 23 | ## Built With |
| 24 | 24 | |
| 25 | - Zig `0.15.2` | |
| 25 | - Zig `0.16.0` | |
| 26 | 26 | - See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock) |
| 27 | 27 | |
| 28 | 28 | ### Build from Source |
build.zig+2-2| ... | ... | @@ -26,10 +26,10 @@ pub fn build(b: *std.Build) void { |
| 26 | 26 | |
| 27 | 27 | const exe_options = b.addOptions(); |
| 28 | 28 | exe.root_module.addImport("build_options", exe_options.createModule()); |
| 29 | exe_options.addOption(string, "version", tag orelse std.mem.trimRight(u8, b.run(&.{ "git", "describe", "--tags" }), "\n")); | |
| 29 | exe_options.addOption(string, "version", tag orelse std.mem.trimEnd(u8, b.run(&.{ "git", "describe", "--tags" }), "\n")); | |
| 30 | 30 | |
| 31 | 31 | deps.addAllTo(exe); |
| 32 | exe.linkLibC(); | |
| 32 | exe.root_module.linkSystemLibrary("c", .{}); | |
| 33 | 33 | exe.root_module.strip = strip; |
| 34 | 34 | // exe.use_llvm = !disable_llvm; |
| 35 | 35 | // exe.use_lld = !disable_llvm; |
deps.zig+64-64| ... | ... | @@ -27,7 +27,7 @@ pub const GitExactStep = struct { |
| 27 | 27 | urlpath = trimPrefix(u8, urlpath, "https://"); |
| 28 | 28 | urlpath = trimPrefix(u8, urlpath, "git://"); |
| 29 | 29 | const repopath = b.fmt("{s}/zigmod/deps/git/{s}/{s}", .{ b.cache_root.path.?, urlpath, commit }); |
| 30 | flip(std.fs.cwd().access(repopath, .{})) catch return result; | |
| 30 | flip(std.Io.Dir.cwd().access(std.Options.debug_io, repopath, .{})) catch return result; | |
| 31 | 31 | |
| 32 | 32 | var clonestep = std.Build.Step.Run.create(b, "clone"); |
| 33 | 33 | clonestep.addArgs(&.{ "git", "clone", "-q", "--progress", url, repopath }); |
| ... | ... | @@ -55,27 +55,27 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step { |
| 55 | 55 | if (path.* != null) path.* = b.fmt("{s}/zigmod/deps{s}", .{ root, path.*.? }); |
| 56 | 56 | } |
| 57 | 57 | step.dependOn(&GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "ec98bb4d9eea532320a8551720a9e3ec6de64994").step); |
| 58 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "e229c738bbf5cf0d5464bf9178c17813069a7028").step); | |
| 59 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "d1c2ebf3f6c9b0d3aaa74a123d2f0a5657242431").step); | |
| 60 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "e8ea5d969e1062d0be161f7a70e293b52aebc3f3").step); | |
| 61 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "2cb1b3d619b10f4ad2c870f0359adb0c6129ca67").step); | |
| 62 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-git", "8fdfc351842785192cad01aead798d85e25d1a48").step); | |
| 63 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "3270255ea4c6d919853527e6a73baecfdee6867d").step); | |
| 64 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-intrusive-parser", "c21ce202c557a710fba6a2333f33bee7bbea114c").step); | |
| 65 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-json", "27d7354d9dc44982f1de40706721aee7d9c998a5").step); | |
| 66 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "d97ef94cacf5c109b7f4b9e01a7e6645d8c8e09a").step); | |
| 67 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "f0a95c802d6f955f131dae121550b2ec0acb97ff").step); | |
| 68 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "88dc9ae4c338c652dc231ea477b8e0b56ac36743").step); | |
| 69 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nfs", "4c6b77b141abab5f6ac70ea712521f062b54df65").step); | |
| 70 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nio", "42f22d588059efa1e212f97402e94d81d675f28d").step); | |
| 71 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-darwin", "3565d27455bd6c9f4650ea691cf4de47f9d229e7").step); | |
| 72 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-linux", "3f07f214aac54bcf8f84975a2312cd91ac67fa04").step); | |
| 73 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "c05c69b92a00b1afd07cb193f5069250e34ce488").step); | |
| 74 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "afa0f6df50960f3772b4e0b311ff86521da3e6d5").step); | |
| 75 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "fbf3642e7a9e354e2f48751b69ae1c41c0d7b062").step); | |
| 58 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "d2465c64833590a04bd9b7f50c87363fd03e65bf").step); | |
| 59 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "bebb39ae30d9848a1c212cee582d0b1c102d8b87").step); | |
| 60 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "6de79b4ff8f7462e26f224f4bed3c81710c8893b").step); | |
| 61 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "02301520811d7796de6e4f87961a44a6f458f702").step); | |
| 62 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-git", "fec0b7e88951d866fc9196140748e95244232ea1").step); | |
| 63 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "e745b018f87ddc4c8958370332e6cf61625403cc").step); | |
| 64 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-intrusive-parser", "cf841a5bb507b03e0e8ed1877bce8b9da4b97e3f").step); | |
| 65 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-json", "25dff500aea481527ea3aeaf9526e32b023326c1").step); | |
| 66 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "014971d4b1e327a5c61322c3a6b9369fd1863864").step); | |
| 67 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "bc1cd51625c13d6c7df819fd0d85968e617f5c57").step); | |
| 68 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "a9d067c3c4d6c226a1de5531b66785bc15d869ee").step); | |
| 69 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nfs", "0e6c256cd96af224511210d877acef60ac07484f").step); | |
| 70 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nio", "6e45c4207fb2e1fc7fb2dbd3ecff28d2a3bfd92c").step); | |
| 71 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-darwin", "b96e8bad94f53d5f426a32f237d9e8346f51b8f2").step); | |
| 72 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-linux", "065090fa8b3b1aaac21ff46756116713ff5a30dd").step); | |
| 73 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "70ef29a006ceed7379df8801e3889da197de36ce").step); | |
| 74 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "04c3ad0fbdfb57dea27da0c8cbb75e2539837c92").step); | |
| 75 | step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "dff9fd43ebf1046c70090bdccfeb2e4f1c0d584b").step); | |
| 76 | 76 | step.dependOn(&GitExactStep.create(b, "https://github.com/madler/zlib", "da607da739fa6047df13e66a2af6b8bec7c2a498").step); |
| 77 | 77 | step.dependOn(&GitExactStep.create(b, "https://github.com/yaml/libyaml", "2c891fc7a770e8ba2fec34fc6b545c672beb37e6").step); |
| 78 | step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "83d39161eac2ed6f37ad3cb4d9dd518696ce90bb").step); | |
| 78 | step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "207c34a16e4365edc20d92c7892f962b3bed46e8").step); | |
| 79 | 79 | return step; |
| 80 | 80 | } |
| 81 | 81 | |
| ... | ... | @@ -154,25 +154,25 @@ pub const Package = struct { |
| 154 | 154 | } |
| 155 | 155 | for (self.c_include_dirs) |item| { |
| 156 | 156 | result.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }); |
| 157 | dummy_library.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }); | |
| 157 | dummy_library.root_module.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }); | |
| 158 | 158 | link_lib_c = true; |
| 159 | 159 | links += 1; |
| 160 | 160 | } |
| 161 | 161 | for (self.c_source_files) |item| { |
| 162 | dummy_library.addCSourceFile(.{ .file = .{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }, .flags = self.c_source_flags }); | |
| 162 | dummy_library.root_module.addCSourceFile(.{ .file = .{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }, .flags = self.c_source_flags }); | |
| 163 | 163 | links += 1; |
| 164 | 164 | } |
| 165 | 165 | for (self.system_libs) |item| { |
| 166 | 166 | if (std.zig.target.isLibCLibName(&target, item)) continue; |
| 167 | dummy_library.linkSystemLibrary(item); | |
| 167 | dummy_library.root_module.linkSystemLibrary(item, .{}); | |
| 168 | 168 | links += 1; |
| 169 | 169 | } |
| 170 | 170 | for (self.frameworks) |item| { |
| 171 | dummy_library.linkFramework(item); | |
| 171 | dummy_library.root_module.linkFramework(item, .{}); | |
| 172 | 172 | links += 1; |
| 173 | 173 | } |
| 174 | 174 | if (links > 0) { |
| 175 | dummy_library.linkLibC(); | |
| 175 | dummy_library.root_module.linkSystemLibrary("c", .{}); | |
| 176 | 176 | exe.root_module.linkLibrary(dummy_library); |
| 177 | 177 | link_lib_c = true; |
| 178 | 178 | } |
| ... | ... | @@ -185,7 +185,7 @@ pub const Package = struct { |
| 185 | 185 | }; |
| 186 | 186 | |
| 187 | 187 | fn checkMinZig(current: std.SemanticVersion, exe: *std.Build.Step.Compile) void { |
| 188 | const min = std.SemanticVersion.parse("0.15.2") catch return; | |
| 188 | const min = std.SemanticVersion.parse("0.16.0") catch return; | |
| 189 | 189 | 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})); |
| 190 | 190 | } |
| 191 | 191 | |
| ... | ... | @@ -196,103 +196,103 @@ pub const package_data = struct { |
| 196 | 196 | .entry = "/git/github.com/marlersoft/zigwin32/ec98bb4d9eea532320a8551720a9e3ec6de64994/win32.zig", |
| 197 | 197 | }; |
| 198 | 198 | pub var _u7sysdckdymi = Package{ |
| 199 | .store = "/git/github.com/nektro/arqv-ini/e229c738bbf5cf0d5464bf9178c17813069a7028", | |
| 199 | .store = "/git/github.com/nektro/arqv-ini/d2465c64833590a04bd9b7f50c87363fd03e65bf", | |
| 200 | 200 | .name = "ini", |
| 201 | .entry = "/git/github.com/nektro/arqv-ini/e229c738bbf5cf0d5464bf9178c17813069a7028/src/ini.zig", | |
| 201 | .entry = "/git/github.com/nektro/arqv-ini/d2465c64833590a04bd9b7f50c87363fd03e65bf/src/ini.zig", | |
| 202 | 202 | }; |
| 203 | 203 | pub var _s84v9o48ucb0 = Package{ |
| 204 | .store = "/git/github.com/nektro/zig-ansi/d1c2ebf3f6c9b0d3aaa74a123d2f0a5657242431", | |
| 204 | .store = "/git/github.com/nektro/zig-ansi/bebb39ae30d9848a1c212cee582d0b1c102d8b87", | |
| 205 | 205 | .name = "ansi", |
| 206 | .entry = "/git/github.com/nektro/zig-ansi/d1c2ebf3f6c9b0d3aaa74a123d2f0a5657242431/src/lib.zig", | |
| 206 | .entry = "/git/github.com/nektro/zig-ansi/bebb39ae30d9848a1c212cee582d0b1c102d8b87/src/lib.zig", | |
| 207 | 207 | }; |
| 208 | 208 | pub var _f7dubzb7cyqe = Package{ |
| 209 | .store = "/git/github.com/nektro/zig-extras/2cb1b3d619b10f4ad2c870f0359adb0c6129ca67", | |
| 209 | .store = "/git/github.com/nektro/zig-extras/02301520811d7796de6e4f87961a44a6f458f702", | |
| 210 | 210 | .name = "extras", |
| 211 | .entry = "/git/github.com/nektro/zig-extras/2cb1b3d619b10f4ad2c870f0359adb0c6129ca67/src/lib.zig", | |
| 211 | .entry = "/git/github.com/nektro/zig-extras/02301520811d7796de6e4f87961a44a6f458f702/src/lib.zig", | |
| 212 | 212 | }; |
| 213 | 213 | pub var _c1xirp1ota5p = Package{ |
| 214 | .store = "/git/github.com/nektro/zig-inquirer/3270255ea4c6d919853527e6a73baecfdee6867d", | |
| 214 | .store = "/git/github.com/nektro/zig-inquirer/e745b018f87ddc4c8958370332e6cf61625403cc", | |
| 215 | 215 | .name = "inquirer", |
| 216 | .entry = "/git/github.com/nektro/zig-inquirer/3270255ea4c6d919853527e6a73baecfdee6867d/src/lib.zig", | |
| 216 | .entry = "/git/github.com/nektro/zig-inquirer/e745b018f87ddc4c8958370332e6cf61625403cc/src/lib.zig", | |
| 217 | 217 | .deps = &[_]*Package{ &_s84v9o48ucb0 }, |
| 218 | 218 | }; |
| 219 | 219 | pub var _96h80ezrvj7i = Package{ |
| 220 | .store = "/git/github.com/nektro/zig-leven/d97ef94cacf5c109b7f4b9e01a7e6645d8c8e09a", | |
| 220 | .store = "/git/github.com/nektro/zig-leven/014971d4b1e327a5c61322c3a6b9369fd1863864", | |
| 221 | 221 | .name = "leven", |
| 222 | .entry = "/git/github.com/nektro/zig-leven/d97ef94cacf5c109b7f4b9e01a7e6645d8c8e09a/src/lib.zig", | |
| 222 | .entry = "/git/github.com/nektro/zig-leven/014971d4b1e327a5c61322c3a6b9369fd1863864/src/lib.zig", | |
| 223 | 223 | }; |
| 224 | 224 | pub var _0npcrzfdlrvk = Package{ |
| 225 | .store = "/git/github.com/nektro/zig-licenses/f0a95c802d6f955f131dae121550b2ec0acb97ff", | |
| 225 | .store = "/git/github.com/nektro/zig-licenses/bc1cd51625c13d6c7df819fd0d85968e617f5c57", | |
| 226 | 226 | .name = "licenses", |
| 227 | .entry = "/git/github.com/nektro/zig-licenses/f0a95c802d6f955f131dae121550b2ec0acb97ff/src/lib.zig", | |
| 227 | .entry = "/git/github.com/nektro/zig-licenses/bc1cd51625c13d6c7df819fd0d85968e617f5c57/src/lib.zig", | |
| 228 | 228 | }; |
| 229 | 229 | pub var _pt88y5d80m25 = Package{ |
| 230 | .store = "/git/github.com/nektro/zig-licenses-text/88dc9ae4c338c652dc231ea477b8e0b56ac36743", | |
| 230 | .store = "/git/github.com/nektro/zig-licenses-text/a9d067c3c4d6c226a1de5531b66785bc15d869ee", | |
| 231 | 231 | .name = "licenses-text", |
| 232 | .entry = "/git/github.com/nektro/zig-licenses-text/88dc9ae4c338c652dc231ea477b8e0b56ac36743/src/lib.zig", | |
| 232 | .entry = "/git/github.com/nektro/zig-licenses-text/a9d067c3c4d6c226a1de5531b66785bc15d869ee/src/lib.zig", | |
| 233 | 233 | }; |
| 234 | 234 | pub var _73bukkeci2u6 = Package{ |
| 235 | .store = "/git/github.com/nektro/zig-sys-darwin/3565d27455bd6c9f4650ea691cf4de47f9d229e7", | |
| 235 | .store = "/git/github.com/nektro/zig-sys-darwin/b96e8bad94f53d5f426a32f237d9e8346f51b8f2", | |
| 236 | 236 | .name = "sys-darwin", |
| 237 | .entry = "/git/github.com/nektro/zig-sys-darwin/3565d27455bd6c9f4650ea691cf4de47f9d229e7/sys_darwin.zig", | |
| 237 | .entry = "/git/github.com/nektro/zig-sys-darwin/b96e8bad94f53d5f426a32f237d9e8346f51b8f2/sys_darwin.zig", | |
| 238 | 238 | }; |
| 239 | 239 | pub var _h7tv7ayhffak = Package{ |
| 240 | .store = "/git/github.com/nektro/zig-sys-linux/3f07f214aac54bcf8f84975a2312cd91ac67fa04", | |
| 240 | .store = "/git/github.com/nektro/zig-sys-linux/065090fa8b3b1aaac21ff46756116713ff5a30dd", | |
| 241 | 241 | .name = "sys-linux", |
| 242 | .entry = "/git/github.com/nektro/zig-sys-linux/3f07f214aac54bcf8f84975a2312cd91ac67fa04/mod.zig", | |
| 242 | .entry = "/git/github.com/nektro/zig-sys-linux/065090fa8b3b1aaac21ff46756116713ff5a30dd/mod.zig", | |
| 243 | 243 | }; |
| 244 | 244 | pub var _kscsl0145t7x = Package{ |
| 245 | .store = "/git/github.com/nektro/zig-nio/42f22d588059efa1e212f97402e94d81d675f28d", | |
| 245 | .store = "/git/github.com/nektro/zig-nio/6e45c4207fb2e1fc7fb2dbd3ecff28d2a3bfd92c", | |
| 246 | 246 | .name = "nio", |
| 247 | .entry = "/git/github.com/nektro/zig-nio/42f22d588059efa1e212f97402e94d81d675f28d/nio.zig", | |
| 247 | .entry = "/git/github.com/nektro/zig-nio/6e45c4207fb2e1fc7fb2dbd3ecff28d2a3bfd92c/nio.zig", | |
| 248 | 248 | .deps = &[_]*Package{ &_h7tv7ayhffak, &_f7dubzb7cyqe, &_73bukkeci2u6 }, |
| 249 | 249 | }; |
| 250 | 250 | pub var _7l3oxw6nqqws = Package{ |
| 251 | .store = "/git/github.com/nektro/zig-intrusive-parser/c21ce202c557a710fba6a2333f33bee7bbea114c", | |
| 251 | .store = "/git/github.com/nektro/zig-intrusive-parser/cf841a5bb507b03e0e8ed1877bce8b9da4b97e3f", | |
| 252 | 252 | .name = "intrusive-parser", |
| 253 | .entry = "/git/github.com/nektro/zig-intrusive-parser/c21ce202c557a710fba6a2333f33bee7bbea114c/intrusive_parser.zig", | |
| 253 | .entry = "/git/github.com/nektro/zig-intrusive-parser/cf841a5bb507b03e0e8ed1877bce8b9da4b97e3f/intrusive_parser.zig", | |
| 254 | 254 | .deps = &[_]*Package{ &_f7dubzb7cyqe, &_kscsl0145t7x }, |
| 255 | 255 | }; |
| 256 | 256 | pub var _iecwp4b3bsfm = Package{ |
| 257 | .store = "/git/github.com/nektro/zig-time/c05c69b92a00b1afd07cb193f5069250e34ce488", | |
| 257 | .store = "/git/github.com/nektro/zig-time/70ef29a006ceed7379df8801e3889da197de36ce", | |
| 258 | 258 | .name = "time", |
| 259 | .entry = "/git/github.com/nektro/zig-time/c05c69b92a00b1afd07cb193f5069250e34ce488/time.zig", | |
| 259 | .entry = "/git/github.com/nektro/zig-time/70ef29a006ceed7379df8801e3889da197de36ce/time.zig", | |
| 260 | 260 | .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_73bukkeci2u6 }, |
| 261 | 261 | }; |
| 262 | 262 | pub var _vph9l0hxpeze = Package{ |
| 263 | .store = "/git/github.com/nektro/zig-nfs/4c6b77b141abab5f6ac70ea712521f062b54df65", | |
| 263 | .store = "/git/github.com/nektro/zig-nfs/0e6c256cd96af224511210d877acef60ac07484f", | |
| 264 | 264 | .name = "nfs", |
| 265 | .entry = "/git/github.com/nektro/zig-nfs/4c6b77b141abab5f6ac70ea712521f062b54df65/nfs.zig", | |
| 265 | .entry = "/git/github.com/nektro/zig-nfs/0e6c256cd96af224511210d877acef60ac07484f/nfs.zig", | |
| 266 | 266 | .deps = &[_]*Package{ &_h7tv7ayhffak, &_kscsl0145t7x, &_iecwp4b3bsfm, &_73bukkeci2u6 }, |
| 267 | 267 | }; |
| 268 | 268 | pub var _2ovav391ivak = Package{ |
| 269 | .store = "/git/github.com/nektro/zig-detect-license/e8ea5d969e1062d0be161f7a70e293b52aebc3f3", | |
| 269 | .store = "/git/github.com/nektro/zig-detect-license/6de79b4ff8f7462e26f224f4bed3c81710c8893b", | |
| 270 | 270 | .name = "detect-license", |
| 271 | .entry = "/git/github.com/nektro/zig-detect-license/e8ea5d969e1062d0be161f7a70e293b52aebc3f3/src/lib.zig", | |
| 271 | .entry = "/git/github.com/nektro/zig-detect-license/6de79b4ff8f7462e26f224f4bed3c81710c8893b/src/lib.zig", | |
| 272 | 272 | .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i, &_vph9l0hxpeze }, |
| 273 | 273 | }; |
| 274 | 274 | pub var _ede2wygpe1iy = Package{ |
| 275 | .store = "/git/github.com/nektro/zig-tracer/afa0f6df50960f3772b4e0b311ff86521da3e6d5", | |
| 275 | .store = "/git/github.com/nektro/zig-tracer/04c3ad0fbdfb57dea27da0c8cbb75e2539837c92", | |
| 276 | 276 | .name = "tracer", |
| 277 | .entry = "/git/github.com/nektro/zig-tracer/afa0f6df50960f3772b4e0b311ff86521da3e6d5/src/mod.zig", | |
| 277 | .entry = "/git/github.com/nektro/zig-tracer/04c3ad0fbdfb57dea27da0c8cbb75e2539837c92/src/mod.zig", | |
| 278 | 278 | .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_vph9l0hxpeze, &_kscsl0145t7x, &_iecwp4b3bsfm }, |
| 279 | 279 | }; |
| 280 | 280 | pub var _0k64oe2nuzvj = Package{ |
| 281 | .store = "/git/github.com/nektro/zig-git/8fdfc351842785192cad01aead798d85e25d1a48", | |
| 281 | .store = "/git/github.com/nektro/zig-git/fec0b7e88951d866fc9196140748e95244232ea1", | |
| 282 | 282 | .name = "git", |
| 283 | .entry = "/git/github.com/nektro/zig-git/8fdfc351842785192cad01aead798d85e25d1a48/git.zig", | |
| 283 | .entry = "/git/github.com/nektro/zig-git/fec0b7e88951d866fc9196140748e95244232ea1/git.zig", | |
| 284 | 284 | .deps = &[_]*Package{ &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_ede2wygpe1iy, &_vph9l0hxpeze, &_kscsl0145t7x, &_0e2d06bb494b }, |
| 285 | 285 | }; |
| 286 | 286 | pub var _ocmr9rtohgcc = Package{ |
| 287 | .store = "/git/github.com/nektro/zig-json/27d7354d9dc44982f1de40706721aee7d9c998a5", | |
| 287 | .store = "/git/github.com/nektro/zig-json/25dff500aea481527ea3aeaf9526e32b023326c1", | |
| 288 | 288 | .name = "json", |
| 289 | .entry = "/git/github.com/nektro/zig-json/27d7354d9dc44982f1de40706721aee7d9c998a5/json.zig", | |
| 289 | .entry = "/git/github.com/nektro/zig-json/25dff500aea481527ea3aeaf9526e32b023326c1/json.zig", | |
| 290 | 290 | .deps = &[_]*Package{ &_f7dubzb7cyqe, &_ede2wygpe1iy, &_7l3oxw6nqqws, &_kscsl0145t7x }, |
| 291 | 291 | }; |
| 292 | 292 | pub var _g982zq6e8wsv = Package{ |
| 293 | .store = "/git/github.com/nektro/zig-yaml/fbf3642e7a9e354e2f48751b69ae1c41c0d7b062", | |
| 293 | .store = "/git/github.com/nektro/zig-yaml/dff9fd43ebf1046c70090bdccfeb2e4f1c0d584b", | |
| 294 | 294 | .name = "yaml", |
| 295 | .entry = "/git/github.com/nektro/zig-yaml/fbf3642e7a9e354e2f48751b69ae1c41c0d7b062/yaml.zig", | |
| 295 | .entry = "/git/github.com/nektro/zig-yaml/dff9fd43ebf1046c70090bdccfeb2e4f1c0d584b/yaml.zig", | |
| 296 | 296 | .deps = &[_]*Package{ &_8mdbh0zuneb0 }, |
| 297 | 297 | }; |
| 298 | 298 | pub var _0e2d06bb494b = Package{ |
| ... | ... | @@ -308,9 +308,9 @@ pub const package_data = struct { |
| 308 | 308 | .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" }, |
| 309 | 309 | }; |
| 310 | 310 | pub var _2ta738wrqbaq = Package{ |
| 311 | .store = "/git/github.com/ziglibs/known-folders/83d39161eac2ed6f37ad3cb4d9dd518696ce90bb", | |
| 311 | .store = "/git/github.com/ziglibs/known-folders/207c34a16e4365edc20d92c7892f962b3bed46e8", | |
| 312 | 312 | .name = "known-folders", |
| 313 | .entry = "/git/github.com/ziglibs/known-folders/83d39161eac2ed6f37ad3cb4d9dd518696ce90bb/known-folders.zig", | |
| 313 | .entry = "/git/github.com/ziglibs/known-folders/207c34a16e4365edc20d92c7892f962b3bed46e8/known-folders.zig", | |
| 314 | 314 | }; |
| 315 | 315 | pub var _89ujp8gq842x = Package{ |
| 316 | 316 | .name = "zigmod", |
docs/README.md+1-1| ... | ... | @@ -10,7 +10,7 @@ The rest of this documentation will assume you already have Zig installed. |
| 10 | 10 | |
| 11 | 11 | 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. |
| 12 | 12 | |
| 13 | The earliest Zig release this Zigmod was verified to work with is `0.15.2`. | |
| 13 | The earliest Zig release this Zigmod was verified to work with is `0.16.0`. | |
| 14 | 14 | |
| 15 | 15 | ## Download |
| 16 | 16 | You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source. |
docs/commands/install.md+1-1| ... | ... | @@ -19,6 +19,6 @@ zigmod install [git|hg|http] [url] |
| 19 | 19 | ``` |
| 20 | 20 | $ zigmod install git https://github.com/nektro/zigmod |
| 21 | 21 | debug: modpath: /home/me/.cache/zigmod/deps/git/github.com/nektro/zigmod |
| 22 | debug: argv: { /home/me/.local/share/zig/0.15.2/zig, build, --prefix, /home/me/.zigmod } | |
| 22 | debug: argv: { /home/me/.local/share/zig/0.16.0/zig, build, --prefix, /home/me/.zigmod } | |
| 23 | 23 | info: success! |
| 24 | 24 | ``` |
src/cmd/ci.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ const common = @import("./../common.zig"); |
| 9 | 9 | // Inspired by: |
| 10 | 10 | // https://docs.npmjs.com/cli/v7/commands/npm-ci |
| 11 | 11 | |
| 12 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 12 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 13 | 13 | _ = self_name; |
| 14 | 14 | _ = args; |
| 15 | 15 |
src/cmd/explain.zig+1-1| ... | ... | @@ -10,7 +10,7 @@ const common = @import("./../common.zig"); |
| 10 | 10 | // |
| 11 | 11 | // |
| 12 | 12 | |
| 13 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 13 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 14 | 14 | _ = self_name; |
| 15 | 15 | |
| 16 | 16 | const gpa = std.heap.c_allocator; |
src/cmd/fetch.0.12.zig+1-1| ... | ... | @@ -260,7 +260,7 @@ fn print_dirs(w: nfs.File, list: []const zigmod.Module, alloc: std.mem.Allocator |
| 260 | 260 | continue; |
| 261 | 261 | } |
| 262 | 262 | if (std.mem.eql(u8, mod.clean_path, "../..")) { |
| 263 | const cwd_realpath = try std.fs.cwd().realpathAlloc(alloc, "."); | |
| 263 | const cwd_realpath = try nfs.cwd().realpathAlloc(alloc, "."); | |
| 264 | 264 | try w.print(" pub const _{s} = \"{}\";\n", .{ mod.short_id(), u.altStringEscape(cwd_realpath) }); |
| 265 | 265 | continue; |
| 266 | 266 | } |
src/cmd/fetch.0.13.zig+1-1| ... | ... | @@ -262,7 +262,7 @@ fn print_dirs(w: nfs.File, list: []const zigmod.Module, alloc: std.mem.Allocator |
| 262 | 262 | continue; |
| 263 | 263 | } |
| 264 | 264 | if (std.mem.eql(u8, mod.clean_path, "../..")) { |
| 265 | const cwd_realpath = try std.fs.cwd().realpathAlloc(alloc, "."); | |
| 265 | const cwd_realpath = try nfs.cwd().realpathAlloc(alloc, "."); | |
| 266 | 266 | try w.print(" pub const _{s} = \"{}\";\n", .{ mod.short_id(), u.altStringEscape(cwd_realpath) }); |
| 267 | 267 | continue; |
| 268 | 268 | } |
src/cmd/fetch.0.15.zig created+427| ... | ... | @@ -0,0 +1,427 @@ |
| 1 | const std = @import("std"); | |
| 2 | const string = []const u8; | |
| 3 | const ansi = @import("ansi"); | |
| 4 | const extras = @import("extras"); | |
| 5 | const nfs = @import("nfs"); | |
| 6 | ||
| 7 | const zigmod = @import("../lib.zig"); | |
| 8 | const u = @import("./../util/funcs.zig"); | |
| 9 | const common = @import("./../common.zig"); | |
| 10 | const license = @import("./license.zig"); | |
| 11 | ||
| 12 | 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 { | |
| 13 | const f = try dir.createFile("deps.zig", .{}); | |
| 14 | defer f.close(); | |
| 15 | ||
| 16 | const w = f; | |
| 17 | try w.writeAll("// zig fmt: off\n"); | |
| 18 | try w.writeAll("const std = @import(\"std\");\n"); | |
| 19 | try w.writeAll("const builtin = @import(\"builtin\");\n"); | |
| 20 | try w.writeAll("const string = []const u8;\n"); | |
| 21 | try w.writeAll("\n"); | |
| 22 | try w.print("pub const cache = \"{}\";\n", .{u.altStringEscape(cachepath)}); | |
| 23 | try w.writeAll("pub var skip_libc = false;\n"); | |
| 24 | try w.writeAll("\n"); | |
| 25 | try w.writeAll( | |
| 26 | \\pub fn addAllTo(exe: *std.Build.Step.Compile) void { | |
| 27 | \\ checkMinZig(builtin.zig_version, exe); | |
| 28 | \\ @setEvalBranchQuota(1_000_000); | |
| 29 | \\ for (packages) |pkg| { | |
| 30 | \\ const module = pkg.module(exe); | |
| 31 | \\ exe.root_module.addImport(pkg.import.?[0], module); | |
| 32 | \\ } | |
| 33 | \\ for (package_data._root.system_libs) |libname| { | |
| 34 | \\ exe.linkSystemLibrary(libname); | |
| 35 | \\ exe.linkLibC(); | |
| 36 | \\ } | |
| 37 | \\ // clear module memo cache so addAllTo can be called more than once in the same build.zig | |
| 38 | \\ module_memo.clearAndFree(exe.step.owner.allocator); | |
| 39 | \\} | |
| 40 | \\ | |
| 41 | \\var link_lib_c = false; | |
| 42 | \\var module_memo: std.StringArrayHashMapUnmanaged(*std.Build.Module) = .empty; | |
| 43 | \\pub const Package = struct { | |
| 44 | \\ id: string, | |
| 45 | \\ directory: string, | |
| 46 | \\ import: ?struct { string, std.Build.LazyPath } = null, | |
| 47 | \\ dependencies: []const *const Package, | |
| 48 | \\ c_include_dirs: []const string = &.{}, | |
| 49 | \\ c_source_files: []const string = &.{}, | |
| 50 | \\ c_source_flags: []const string = &.{}, | |
| 51 | \\ system_libs: []const string = &.{}, | |
| 52 | \\ frameworks: []const string = &.{}, | |
| 53 | \\ | |
| 54 | \\ pub fn module(self: *const Package, exe: *std.Build.Step.Compile) *std.Build.Module { | |
| 55 | \\ if (module_memo.get(self.id)) |cached| { | |
| 56 | \\ return cached; | |
| 57 | \\ } | |
| 58 | \\ const b = exe.step.owner; | |
| 59 | \\ const result = b.createModule(.{ | |
| 60 | \\ .target = exe.root_module.resolved_target, | |
| 61 | \\ }); | |
| 62 | \\ const target = result.resolved_target.?.result; | |
| 63 | \\ if (self.import) |capture| { | |
| 64 | \\ result.root_source_file = capture[1]; | |
| 65 | \\ } | |
| 66 | \\ for (self.dependencies) |item| { | |
| 67 | \\ const module_dep = item.module(exe); | |
| 68 | \\ if (module_dep.root_source_file != null) { | |
| 69 | \\ result.addImport(item.import.?[0], module_dep); | |
| 70 | \\ } | |
| 71 | \\ for (module_dep.include_dirs.items) |jtem| { | |
| 72 | \\ switch (jtem) { | |
| 73 | \\ .path => result.addIncludePath(jtem.path), | |
| 74 | \\ .path_system, .path_after, .framework_path, .framework_path_system, .other_step, .config_header_step => {}, | |
| 75 | \\ .embed_path => {}, | |
| 76 | \\ } | |
| 77 | \\ } | |
| 78 | \\ } | |
| 79 | \\ for (self.c_include_dirs) |item| { | |
| 80 | \\ result.addIncludePath(.{ .cwd_relative = (b.fmt("{s}/{s}", .{ self.directory, item })) }); | |
| 81 | \\ exe.addIncludePath(.{ .cwd_relative = (b.fmt("{s}/{s}", .{ self.directory, item })) }); | |
| 82 | \\ link_lib_c = true; | |
| 83 | \\ } | |
| 84 | \\ for (self.c_source_files) |item| { | |
| 85 | \\ exe.addCSourceFile(.{ .file = .{ .cwd_relative = (b.fmt("{s}/{s}", .{ self.directory, item })) }, .flags = self.c_source_flags }); | |
| 86 | \\ link_lib_c = true; | |
| 87 | \\ } | |
| 88 | \\ for (self.system_libs) |item| { | |
| 89 | \\ if (skip_libc and std.zig.target.isLibCLibName(&target, item)) continue; | |
| 90 | \\ result.linkSystemLibrary(item, .{}); | |
| 91 | \\ exe.linkSystemLibrary(item); | |
| 92 | \\ link_lib_c = true; | |
| 93 | \\ } | |
| 94 | \\ for (self.frameworks) |item| { | |
| 95 | \\ result.linkFramework(item, .{}); | |
| 96 | \\ exe.linkFramework(item); | |
| 97 | \\ link_lib_c = true; | |
| 98 | \\ } | |
| 99 | \\ if (link_lib_c and !skip_libc) { | |
| 100 | \\ result.link_libc = true; | |
| 101 | \\ exe.linkLibC(); | |
| 102 | \\ } | |
| 103 | \\ module_memo.putNoClobber(b.allocator, self.id, result) catch @panic("OOM"); | |
| 104 | \\ return result; | |
| 105 | \\ } | |
| 106 | \\}; | |
| 107 | \\ | |
| 108 | \\ | |
| 109 | ); | |
| 110 | ||
| 111 | try w.print( | |
| 112 | \\fn checkMinZig(current: std.SemanticVersion, exe: *std.Build.Step.Compile) void {{ | |
| 113 | \\ const min = std.SemanticVersion.parse("{?}") catch return; | |
| 114 | \\ 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}})); | |
| 115 | \\}} | |
| 116 | \\ | |
| 117 | \\ | |
| 118 | , .{if (top_module.minZigVersion()) |sv| u.altSemanticVersion(sv) else null}); | |
| 119 | ||
| 120 | try w.writeAll("pub const dirs = struct {\n"); | |
| 121 | try print_dirs(w, list.items, alloc); | |
| 122 | try w.writeAll("};\n\n"); | |
| 123 | ||
| 124 | try w.writeAll("pub const package_data = struct {\n"); | |
| 125 | var duped = std.array_list.Managed(zigmod.Module).init(alloc); | |
| 126 | var done = std.array_list.Managed(zigmod.Module).init(alloc); | |
| 127 | for (list.items) |mod| { | |
| 128 | if (mod.type == .system_lib or mod.type == .framework) { | |
| 129 | continue; | |
| 130 | } | |
| 131 | try duped.append(mod); | |
| 132 | } | |
| 133 | try print_pkg_data_to(w, &duped, &done); | |
| 134 | try w.writeAll("};\n\n"); | |
| 135 | ||
| 136 | try w.writeAll("pub const packages = "); | |
| 137 | try print_deps(w, top_module); | |
| 138 | try w.writeAll(";\n\n"); | |
| 139 | ||
| 140 | try w.writeAll("pub const pkgs = "); | |
| 141 | try print_pkgs(alloc, w, top_module); | |
| 142 | try w.writeAll(";\n\n"); | |
| 143 | ||
| 144 | try w.writeAll("pub const imports = struct {\n"); | |
| 145 | try print_imports(alloc, w, top_module, cachepath); | |
| 146 | try w.writeAll("};\n"); | |
| 147 | } | |
| 148 | ||
| 149 | fn create_lockfile(alloc: std.mem.Allocator, list: *std.array_list.Managed(zigmod.Module), path: string, dir: nfs.Dir) !void { | |
| 150 | const fl = try dir.createFile("zigmod.lock", .{}); | |
| 151 | defer fl.close(); | |
| 152 | ||
| 153 | std.mem.sort(zigmod.Module, list.items, {}, zigmod.Module.lessThan); | |
| 154 | ||
| 155 | const wl = fl; | |
| 156 | try wl.writeAll("2\n"); | |
| 157 | for (list.items) |m| { | |
| 158 | if (m.dep) |md| { | |
| 159 | if (md.type.isLocal()) continue; | |
| 160 | const mpath = try std.fs.path.joinZ(alloc, &.{ path, m.clean_path }); | |
| 161 | const version = try md.exact_version(alloc, mpath); | |
| 162 | try wl.print("{s} {s} {s}\n", .{ @tagName(md.type), md.path, version }); | |
| 163 | } | |
| 164 | } | |
| 165 | } | |
| 166 | ||
| 167 | const DiffChange = struct { | |
| 168 | from: string, | |
| 169 | to: string, | |
| 170 | }; | |
| 171 | ||
| 172 | fn diff_lockfile(alloc: std.mem.Allocator) !void { | |
| 173 | const max = std.math.maxInt(usize); | |
| 174 | ||
| 175 | if (try nfs.cwd().existsDir(".git")) { | |
| 176 | const result = try u.run_cmd_raw(alloc, null, &.{ "git", "diff", "zigmod.lock" }); | |
| 177 | var stdout = std.io.fixedBufferStream(result.stdout); | |
| 178 | const r = stdout.reader(); | |
| 179 | while (try r.readUntilDelimiterOrEofAlloc(alloc, '\n', max)) |line| { | |
| 180 | if (std.mem.startsWith(u8, line, "@@")) break; | |
| 181 | } | |
| 182 | ||
| 183 | var rems = std.array_list.Managed(string).init(alloc); | |
| 184 | var adds = std.array_list.Managed(string).init(alloc); | |
| 185 | while (try r.readUntilDelimiterOrEofAlloc(alloc, '\n', max)) |line_full| { | |
| 186 | const line = line_full[0 .. line_full.len - 1]; | |
| 187 | if (line[0] == ' ') continue; | |
| 188 | if (line[0] == '-') try rems.append(line[1..]); | |
| 189 | if (line[0] == '+') if (line[1] == '2') break else try adds.append(line[1..]); | |
| 190 | } | |
| 191 | ||
| 192 | var changes = std.StringHashMap(DiffChange).init(alloc); | |
| 193 | ||
| 194 | var didbreak = false; | |
| 195 | var i: usize = 0; | |
| 196 | while (i < rems.items.len) { | |
| 197 | const it = rems.items[i]; | |
| 198 | const sni = u.indexOfN(it, ' ', 2).?; | |
| 199 | ||
| 200 | var j: usize = 0; | |
| 201 | while (j < adds.items.len) { | |
| 202 | const jt = adds.items[j]; | |
| 203 | const snj = u.indexOfN(jt, ' ', 2).?; | |
| 204 | ||
| 205 | if (std.mem.eql(u8, it[0..sni], jt[0..snj])) { | |
| 206 | try changes.put(it[0..sni], .{ | |
| 207 | .from = it[u.indexOfAfter(it, '-', sni).? + 1 .. it.len], | |
| 208 | .to = jt[u.indexOfAfter(jt, '-', snj).? + 1 .. jt.len], | |
| 209 | }); | |
| 210 | _ = rems.orderedRemove(i); | |
| 211 | _ = adds.orderedRemove(j); | |
| 212 | didbreak = true; | |
| 213 | break; | |
| 214 | } | |
| 215 | if (!didbreak) j += 1; | |
| 216 | } | |
| 217 | if (!didbreak) i += 1; | |
| 218 | if (didbreak) didbreak = false; | |
| 219 | } | |
| 220 | ||
| 221 | if (adds.items.len > 0) { | |
| 222 | std.debug.print(comptime ansi.color.Faint("Newly added packages:\n"), .{}); | |
| 223 | defer std.debug.print("\n", .{}); | |
| 224 | ||
| 225 | for (adds.items) |it| { | |
| 226 | std.debug.print("- {s}\n", .{it}); | |
| 227 | } | |
| 228 | } | |
| 229 | ||
| 230 | if (rems.items.len > 0) { | |
| 231 | std.debug.print(comptime ansi.color.Faint("Removed packages:\n"), .{}); | |
| 232 | defer std.debug.print("\n", .{}); | |
| 233 | ||
| 234 | for (rems.items) |it| { | |
| 235 | std.debug.print("- {s}\n", .{it}); | |
| 236 | } | |
| 237 | } | |
| 238 | ||
| 239 | if (changes.unmanaged.size > 0) std.debug.print(comptime ansi.color.Faint("Updated packages:\n"), .{}); | |
| 240 | var iter = changes.iterator(); | |
| 241 | while (iter.next()) |it| { | |
| 242 | if (diff_printchange("git https://github.com", "- {s}/compare/{s}...{s}\n", it)) continue; | |
| 243 | if (diff_printchange("git https://gitlab.com", "- {s}/-/compare/{s}...{s}\n", it)) continue; | |
| 244 | if (diff_printchange("git https://gitea.com", "- {s}/compare/{s}...{s}\n", it)) continue; | |
| 245 | ||
| 246 | std.debug.print("- {s}\n", .{it.key_ptr.*}); | |
| 247 | std.debug.print(" - {s} ... {s}\n", .{ it.value_ptr.from, it.value_ptr.to }); | |
| 248 | } | |
| 249 | } | |
| 250 | } | |
| 251 | ||
| 252 | fn diff_printchange(comptime testt: string, comptime replacement: string, item: std.StringHashMap(DiffChange).Entry) bool { | |
| 253 | if (std.mem.startsWith(u8, item.key_ptr.*, testt)) { | |
| 254 | if (std.mem.eql(u8, item.value_ptr.from, item.value_ptr.to)) return true; | |
| 255 | std.debug.print(replacement, .{ item.key_ptr.*[4..], item.value_ptr.from, item.value_ptr.to }); | |
| 256 | return true; | |
| 257 | } | |
| 258 | return false; | |
| 259 | } | |
| 260 | ||
| 261 | fn print_dirs(w: nfs.File, list: []const zigmod.Module, alloc: std.mem.Allocator) !void { | |
| 262 | for (list) |mod| { | |
| 263 | if (mod.type == .system_lib or mod.type == .framework) continue; | |
| 264 | if (std.mem.eql(u8, &mod.id, &zigmod.Module.ROOT)) { | |
| 265 | try w.writeAll(" pub const _root = \"\";\n"); | |
| 266 | continue; | |
| 267 | } | |
| 268 | if (std.mem.eql(u8, mod.clean_path, "../..")) { | |
| 269 | const cwd_realpath = try nfs.cwd().realpathAlloc(alloc, "."); | |
| 270 | try w.print(" pub const _{s} = \"{}\";\n", .{ mod.short_id(), u.altStringEscape(cwd_realpath) }); | |
| 271 | continue; | |
| 272 | } | |
| 273 | try w.print(" pub const _{s} = cache ++ \"/{}\";\n", .{ mod.short_id(), u.altStringEscape(mod.clean_path) }); | |
| 274 | } | |
| 275 | } | |
| 276 | ||
| 277 | fn print_deps(w: nfs.File, m: zigmod.Module) !void { | |
| 278 | try w.writeAll("&[_]*const Package{\n"); | |
| 279 | for (m.deps) |d| { | |
| 280 | if (d.main.len == 0) { | |
| 281 | continue; | |
| 282 | } | |
| 283 | if (d.for_build) { | |
| 284 | continue; | |
| 285 | } | |
| 286 | try w.print(" &package_data._{s},\n", .{d.id[0..12]}); | |
| 287 | } | |
| 288 | try w.writeAll("}"); | |
| 289 | } | |
| 290 | ||
| 291 | fn print_pkg_data_to(w: nfs.File, notdone: *std.array_list.Managed(zigmod.Module), done: *std.array_list.Managed(zigmod.Module)) !void { | |
| 292 | var len: usize = notdone.items.len; | |
| 293 | while (notdone.items.len > 0) { | |
| 294 | for (notdone.items, 0..) |mod, i| { | |
| 295 | if (contains_all(mod.deps, done.items)) { | |
| 296 | try w.print( | |
| 297 | \\ pub const _{s} = Package{{ | |
| 298 | \\ .id = "{s}", | |
| 299 | \\ .directory = dirs._{s}, | |
| 300 | \\ | |
| 301 | , .{ | |
| 302 | mod.short_id(), | |
| 303 | mod.short_id(), | |
| 304 | mod.short_id(), | |
| 305 | }); | |
| 306 | if (mod.main.len > 0 and !std.mem.eql(u8, &mod.id, &zigmod.Module.ROOT)) { | |
| 307 | try w.print( | |
| 308 | \\ .import = .{{ "{s}", .{{ .cwd_relative = dirs._{s} ++ "/{s}" }} }}, | |
| 309 | \\ | |
| 310 | , .{ | |
| 311 | mod.name, | |
| 312 | mod.short_id(), | |
| 313 | mod.main, | |
| 314 | }); | |
| 315 | } | |
| 316 | { | |
| 317 | try w.writeAll(" .dependencies ="); | |
| 318 | try w.writeAll(" &.{"); | |
| 319 | for (mod.deps, 0..) |moddep, j| { | |
| 320 | if (moddep.type == .system_lib) continue; | |
| 321 | if (moddep.type == .framework) continue; | |
| 322 | try w.print(" &_{s}", .{moddep.id[0..12]}); | |
| 323 | if (j != mod.deps.len - 1) try w.writeAll(","); | |
| 324 | } | |
| 325 | try w.writeAll(" },\n"); | |
| 326 | } | |
| 327 | if (mod.c_include_dirs.len > 0) { | |
| 328 | try w.writeAll(" .c_include_dirs = &.{"); | |
| 329 | for (mod.c_include_dirs, 0..) |item, j| { | |
| 330 | try w.print(" \"{}\"", .{u.altStringEscape(item)}); | |
| 331 | if (j != mod.c_include_dirs.len - 1) try w.writeAll(","); | |
| 332 | } | |
| 333 | try w.writeAll(" },\n"); | |
| 334 | } | |
| 335 | if (mod.c_source_files.len > 0) { | |
| 336 | try w.writeAll(" .c_source_files = &.{"); | |
| 337 | for (mod.c_source_files, 0..) |item, j| { | |
| 338 | try w.print(" \"{}\"", .{u.altStringEscape(item)}); | |
| 339 | if (j != mod.c_source_files.len - 1) try w.writeAll(","); | |
| 340 | } | |
| 341 | try w.writeAll(" },\n"); | |
| 342 | } | |
| 343 | if (mod.c_source_flags.len > 0) { | |
| 344 | try w.writeAll(" .c_source_flags = &.{"); | |
| 345 | for (mod.c_source_flags, 0..) |item, j| { | |
| 346 | try w.print(" \"{}\"", .{u.altStringEscape(item)}); | |
| 347 | if (j != mod.c_source_flags.len - 1) try w.writeAll(","); | |
| 348 | } | |
| 349 | try w.writeAll(" },\n"); | |
| 350 | } | |
| 351 | if (mod.has_syslib_deps()) { | |
| 352 | try w.writeAll(" .system_libs = &.{"); | |
| 353 | for (mod.deps, 0..) |item, j| { | |
| 354 | if (!(item.type == .system_lib)) continue; | |
| 355 | try w.print(" \"{}\"", .{u.altStringEscape(item.name)}); | |
| 356 | if (j != mod.deps.len - 1) try w.writeAll(","); | |
| 357 | } | |
| 358 | try w.writeAll(" },\n"); | |
| 359 | } | |
| 360 | if (mod.has_framework_deps()) { | |
| 361 | try w.writeAll(" .frameworks = &.{"); | |
| 362 | for (mod.deps, 0..) |item, j| { | |
| 363 | if (!(item.type == .system_lib)) continue; | |
| 364 | try w.print(" \"{}\"", .{u.altStringEscape(item.name)}); | |
| 365 | if (j != mod.deps.len - 1) try w.writeAll(","); | |
| 366 | } | |
| 367 | try w.writeAll(" },\n"); | |
| 368 | } | |
| 369 | try w.writeAll(" };\n"); | |
| 370 | ||
| 371 | try done.append(mod); | |
| 372 | _ = notdone.orderedRemove(i); | |
| 373 | break; | |
| 374 | } | |
| 375 | } | |
| 376 | if (notdone.items.len == len) { | |
| 377 | u.fail("notdone still has {d} items", .{len}); | |
| 378 | } | |
| 379 | len = notdone.items.len; | |
| 380 | } | |
| 381 | } | |
| 382 | ||
| 383 | /// returns if all of the zig modules in needles are in haystack | |
| 384 | fn contains_all(needles: []zigmod.Module, haystack: []const zigmod.Module) bool { | |
| 385 | for (needles) |item| { | |
| 386 | if (item.main.len > 0 and !extras.containsAggregate(zigmod.Module, haystack, item)) { | |
| 387 | return false; | |
| 388 | } | |
| 389 | } | |
| 390 | return true; | |
| 391 | } | |
| 392 | ||
| 393 | fn print_pkgs(alloc: std.mem.Allocator, w: nfs.File, m: zigmod.Module) !void { | |
| 394 | try w.writeAll("struct {\n"); | |
| 395 | for (m.deps) |d| { | |
| 396 | if (d.main.len == 0) { | |
| 397 | continue; | |
| 398 | } | |
| 399 | if (d.for_build) { | |
| 400 | continue; | |
| 401 | } | |
| 402 | const ident = try zig_name_from_pkg_name(alloc, d.name); | |
| 403 | try w.print(" pub const {s} = &package_data._{s};\n", .{ ident, d.id[0..12] }); | |
| 404 | } | |
| 405 | try w.writeAll("}"); | |
| 406 | } | |
| 407 | ||
| 408 | fn print_imports(alloc: std.mem.Allocator, w: nfs.File, m: zigmod.Module, path: string) !void { | |
| 409 | for (m.deps) |d| { | |
| 410 | if (d.main.len == 0) { | |
| 411 | continue; | |
| 412 | } | |
| 413 | if (!d.for_build) { | |
| 414 | continue; | |
| 415 | } | |
| 416 | const ident = try zig_name_from_pkg_name(alloc, d.name); | |
| 417 | try w.print(" pub const {s} = @import(\"{}/{}/{s}\");\n", .{ ident, u.altStringEscape(path), u.altStringEscape(d.clean_path), d.main }); | |
| 418 | } | |
| 419 | } | |
| 420 | ||
| 421 | fn zig_name_from_pkg_name(alloc: std.mem.Allocator, name: string) !string { | |
| 422 | var legal = name; | |
| 423 | legal = try std.mem.replaceOwned(u8, alloc, legal, "-", "_"); | |
| 424 | legal = try std.mem.replaceOwned(u8, alloc, legal, "/", "_"); | |
| 425 | legal = try std.mem.replaceOwned(u8, alloc, legal, ".", "_"); | |
| 426 | return legal; | |
| 427 | } |
src/cmd/fetch.zig+11-10| ... | ... | @@ -3,6 +3,7 @@ const string = []const u8; |
| 3 | 3 | const ansi = @import("ansi"); |
| 4 | 4 | const extras = @import("extras"); |
| 5 | 5 | const nfs = @import("nfs"); |
| 6 | const nio = @import("nio"); | |
| 6 | 7 | |
| 7 | 8 | const zigmod = @import("../lib.zig"); |
| 8 | 9 | const u = @import("./../util/funcs.zig"); |
| ... | ... | @@ -12,7 +13,7 @@ const license = @import("./license.zig"); |
| 12 | 13 | // |
| 13 | 14 | // |
| 14 | 15 | |
| 15 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 16 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 16 | 17 | _ = self_name; |
| 17 | 18 | |
| 18 | 19 | const gpa = std.heap.c_allocator; |
| ... | ... | @@ -66,8 +67,8 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: nfs.Dir, |
| 66 | 67 | \\ exe.root_module.addImport(pkg.import.?[0], module); |
| 67 | 68 | \\ } |
| 68 | 69 | \\ for (package_data._root.system_libs) |libname| { |
| 69 | \\ exe.linkSystemLibrary(libname); | |
| 70 | \\ exe.linkLibC(); | |
| 70 | \\ exe.root_module.linkSystemLibrary(libname, .{}); | |
| 71 | \\ exe.root_module.link_libc = true; | |
| 71 | 72 | \\ } |
| 72 | 73 | \\ // clear module memo cache so addAllTo can be called more than once in the same build.zig |
| 73 | 74 | \\ module_memo.clearAndFree(exe.step.owner.allocator); |
| ... | ... | @@ -113,27 +114,27 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: nfs.Dir, |
| 113 | 114 | \\ } |
| 114 | 115 | \\ for (self.c_include_dirs) |item| { |
| 115 | 116 | \\ result.addIncludePath(.{ .cwd_relative = (b.fmt("{s}/{s}", .{ self.directory, item })) }); |
| 116 | \\ exe.addIncludePath(.{ .cwd_relative = (b.fmt("{s}/{s}", .{ self.directory, item })) }); | |
| 117 | \\ exe.root_module.addIncludePath(.{ .cwd_relative = (b.fmt("{s}/{s}", .{ self.directory, item })) }); | |
| 117 | 118 | \\ link_lib_c = true; |
| 118 | 119 | \\ } |
| 119 | 120 | \\ for (self.c_source_files) |item| { |
| 120 | \\ exe.addCSourceFile(.{ .file = .{ .cwd_relative = (b.fmt("{s}/{s}", .{ self.directory, item })) }, .flags = self.c_source_flags }); | |
| 121 | \\ exe.root_module.addCSourceFile(.{ .file = .{ .cwd_relative = (b.fmt("{s}/{s}", .{ self.directory, item })) }, .flags = self.c_source_flags }); | |
| 121 | 122 | \\ link_lib_c = true; |
| 122 | 123 | \\ } |
| 123 | 124 | \\ for (self.system_libs) |item| { |
| 124 | 125 | \\ if (skip_libc and std.zig.target.isLibCLibName(&target, item)) continue; |
| 125 | 126 | \\ result.linkSystemLibrary(item, .{}); |
| 126 | \\ exe.linkSystemLibrary(item); | |
| 127 | \\ exe.root_module.linkSystemLibrary(item, .{}); | |
| 127 | 128 | \\ link_lib_c = true; |
| 128 | 129 | \\ } |
| 129 | 130 | \\ for (self.frameworks) |item| { |
| 130 | 131 | \\ result.linkFramework(item, .{}); |
| 131 | \\ exe.linkFramework(item); | |
| 132 | \\ exe.root_module.linkFramework(item, .{}); | |
| 132 | 133 | \\ link_lib_c = true; |
| 133 | 134 | \\ } |
| 134 | 135 | \\ if (link_lib_c and !skip_libc) { |
| 135 | 136 | \\ result.link_libc = true; |
| 136 | \\ exe.linkLibC(); | |
| 137 | \\ exe.root_module.link_libc = true; | |
| 137 | 138 | \\ } |
| 138 | 139 | \\ module_memo.putNoClobber(b.allocator, self.id, result) catch @panic("OOM"); |
| 139 | 140 | \\ return result; |
| ... | ... | @@ -209,8 +210,8 @@ fn diff_lockfile(alloc: std.mem.Allocator) !void { |
| 209 | 210 | |
| 210 | 211 | if (try nfs.cwd().existsDir(".git")) { |
| 211 | 212 | const result = try u.run_cmd_raw(alloc, null, &.{ "git", "diff", "zigmod.lock" }); |
| 212 | var stdout = std.io.fixedBufferStream(result.stdout); | |
| 213 | const r = stdout.reader(); | |
| 213 | var stdout = nio.FixedBufferStream([]const u8).init(result.stdout); | |
| 214 | const r = &stdout; | |
| 214 | 215 | while (try r.readUntilDelimiterOrEofAlloc(alloc, '\n', max)) |line| { |
| 215 | 216 | if (std.mem.startsWith(u8, line, "@@")) break; |
| 216 | 217 | } |
src/cmd/generate.zig+7-7| ... | ... | @@ -10,7 +10,7 @@ const common = @import("./../common.zig"); |
| 10 | 10 | // |
| 11 | 11 | // |
| 12 | 12 | |
| 13 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 13 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 14 | 14 | _ = self_name; |
| 15 | 15 | |
| 16 | 16 | // |
| ... | ... | @@ -70,7 +70,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf |
| 70 | 70 | \\ urlpath = trimPrefix(u8, urlpath, "https://"); |
| 71 | 71 | \\ urlpath = trimPrefix(u8, urlpath, "git://"); |
| 72 | 72 | \\ const repopath = b.fmt("{s}/zigmod/deps/git/{s}/{s}", .{ b.cache_root.path.?, urlpath, commit }); |
| 73 | \\ flip(std.fs.cwd().access(repopath, .{})) catch return result; | |
| 73 | \\ flip(std.Io.Dir.cwd().access(std.Options.debug_io, repopath, .{})) catch return result; | |
| 74 | 74 | \\ |
| 75 | 75 | \\ var clonestep = std.Build.Step.Run.create(b, "clone"); |
| 76 | 76 | \\ clonestep.addArgs(&.{ "git", "clone", "-q", "--progress", url, repopath }); |
| ... | ... | @@ -190,25 +190,25 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf |
| 190 | 190 | \\ } |
| 191 | 191 | \\ for (self.c_include_dirs) |item| { |
| 192 | 192 | \\ result.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }); |
| 193 | \\ dummy_library.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }); | |
| 193 | \\ dummy_library.root_module.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }); | |
| 194 | 194 | \\ link_lib_c = true; |
| 195 | 195 | \\ links += 1; |
| 196 | 196 | \\ } |
| 197 | 197 | \\ for (self.c_source_files) |item| { |
| 198 | \\ dummy_library.addCSourceFile(.{ .file = .{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }, .flags = self.c_source_flags }); | |
| 198 | \\ dummy_library.root_module.addCSourceFile(.{ .file = .{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }, .flags = self.c_source_flags }); | |
| 199 | 199 | \\ links += 1; |
| 200 | 200 | \\ } |
| 201 | 201 | \\ for (self.system_libs) |item| { |
| 202 | 202 | \\ if (std.zig.target.isLibCLibName(&target, item)) continue; |
| 203 | \\ dummy_library.linkSystemLibrary(item); | |
| 203 | \\ dummy_library.root_module.linkSystemLibrary(item, .{}); | |
| 204 | 204 | \\ links += 1; |
| 205 | 205 | \\ } |
| 206 | 206 | \\ for (self.frameworks) |item| { |
| 207 | \\ dummy_library.linkFramework(item); | |
| 207 | \\ dummy_library.root_module.linkFramework(item, .{}); | |
| 208 | 208 | \\ links += 1; |
| 209 | 209 | \\ } |
| 210 | 210 | \\ if (links > 0) { |
| 211 | \\ dummy_library.linkLibC(); | |
| 211 | \\ dummy_library.root_module.linkSystemLibrary("c", .{}); | |
| 212 | 212 | \\ exe.root_module.linkLibrary(dummy_library); |
| 213 | 213 | \\ link_lib_c = true; |
| 214 | 214 | \\ } |
src/cmd/init.zig+4-2| ... | ... | @@ -10,6 +10,7 @@ const time = @import("time"); |
| 10 | 10 | const extras = @import("extras"); |
| 11 | 11 | const nio = @import("nio"); |
| 12 | 12 | const nfs = @import("nfs"); |
| 13 | const root = @import("root"); | |
| 13 | 14 | |
| 14 | 15 | const u = @import("./../util/funcs.zig"); |
| 15 | 16 | const common = @import("./../common.zig"); |
| ... | ... | @@ -18,7 +19,7 @@ const zigmod = @import("./../lib.zig"); |
| 18 | 19 | // |
| 19 | 20 | // |
| 20 | 21 | |
| 21 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 22 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 22 | 23 | _ = self_name; |
| 23 | 24 | |
| 24 | 25 | std.debug.print("This utility will walk you through creating a zigmod.yml file.\n", .{}); |
| ... | ... | @@ -342,7 +343,8 @@ pub fn writeLibManifest(w: nfs.File, id: string, name: string, license: string, |
| 342 | 343 | } |
| 343 | 344 | |
| 344 | 345 | fn guessCopyrightName() !?string { |
| 345 | const homepath = (try knownfolders.getPath(gpa, .home)).?; | |
| 346 | const io = root.io; | |
| 347 | const homepath = (try knownfolders.getPath(io, gpa, root.environ, .home)).?; | |
| 346 | 348 | const home = try nfs.cwd().openDirC(homepath, .{}); |
| 347 | 349 | if (!(try home.exists(".gitconfig"))) return null; |
| 348 | 350 | const file = try home.openFile(".gitconfig", .{}); |
src/cmd/install.zig+23-14| ... | ... | @@ -5,19 +5,21 @@ const knownfolders = @import("known-folders"); |
| 5 | 5 | const extras = @import("extras"); |
| 6 | 6 | const nio = @import("nio"); |
| 7 | 7 | const nfs = @import("nfs"); |
| 8 | const root = @import("root"); | |
| 8 | 9 | |
| 9 | 10 | const zigmod = @import("./../lib.zig"); |
| 10 | 11 | const u = @import("./../util/funcs.zig"); |
| 11 | 12 | const common = @import("./../common.zig"); |
| 12 | 13 | |
| 13 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 14 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 14 | 15 | _ = self_name; |
| 15 | 16 | |
| 16 | 17 | if (args.len < 2) u.fail("usage: zigmod install [git|hg|http] [url]", .{}); |
| 17 | 18 | |
| 18 | const homepath = try knownfolders.getPath(gpa, .home) orelse u.fail("failed to read HOME", .{}); | |
| 19 | const cache = try knownfolders.getPath(gpa, .cache) orelse u.fail("failed to read XDG_CACHE_HOME", .{}); | |
| 20 | const datapath = try knownfolders.getPath(gpa, .data) orelse u.fail("failed to read XDG_DATA_HOME", .{}); | |
| 19 | const io = root.io; | |
| 20 | const homepath = try knownfolders.getPath(io, gpa, root.environ, .home) orelse u.fail("failed to read HOME", .{}); | |
| 21 | const cache = try knownfolders.getPath(io, gpa, root.environ, .cache) orelse u.fail("failed to read XDG_CACHE_HOME", .{}); | |
| 22 | const datapath = try knownfolders.getPath(io, gpa, root.environ, .data) orelse u.fail("failed to read XDG_DATA_HOME", .{}); | |
| 21 | 23 | |
| 22 | 24 | const RemoteType = enum { |
| 23 | 25 | git, |
| ... | ... | @@ -86,7 +88,8 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { |
| 86 | 88 | 0x0000_000c => try @import("./fetch.0.12.zig").create_depszig(gpa, cachepath, moddir, fetch_top_module, &fetch_list), |
| 87 | 89 | 0x0000_000d => try @import("./fetch.0.13.zig").create_depszig(gpa, cachepath, moddir, fetch_top_module, &fetch_list), |
| 88 | 90 | 0x0000_000e => try @import("./fetch.0.14.zig").create_depszig(gpa, cachepath, moddir, fetch_top_module, &fetch_list), |
| 89 | 0x0000_000f => {}, // that's us, zigmod is already 0.15.2 | |
| 91 | 0x0000_000f => try @import("./fetch.0.15.zig").create_depszig(gpa, cachepath, moddir, fetch_top_module, &fetch_list), | |
| 92 | 0x0000_0010 => {}, // that's us, zigmod is already 0.16.0 | |
| 90 | 93 | else => u.fail("zig {d}.{d} unimplemented", .{ version_sct.major, version_sct.minor }), |
| 91 | 94 | } |
| 92 | 95 | |
| ... | ... | @@ -96,14 +99,16 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { |
| 96 | 99 | "--prefix", try std.fs.path.join(gpa, &.{ homepath, ".zigmod" }), |
| 97 | 100 | }; |
| 98 | 101 | logargv(argv) catch return; |
| 99 | var proc = std.process.Child.init(argv, gpa); | |
| 100 | proc.cwd = modpath; | |
| 101 | const term = try proc.spawnAndWait(); | |
| 102 | var proc = try std.process.spawn(io, .{ | |
| 103 | .argv = argv, | |
| 104 | .cwd = .{ .path = modpath }, | |
| 105 | }); | |
| 106 | const term = try proc.wait(io); | |
| 102 | 107 | switch (term) { |
| 103 | .Exited => |v| u.assert(v == 0, "zig build failed with exit code: {d}", .{v}), | |
| 104 | .Signal => |v| u.fail("zig build was stopped with signal: {d}", .{v}), | |
| 105 | .Stopped => |v| u.fail("zig build was stopped with code: {d}", .{v}), | |
| 106 | .Unknown => |v| u.fail("zig build encountered unknown: {d}", .{v}), | |
| 108 | .exited => |v| u.assert(v == 0, "zig build failed with exit code: {d}", .{v}), | |
| 109 | .signal => |v| u.fail("zig build was stopped with signal: {d}", .{v}), | |
| 110 | .stopped => |v| u.fail("zig build was stopped with code: {d}", .{v}), | |
| 111 | .unknown => |v| u.fail("zig build encountered unknown: {d}", .{v}), | |
| 107 | 112 | } |
| 108 | 113 | std.log.info("success!", .{}); |
| 109 | 114 | } |
| ... | ... | @@ -111,9 +116,13 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { |
| 111 | 116 | // needed this after moving to zig 0.15 |
| 112 | 117 | // /zig/0.15.2/lib/std/Io/Writer.zig:1122:51: error: expected type '[]const u8', found '[]const []const u8' |
| 113 | 118 | fn logargv(argv: []const []const u8) !void { |
| 119 | const io = std.Options.debug_io; | |
| 120 | const prev = io.swapCancelProtection(.blocked); | |
| 121 | defer _ = io.swapCancelProtection(prev); | |
| 114 | 122 | var buffer: [64]u8 = undefined; |
| 115 | const stderr = std.debug.lockStderrWriter(&buffer); | |
| 116 | defer std.debug.unlockStderrWriter(); | |
| 123 | const stderrterm = std.debug.lockStderr(&buffer).terminal(); | |
| 124 | defer std.debug.unlockStderr(); | |
| 125 | const stderr = stderrterm.writer; | |
| 117 | 126 | try stderr.writeAll("debug: argv: {"); |
| 118 | 127 | for (argv, 0..) |v, i| { |
| 119 | 128 | if (i > 0) try stderr.writeAll(","); |
src/cmd/license.zig+5-5| ... | ... | @@ -11,12 +11,12 @@ const u = @import("./../util/funcs.zig"); |
| 11 | 11 | const common = @import("./../common.zig"); |
| 12 | 12 | |
| 13 | 13 | const List = std.array_list.Managed(zigmod.Module); |
| 14 | const Map = std.StringArrayHashMap(*List); | |
| 14 | const Map = std.array_hash_map.String(*List); | |
| 15 | 15 | |
| 16 | 16 | // Inspired by: |
| 17 | 17 | // https://github.com/onur/cargo-license |
| 18 | 18 | |
| 19 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 19 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 20 | 20 | _ = self_name; |
| 21 | 21 | _ = args; |
| 22 | 22 | |
| ... | ... | @@ -40,8 +40,8 @@ pub fn do(cachepath: [:0]const u8, dir: nfs.Dir, options: *common.CollectOptions |
| 40 | 40 | try common.collect_pkgs(top_module, &master_list); |
| 41 | 41 | std.mem.sort(zigmod.Module, master_list.items, {}, zigmod.Module.lessThan); |
| 42 | 42 | |
| 43 | var map = Map.init(gpa); | |
| 44 | errdefer map.deinit(); | |
| 43 | var map = Map{}; | |
| 44 | errdefer map.deinit(gpa); | |
| 45 | 45 | |
| 46 | 46 | var unspecified_list = List.init(gpa); |
| 47 | 47 | errdefer unspecified_list.deinit(); |
| ... | ... | @@ -62,7 +62,7 @@ pub fn do(cachepath: [:0]const u8, dir: nfs.Dir, options: *common.CollectOptions |
| 62 | 62 | try unspecified_list.append(item); |
| 63 | 63 | continue; |
| 64 | 64 | } |
| 65 | const map_item = try map.getOrPut(license_code); | |
| 65 | const map_item = try map.getOrPut(gpa, license_code); | |
| 66 | 66 | if (!map_item.found_existing) { |
| 67 | 67 | const temp = try gpa.create(List); |
| 68 | 68 | temp.* = List.init(gpa); |
src/cmd/sum.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ const common = @import("./../common.zig"); |
| 9 | 9 | // |
| 10 | 10 | // |
| 11 | 11 | |
| 12 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 12 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 13 | 13 | _ = self_name; |
| 14 | 14 | _ = args; |
| 15 | 15 |
src/cmd/version.zig+1-1| ... | ... | @@ -8,7 +8,7 @@ const u = @import("./../util/funcs.zig"); |
| 8 | 8 | // |
| 9 | 9 | // |
| 10 | 10 | |
| 11 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 11 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 12 | 12 | _ = self_name; |
| 13 | 13 | _ = args; |
| 14 | 14 |
src/cmd/zpm.zig+4-2| ... | ... | @@ -4,6 +4,7 @@ const gpa = std.heap.c_allocator; |
| 4 | 4 | const extras = @import("extras"); |
| 5 | 5 | const json = @import("json"); |
| 6 | 6 | const nio = @import("nio"); |
| 7 | const root = @import("root"); | |
| 7 | 8 | |
| 8 | 9 | const u = @import("./../util/funcs.zig"); |
| 9 | 10 | |
| ... | ... | @@ -30,7 +31,7 @@ pub const Package = struct { |
| 30 | 31 | links: []const string, |
| 31 | 32 | }; |
| 32 | 33 | |
| 33 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 34 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 34 | 35 | if (args.len == 0) { |
| 35 | 36 | std.debug.print("{s}\n", .{ |
| 36 | 37 | \\This is a subcommand for use with https://github.com/zigtools/zpm-server instances but has no default behavior on its own aside from showing you this nice help text. |
| ... | ... | @@ -57,8 +58,9 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | pub fn server_fetch(url: string) !json.Document { |
| 61 | const io = root.io; | |
| 60 | 62 | var buf: [4096]u8 = @splat(0); |
| 61 | var client: std.http.Client = .{ .allocator = gpa }; | |
| 63 | var client: std.http.Client = .{ .io = io, .allocator = gpa }; | |
| 62 | 64 | defer client.deinit(); |
| 63 | 65 | |
| 64 | 66 | var req = try client.request(.GET, try std.Uri.parse(url), .{ |
src/cmd/zpm/add.zig+4-2| ... | ... | @@ -2,6 +2,7 @@ const std = @import("std"); |
| 2 | 2 | const gpa = std.heap.c_allocator; |
| 3 | 3 | const extras = @import("extras"); |
| 4 | 4 | const nfs = @import("nfs"); |
| 5 | const root = @import("root"); | |
| 5 | 6 | |
| 6 | 7 | const zigmod = @import("../../lib.zig"); |
| 7 | 8 | const u = @import("./../../util/funcs.zig"); |
| ... | ... | @@ -10,7 +11,7 @@ const zpm = @import("./../zpm.zig"); |
| 10 | 11 | // |
| 11 | 12 | // |
| 12 | 13 | |
| 13 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 14 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 14 | 15 | _ = self_name; |
| 15 | 16 | |
| 16 | 17 | const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, "packages" }); |
| ... | ... | @@ -42,8 +43,9 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { |
| 42 | 43 | } |
| 43 | 44 | } |
| 44 | 45 | |
| 46 | const io = root.io; | |
| 45 | 47 | // var buf: [4096]u8 = @splat(0); |
| 46 | var client: std.http.Client = .{ .allocator = gpa }; | |
| 48 | var client: std.http.Client = .{ .io = io, .allocator = gpa }; | |
| 47 | 49 | defer client.deinit(); |
| 48 | 50 | |
| 49 | 51 | const has_zigdotmod = blk: { |
src/cmd/zpm/search.zig+1-1| ... | ... | @@ -8,7 +8,7 @@ const zpm = @import("./../zpm.zig"); |
| 8 | 8 | // |
| 9 | 9 | // |
| 10 | 10 | |
| 11 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 11 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 12 | 12 | _ = self_name; |
| 13 | 13 | _ = args; |
| 14 | 14 |
src/cmd/zpm/showjson.zig+1-1| ... | ... | @@ -7,7 +7,7 @@ const zpm = @import("./../zpm.zig"); |
| 7 | 7 | // |
| 8 | 8 | // |
| 9 | 9 | |
| 10 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 10 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 11 | 11 | _ = self_name; |
| 12 | 12 | |
| 13 | 13 | const out = nfs.stdout(); |
src/cmd/zpm/tags.zig+1-1| ... | ... | @@ -8,7 +8,7 @@ const zpm = @import("./../zpm.zig"); |
| 8 | 8 | // |
| 9 | 9 | // |
| 10 | 10 | |
| 11 | pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | |
| 11 | pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { | |
| 12 | 12 | _ = self_name; |
| 13 | 13 | _ = args; |
| 14 | 14 |
src/main.zig+12-4| ... | ... | @@ -14,12 +14,20 @@ pub const std_options: std.Options = .{ |
| 14 | 14 | .log_level = std.log.Level.debug, |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | pub fn main() !void { | |
| 17 | pub var io: std.Io = undefined; | |
| 18 | pub var environ: *const std.process.Environ.Map = undefined; | |
| 19 | ||
| 20 | pub fn main(init: std.process.Init.Minimal) !void { | |
| 18 | 21 | const gpa = std.heap.c_allocator; |
| 22 | environ = &try init.environ.createMap(gpa); | |
| 23 | ||
| 24 | var threaded: std.Io.Threaded = .init(gpa, .{ .environ = init.environ }); | |
| 25 | defer threaded.deinit(); | |
| 26 | io = threaded.io(); | |
| 19 | 27 | |
| 20 | const proc_args = try std.process.argsAlloc(gpa); | |
| 28 | const proc_args = try init.args.toSlice(gpa); | |
| 21 | 29 | const args = proc_args[1..]; |
| 22 | const self_path = try std.fs.selfExePathAlloc(gpa); | |
| 30 | const self_path = try std.process.executablePathAlloc(io, gpa); | |
| 23 | 31 | |
| 24 | 32 | if (args.len == 0) { |
| 25 | 33 | std.debug.print("zigmod {s} {s} {s} {s}\n", .{ |
| ... | ... | @@ -62,7 +70,7 @@ pub fn main() !void { |
| 62 | 70 | for (args[1..]) |item| { |
| 63 | 71 | try sub_cmd_args.append(item); |
| 64 | 72 | } |
| 65 | const result = std.process.Child.run(.{ .allocator = gpa, .argv = sub_cmd_args.items }) catch |e| switch (e) { | |
| 73 | const result = std.process.run(gpa, io, .{ .argv = sub_cmd_args.items }) catch |e| switch (e) { | |
| 66 | 74 | else => |ee| return ee, |
| 67 | 75 | error.FileNotFound => { |
| 68 | 76 | fail("unknown command \"{s}\" for \"zigmod\"", .{args[0]}); |
src/util/funcs.zig+8-5| ... | ... | @@ -5,6 +5,8 @@ const extras = @import("extras"); |
| 5 | 5 | const git = @import("git"); |
| 6 | 6 | const ansi = @import("ansi"); |
| 7 | 7 | const nfs = @import("nfs"); |
| 8 | const time = @import("time"); | |
| 9 | const root = @import("root"); | |
| 8 | 10 | |
| 9 | 11 | // |
| 10 | 12 | // |
| ... | ... | @@ -44,7 +46,7 @@ pub fn split(alloc: std.mem.Allocator, in: string, delim: u8) ![]string { |
| 44 | 46 | return list.toOwnedSlice(); |
| 45 | 47 | } |
| 46 | 48 | |
| 47 | pub fn file_list(alloc: std.mem.Allocator, dpath: [:0]const u8) ![][:0]u8 { | |
| 49 | pub fn file_list(alloc: std.mem.Allocator, dpath: [:0]const u8) ![]const [:0]const u8 { | |
| 48 | 50 | var dir = try nfs.cwd().openDir(dpath, .{}); |
| 49 | 51 | defer dir.close(); |
| 50 | 52 | var list = std.array_list.Managed([:0]u8).init(alloc); |
| ... | ... | @@ -59,8 +61,9 @@ pub fn file_list(alloc: std.mem.Allocator, dpath: [:0]const u8) ![][:0]u8 { |
| 59 | 61 | return list.toOwnedSlice(); |
| 60 | 62 | } |
| 61 | 63 | |
| 62 | pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.process.Child.RunResult { | |
| 63 | return std.process.Child.run(.{ .allocator = alloc, .cwd = dir, .argv = args, .max_output_bytes = std.math.maxInt(usize) }) catch |e| switch (e) { | |
| 64 | pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.process.RunResult { | |
| 65 | const io = root.io; | |
| 66 | return std.process.run(alloc, io, .{ .cwd = if (dir) |d| .{ .path = d } else .inherit, .argv = args }) catch |e| switch (e) { | |
| 64 | 67 | error.FileNotFound => { |
| 65 | 68 | fail("\"{s}\" command not found", .{args[0]}); |
| 66 | 69 | }, |
| ... | ... | @@ -72,7 +75,7 @@ pub fn run_cmd(alloc: std.mem.Allocator, dir: ?string, args: []const string) !u3 |
| 72 | 75 | const result = try run_cmd_raw(alloc, dir, args); |
| 73 | 76 | alloc.free(result.stdout); |
| 74 | 77 | alloc.free(result.stderr); |
| 75 | return result.term.Exited; | |
| 78 | return result.term.exited; | |
| 76 | 79 | } |
| 77 | 80 | |
| 78 | 81 | pub fn list_remove(alloc: std.mem.Allocator, input: []string, search: string) ![]string { |
| ... | ... | @@ -94,7 +97,7 @@ pub fn last(in: []string) ?string { |
| 94 | 97 | const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"; |
| 95 | 98 | |
| 96 | 99 | pub fn random_string(comptime len: usize) [len]u8 { |
| 97 | const now: u64 = @intCast(std.time.nanoTimestamp()); | |
| 100 | const now: u64 = @intCast(time.nanoTimestamp()); | |
| 98 | 101 | var rand = std.Random.DefaultPrng.init(now); |
| 99 | 102 | var r = rand.random(); |
| 100 | 103 | var buf: [len]u8 = undefined; |
zig.mod+2-2| ... | ... | @@ -3,7 +3,7 @@ name: zigmod |
| 3 | 3 | main: src/lib.zig |
| 4 | 4 | license: MIT |
| 5 | 5 | description: A package manager for the Zig programming language. |
| 6 | min_zig_version: 0.15.2 | |
| 6 | min_zig_version: 0.16.0 | |
| 7 | 7 | min_zigmod_version: r96 |
| 8 | 8 | dependencies: |
| 9 | 9 | - src: git https://github.com/nektro/zig-yaml |
| ... | ... | @@ -13,7 +13,7 @@ dependencies: |
| 13 | 13 | name: known-folders |
| 14 | 14 | main: known-folders.zig |
| 15 | 15 | license: MIT |
| 16 | version: commit-83d39161eac2ed6f37ad3cb4d9dd518696ce90bb | |
| 16 | version: commit-207c34a16e4365edc20d92c7892f962b3bed46e8 | |
| 17 | 17 | - src: git https://github.com/nektro/zig-licenses |
| 18 | 18 | - src: git https://github.com/nektro/zig-detect-license |
| 19 | 19 | - src: git https://github.com/nektro/zig-inquirer |
zigmod.lock+19-19| ... | ... | @@ -1,23 +1,23 @@ |
| 1 | 1 | 2 |
| 2 | 2 | git https://github.com/marlersoft/zigwin32 commit-ec98bb4d9eea532320a8551720a9e3ec6de64994 |
| 3 | git https://github.com/nektro/arqv-ini commit-e229c738bbf5cf0d5464bf9178c17813069a7028 | |
| 4 | git https://github.com/nektro/zig-ansi commit-d1c2ebf3f6c9b0d3aaa74a123d2f0a5657242431 | |
| 5 | git https://github.com/nektro/zig-detect-license commit-e8ea5d969e1062d0be161f7a70e293b52aebc3f3 | |
| 6 | git https://github.com/nektro/zig-extras commit-2cb1b3d619b10f4ad2c870f0359adb0c6129ca67 | |
| 7 | git https://github.com/nektro/zig-git commit-8fdfc351842785192cad01aead798d85e25d1a48 | |
| 8 | git https://github.com/nektro/zig-inquirer commit-3270255ea4c6d919853527e6a73baecfdee6867d | |
| 9 | git https://github.com/nektro/zig-intrusive-parser commit-c21ce202c557a710fba6a2333f33bee7bbea114c | |
| 10 | git https://github.com/nektro/zig-json commit-27d7354d9dc44982f1de40706721aee7d9c998a5 | |
| 11 | git https://github.com/nektro/zig-leven commit-d97ef94cacf5c109b7f4b9e01a7e6645d8c8e09a | |
| 12 | git https://github.com/nektro/zig-licenses commit-f0a95c802d6f955f131dae121550b2ec0acb97ff | |
| 13 | git https://github.com/nektro/zig-licenses-text commit-88dc9ae4c338c652dc231ea477b8e0b56ac36743 | |
| 14 | git https://github.com/nektro/zig-nfs commit-4c6b77b141abab5f6ac70ea712521f062b54df65 | |
| 15 | git https://github.com/nektro/zig-nio commit-42f22d588059efa1e212f97402e94d81d675f28d | |
| 16 | git https://github.com/nektro/zig-sys-darwin commit-3565d27455bd6c9f4650ea691cf4de47f9d229e7 | |
| 17 | git https://github.com/nektro/zig-sys-linux commit-3f07f214aac54bcf8f84975a2312cd91ac67fa04 | |
| 18 | git https://github.com/nektro/zig-time commit-c05c69b92a00b1afd07cb193f5069250e34ce488 | |
| 19 | git https://github.com/nektro/zig-tracer commit-afa0f6df50960f3772b4e0b311ff86521da3e6d5 | |
| 20 | git https://github.com/nektro/zig-yaml commit-fbf3642e7a9e354e2f48751b69ae1c41c0d7b062 | |
| 3 | git https://github.com/nektro/arqv-ini commit-d2465c64833590a04bd9b7f50c87363fd03e65bf | |
| 4 | git https://github.com/nektro/zig-ansi commit-bebb39ae30d9848a1c212cee582d0b1c102d8b87 | |
| 5 | git https://github.com/nektro/zig-detect-license commit-6de79b4ff8f7462e26f224f4bed3c81710c8893b | |
| 6 | git https://github.com/nektro/zig-extras commit-02301520811d7796de6e4f87961a44a6f458f702 | |
| 7 | git https://github.com/nektro/zig-git commit-fec0b7e88951d866fc9196140748e95244232ea1 | |
| 8 | git https://github.com/nektro/zig-inquirer commit-e745b018f87ddc4c8958370332e6cf61625403cc | |
| 9 | git https://github.com/nektro/zig-intrusive-parser commit-cf841a5bb507b03e0e8ed1877bce8b9da4b97e3f | |
| 10 | git https://github.com/nektro/zig-json commit-25dff500aea481527ea3aeaf9526e32b023326c1 | |
| 11 | git https://github.com/nektro/zig-leven commit-014971d4b1e327a5c61322c3a6b9369fd1863864 | |
| 12 | git https://github.com/nektro/zig-licenses commit-bc1cd51625c13d6c7df819fd0d85968e617f5c57 | |
| 13 | git https://github.com/nektro/zig-licenses-text commit-a9d067c3c4d6c226a1de5531b66785bc15d869ee | |
| 14 | git https://github.com/nektro/zig-nfs commit-0e6c256cd96af224511210d877acef60ac07484f | |
| 15 | git https://github.com/nektro/zig-nio commit-6e45c4207fb2e1fc7fb2dbd3ecff28d2a3bfd92c | |
| 16 | git https://github.com/nektro/zig-sys-darwin commit-b96e8bad94f53d5f426a32f237d9e8346f51b8f2 | |
| 17 | git https://github.com/nektro/zig-sys-linux commit-065090fa8b3b1aaac21ff46756116713ff5a30dd | |
| 18 | git https://github.com/nektro/zig-time commit-70ef29a006ceed7379df8801e3889da197de36ce | |
| 19 | git https://github.com/nektro/zig-tracer commit-04c3ad0fbdfb57dea27da0c8cbb75e2539837c92 | |
| 20 | git https://github.com/nektro/zig-yaml commit-dff9fd43ebf1046c70090bdccfeb2e4f1c0d584b | |
| 21 | 21 | git https://github.com/madler/zlib tag-v1.3.2 |
| 22 | 22 | git https://github.com/yaml/libyaml tag-0.2.5 |
| 23 | git https://github.com/ziglibs/known-folders commit-83d39161eac2ed6f37ad3cb4d9dd518696ce90bb | |
| 23 | git https://github.com/ziglibs/known-folders commit-207c34a16e4365edc20d92c7892f962b3bed46e8 |