diff --git a/.circleci/config.yml b/.circleci/config.yml index 68fbfe772b96457173dfa191352797178ffa45bd..a91d85604218664b4557cb6fd5064f04f5a267bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ jobs: - run: git submodule update --init --recursive - run: apt -y install xz-utils jq - - run: ./download_zig.sh 0.9.0-dev.1815+20e19e75f + - run: ./download_zig.sh 0.9.0 - run: zig version - run: zig env - run: zig build -Dbootstrap diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 95353e19bfd793029987c149061762b270b591bd..1b86feda3f9aba48f5cb94cdba427b8b1d4e2dc0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -28,7 +28,7 @@ jobs: - name: Setup Zig uses: goto-bus-stop/setup-zig@v1 with: - version: 0.9.0-dev.1815+20e19e75f + version: "0.9.0" - run: zig version - run: zig env diff --git a/README.md b/README.md index cc8871cd29b3d2f730d665703afb98872c1192d0..6aaf0113a370f8e2df5aa722ef9ec835d24fd6e3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A package manager for the Zig programming language. - https://github.com/nektro/zigmod/releases ## Built With -- Zig master `0.9.0-dev.1524+d2f9646d9` +- Zig master `0.9.0` - See [`zig.mod`](./zig.mod) ### Build from Source diff --git a/docs/README.md b/docs/README.md index d31e525b1dfdd06d1c9abe28dadf7490b21e3072..236b47cdb15ce194f0fcb8b9e9ddf8eef6a031d9 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.9.0-dev.1524+d2f9646d9`. +The earliest Zig release this Zigmod was verified to work with is `0.9.0`. ## Download You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source. diff --git a/src/cmd/aq.zig b/src/cmd/aq.zig index 250845c1cee00b46dc17e8f3bf57bb884e7a3896..da112069e3a008a63541f54adcde03e957b1ffca 100644 --- a/src/cmd/aq.zig +++ b/src/cmd/aq.zig @@ -20,7 +20,7 @@ pub const server_root = "https://aquila.red"; pub fn execute(args: [][]u8) !void { if (args.len == 0) { - std.debug.warn("{s}\n", .{ + std.debug.print("{s}\n", .{ \\This is a subcommand for use with https://github.com/nektro/aquila instances but has no default behavior on its own aside from showing you this nice help text. \\ \\The default remote is https://aquila.red. diff --git a/src/cmd/zpm.zig b/src/cmd/zpm.zig index 95aac3463128248cac2e62fe52373e5d1ba9de84..09adebfc501506564913d8d3bc7f97a7d6612888 100644 --- a/src/cmd/zpm.zig +++ b/src/cmd/zpm.zig @@ -30,7 +30,7 @@ pub const Package = struct { pub fn execute(args: [][]u8) !void { if (args.len == 0) { - std.debug.warn("{s}\n", .{ + std.debug.print("{s}\n", .{ \\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. \\ \\The default remote is https://zpm.random-projects.net/. diff --git a/src/common.zig b/src/common.zig index 640189ab68c84192e60563f12726207e4cbbf2e7..eb5f8c3edd5f1a3ca7b892574269d080506bcc4a 100644 --- a/src/common.zig +++ b/src/common.zig @@ -19,7 +19,7 @@ pub const CollectOptions = struct { log: bool, update: bool, lock: ?[]const [4]string = null, - alloc: *std.mem.Allocator, + alloc: std.mem.Allocator, already_fetched: *std.ArrayList(string) = undefined, pub fn init(self: *CollectOptions) !void { @@ -286,7 +286,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: string, options: *CollectO } } -pub fn add_files_package(alloc: *std.mem.Allocator, cachepath: string, pkg_name: string, mdir: std.fs.Dir, dirs: []const string) !zigmod.Module { +pub fn add_files_package(alloc: std.mem.Allocator, cachepath: string, pkg_name: string, mdir: std.fs.Dir, dirs: []const string) !zigmod.Module { const fname = try std.mem.join(alloc, "", &.{ pkg_name, ".zig" }); const map = &std.StringHashMap(string).init(alloc); @@ -300,7 +300,7 @@ pub fn add_files_package(alloc: *std.mem.Allocator, cachepath: string, pkg_name: if (p.kind == .Directory) { continue; } - const path = try std.mem.dupe(alloc, u8, p.path); + const path = try alloc.dupe(u8, p.path); try map.put(path, try std.fmt.allocPrint(alloc, "{s}/{s}", .{ dir_path, path })); } } @@ -350,7 +350,7 @@ pub fn add_files_package(alloc: *std.mem.Allocator, cachepath: string, pkg_name: return (try get_module_from_dep(&d, filesdestpath, &options)).?; } -pub fn parse_lockfile(alloc: *std.mem.Allocator, dir: std.fs.Dir) ![]const [4]string { +pub fn parse_lockfile(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const [4]string { var list = std.ArrayList([4]string).init(alloc); const max = std.math.maxInt(usize); const f = try dir.openFile("zigmod.lock", .{}); diff --git a/src/util/dep.zig b/src/util/dep.zig index ead849861ed52b6bbae6e9d452ef132cd4b0c7ab..c29e57b0dc99525c61c00b25d9e2d7f7eb0c8c18 100644 --- a/src/util/dep.zig +++ b/src/util/dep.zig @@ -12,7 +12,7 @@ const yaml = @import("./yaml.zig"); pub const Dep = struct { const Self = @This(); - alloc: *std.mem.Allocator, + alloc: std.mem.Allocator, type: zigmod.DepType, path: string, id: string, diff --git a/src/util/dep_type.zig b/src/util/dep_type.zig index 040bf6fbcc6e2d2ab6ffa6eefb0cf383b054cd7f..d30dbe6d64f116533c8ae964651474d128d6fe13 100644 --- a/src/util/dep_type.zig +++ b/src/util/dep_type.zig @@ -32,7 +32,7 @@ pub const DepType = enum { // hypercore, // https://hypercore-protocol.org/ // zig fmt: on - pub fn pull(self: DepType, alloc: *std.mem.Allocator, rpath: string, dpath: string) !void { + pub fn pull(self: DepType, alloc: std.mem.Allocator, rpath: string, dpath: string) !void { switch (self) { .local => {}, .system_lib => {}, @@ -57,7 +57,7 @@ pub const DepType = enum { } // zig fmt: on - pub fn update(self: DepType, alloc: *std.mem.Allocator, dpath: string, rpath: string) !void { + pub fn update(self: DepType, alloc: std.mem.Allocator, dpath: string, rpath: string) !void { _ = rpath; switch (self) { @@ -77,7 +77,7 @@ pub const DepType = enum { } // zig fmt: on - pub fn exact_version(self: DepType, alloc: *std.mem.Allocator, mpath: string) !string { + pub fn exact_version(self: DepType, alloc: std.mem.Allocator, mpath: string) !string { var mdir = try std.fs.cwd().openDir(mpath, .{}); defer mdir.close(); return switch (self) { diff --git a/src/util/funcs.zig b/src/util/funcs.zig index b84c562c5913118661b6ab17e750d90e2f74c26c..a7fbad06c8720c20bd76db354b4033c40157e808 100644 --- a/src/util/funcs.zig +++ b/src/util/funcs.zig @@ -37,7 +37,7 @@ pub fn try_index(comptime T: type, array: []T, n: usize, def: T) T { return array[n]; } -pub fn split(alloc: *std.mem.Allocator, in: string, delim: string) ![]string { +pub fn split(alloc: std.mem.Allocator, in: string, delim: string) ![]string { var list = std.ArrayList(string).init(alloc); defer list.deinit(); @@ -113,7 +113,7 @@ pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool return false; } -pub fn file_list(alloc: *std.mem.Allocator, dpath: string) ![]const string { +pub fn file_list(alloc: std.mem.Allocator, dpath: string) ![]const string { var list = std.ArrayList(string).init(alloc); defer list.deinit(); @@ -133,7 +133,7 @@ pub fn file_list(alloc: *std.mem.Allocator, dpath: string) ![]const string { return list.toOwnedSlice(); } -pub fn run_cmd_raw(alloc: *std.mem.Allocator, dir: ?string, args: []const string) !std.ChildProcess.ExecResult { +pub fn run_cmd_raw(alloc: std.mem.Allocator, dir: ?string, args: []const string) !std.ChildProcess.ExecResult { return std.ChildProcess.exec(.{ .allocator = alloc, .cwd = dir, .argv = args, .max_output_bytes = std.math.maxInt(usize) }) catch |e| switch (e) { error.FileNotFound => { u.fail("\"{s}\" command not found", .{args[0]}); @@ -142,14 +142,14 @@ pub fn run_cmd_raw(alloc: *std.mem.Allocator, dir: ?string, args: []const string }; } -pub fn run_cmd(alloc: *std.mem.Allocator, dir: ?string, args: []const string) !u32 { +pub fn run_cmd(alloc: std.mem.Allocator, dir: ?string, args: []const string) !u32 { const result = try run_cmd_raw(alloc, dir, args); alloc.free(result.stdout); alloc.free(result.stderr); return result.term.Exited; } -pub fn list_remove(alloc: *std.mem.Allocator, input: []string, search: string) ![]string { +pub fn list_remove(alloc: std.mem.Allocator, input: []string, search: string) ![]string { var list = std.ArrayList(string).init(alloc); defer list.deinit(); for (input) |item| { @@ -169,7 +169,7 @@ pub fn last(in: []string) !string { const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"; -pub fn random_string(alloc: *std.mem.Allocator, len: usize) !string { +pub fn random_string(alloc: std.mem.Allocator, len: usize) !string { const now = @intCast(u64, std.time.nanoTimestamp()); var rand = std.rand.DefaultPrng.init(now); const r = &rand.random(); @@ -206,7 +206,7 @@ pub const HashFn = enum { sha512, }; -pub fn validate_hash(alloc: *std.mem.Allocator, input: string, file_path: string) !bool { +pub fn validate_hash(alloc: std.mem.Allocator, input: string, file_path: string) !bool { const hash = parse_split(HashFn, "-").do(input) catch return false; const file = try std.fs.cwd().openFile(file_path, .{}); defer file.close(); @@ -224,7 +224,7 @@ pub fn validate_hash(alloc: *std.mem.Allocator, input: string, file_path: string return result; } -pub fn do_hash(alloc: *std.mem.Allocator, comptime algo: type, data: string) !string { +pub fn do_hash(alloc: std.mem.Allocator, comptime algo: type, data: string) !string { const h = &algo.init(.{}); var out: [algo.digest_length]u8 = undefined; h.update(data); @@ -234,7 +234,7 @@ pub fn do_hash(alloc: *std.mem.Allocator, comptime algo: type, data: string) !st } /// Returns the result of running `git rev-parse HEAD` -pub fn git_rev_HEAD(alloc: *std.mem.Allocator, dir: std.fs.Dir) !string { +pub fn git_rev_HEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !string { const max = std.math.maxInt(usize); const dirg = try dir.openDir(".git", .{}); const h = std.mem.trim(u8, try dirg.readFileAlloc(alloc, "HEAD", max), "\n"); @@ -248,7 +248,7 @@ pub fn slice(comptime T: type, input: []const T, from: usize, to: usize) []const return input[f..t]; } -pub fn detect_pkgname(alloc: *std.mem.Allocator, override: string, dir: string) !string { +pub fn detect_pkgname(alloc: std.mem.Allocator, override: string, dir: string) !string { if (override.len > 0) { return override; } @@ -264,7 +264,7 @@ pub fn detect_pkgname(alloc: *std.mem.Allocator, override: string, dir: string) return name; } -pub fn detct_mainfile(alloc: *std.mem.Allocator, override: string, dir: ?std.fs.Dir, name: string) !string { +pub fn detct_mainfile(alloc: std.mem.Allocator, override: string, dir: ?std.fs.Dir, name: string) !string { if (override.len > 0) { if (try does_file_exist(dir, override)) { if (std.mem.endsWith(u8, override, ".zig")) { diff --git a/src/util/modfile.zig b/src/util/modfile.zig index 598d5a231710fd28e3c00afb36f43450e0c9f8b1..d97a433add94555d93aad2e185f59507f9cf7c35 100644 --- a/src/util/modfile.zig +++ b/src/util/modfile.zig @@ -28,7 +28,7 @@ pub const ModFile = struct { rootdeps: []zigmod.Dep, builddeps: []zigmod.Dep, - pub fn init(alloc: *std.mem.Allocator, mpath: string) !Self { + pub fn init(alloc: std.mem.Allocator, mpath: string) !Self { const file = try std.fs.cwd().openFile(mpath, .{}); defer file.close(); const input = try file.reader().readAllAlloc(alloc, mb); @@ -36,7 +36,7 @@ pub const ModFile = struct { return from_mapping(alloc, doc.mapping); } - pub fn from_dir(alloc: *std.mem.Allocator, dir: std.fs.Dir) !Self { + pub fn from_dir(alloc: std.mem.Allocator, dir: std.fs.Dir) !Self { const file = try dir.openFile("zig.mod", .{}); defer file.close(); const input = try file.reader().readAllAlloc(alloc, mb); @@ -44,7 +44,7 @@ pub const ModFile = struct { return from_mapping(alloc, doc.mapping); } - pub fn from_mapping(alloc: *std.mem.Allocator, mapping: yaml.Mapping) !Self { + pub fn from_mapping(alloc: std.mem.Allocator, mapping: yaml.Mapping) !Self { const id = mapping.get_string("id"); const name = mapping.get("name").?.string; const main = mapping.get_string("main"); @@ -69,7 +69,7 @@ pub const ModFile = struct { }; } - fn dep_list_by_name(alloc: *std.mem.Allocator, mapping: yaml.Mapping, props: []const string, for_build: bool) anyerror![]zigmod.Dep { + fn dep_list_by_name(alloc: std.mem.Allocator, mapping: yaml.Mapping, props: []const string, for_build: bool) anyerror![]zigmod.Dep { var dep_list = std.ArrayList(zigmod.Dep).init(alloc); defer dep_list.deinit(); diff --git a/src/util/module.zig b/src/util/module.zig index 1d5540d03894e6f8c21e535fd8d01f0d7bfd4634..562a6fc468bc8182d401cff5910632da9c6a5f05 100644 --- a/src/util/module.zig +++ b/src/util/module.zig @@ -11,7 +11,7 @@ const common = @import("./../common.zig"); // pub const Module = struct { - alloc: *std.mem.Allocator, + alloc: std.mem.Allocator, is_sys_lib: bool, id: string, name: string, @@ -27,7 +27,7 @@ pub const Module = struct { dep: ?zigmod.Dep, for_build: bool = false, - pub fn from(alloc: *std.mem.Allocator, dep: zigmod.Dep, modpath: string, options: *common.CollectOptions) !Module { + pub fn from(alloc: std.mem.Allocator, dep: zigmod.Dep, modpath: string, options: *common.CollectOptions) !Module { var moddeps = std.ArrayList(Module).init(alloc); defer moddeps.deinit(); diff --git a/src/util/yaml.zig b/src/util/yaml.zig index a10807be1f7fa558115dce542389964cc0e1781f..3ae35a154fb1ee715a76715069c01f594cee34f9 100644 --- a/src/util/yaml.zig +++ b/src/util/yaml.zig @@ -110,7 +110,7 @@ pub const Mapping = struct { return if (self.get(k)) |v| v.string else ""; } - pub fn get_string_array(self: Mapping, alloc: *std.mem.Allocator, k: string) ![]string { + pub fn get_string_array(self: Mapping, alloc: std.mem.Allocator, k: string) ![]string { var list = std.ArrayList(string).init(alloc); defer list.deinit(); if (self.get(k)) |val| { @@ -145,7 +145,7 @@ pub const TokenList = []const Token; // // -pub fn parse(alloc: *std.mem.Allocator, input: string) !Document { +pub fn parse(alloc: std.mem.Allocator, input: string) !Document { var parser: c.yaml_parser_t = undefined; _ = c.yaml_parser_initialize(&parser); defer c.yaml_parser_delete(&parser); @@ -182,7 +182,7 @@ pub fn parse(alloc: *std.mem.Allocator, input: string) !Document { } pub const Parser = struct { - alloc: *std.mem.Allocator, + alloc: std.mem.Allocator, tokens: TokenList, lines: []const string, index: usize, diff --git a/zigmod.lock b/zigmod.lock index cfe45c74ccea39eb62a772f696f42c4d392e4f22..56f476bf5c58997a485bd2c67109e2ae1759457a 100644 --- a/zigmod.lock +++ b/zigmod.lock @@ -1,20 +1,20 @@ 2 git https://github.com/yaml/libyaml tag-0.2.5 -git https://github.com/nektro/iguanaTLS commit-a48976beb7135b472ce8aa2f276df3b8eb775440 +git https://github.com/nektro/iguanaTLS commit-d49c382a52c2c10dee940d22c3e0a034d0cbac5a git https://github.com/nektro/zig-ansi commit-d4a53bcac5b87abecc65491109ec22aaf5f3dc2f -git https://github.com/ziglibs/known-folders commit-f299244d787a02dd49bc8b10b8c2722a13655c48 +git https://github.com/ziglibs/known-folders commit-9db1b99219c767d5e24994b1525273fe4031e464 git https://github.com/nektro/zig-licenses commit-c9b8cbf3565675a056ad4e9b57cb4f84020e7680 -git https://github.com/truemedian/zfetch commit-77fdd34e90db02f1224cdc7e5231ecd004ff1200 -git https://github.com/truemedian/hzzp commit-91ab8e741992e8db30b3ee1cd9e7cd5a072ca294 -git https://github.com/MasterQ32/zig-network commit-7b0be9a4cde7169531872ee1ca6a75ad3f15cc7c -git https://github.com/MasterQ32/zig-uri commit-52cdd2061bec0579519f0d30280597f3a1db8b75 -git https://github.com/nektro/zig-json commit-7f0e661371d41cfdc8b1649ed00e7a750c82e57a -git https://github.com/nektro/zig-extras commit-090ee5f1834af4ed7714101b24d7daec84572390 +git https://github.com/truemedian/zfetch commit-d7c0424d4251f23c9e3f87878e4d8687128a5d13 +git https://github.com/truemedian/hzzp commit-bf5aaf224e94561e035a631c3c40fbf02faa27d2 +git https://github.com/MasterQ32/zig-network commit-b9c52822f3bb3ce25164a2f1f6eedee4d1c0a279 +git https://github.com/MasterQ32/zig-uri commit-01155026c8362bb75dcab10bafc31abff0c8bac4 +git https://github.com/nektro/zig-json commit-908ecfa6d611f3ee0d9d89434e7494a653cfd5e1 +git https://github.com/nektro/zig-extras commit-3db31a0787846ce5b3133fe02f9cbcaa815ae80b git https://github.com/nektro/zig-range commit-890ca308fe09b3d5c866d5cfb3b3d7a95dbf939f -git https://github.com/nektro/zig-detect-license commit-d4544410f811c402b866f21f63588d1aae1b2d90 +git https://github.com/nektro/zig-detect-license commit-fe045f9399c532d01ff87d956d8387017636f675 git https://github.com/nektro/zig-licenses-text commit-3c07c6e4eb0965dafd0b029c632f823631b3169c -git https://github.com/nektro/zig-leven commit-8e9f827117ab1418578b692a2325754cc3ee692d +git https://github.com/nektro/zig-leven commit-ab852cf74fa0b4edc530d925f0654b62c60365bf git https://github.com/nektro/zig-fs-check commit-dcd8da90fcb8bf3c9887e713bf0ec072bc897dd5 -git https://github.com/nektro/zig-inquirer commit-9a068122c59ac2785f330c37bf4412aed644ed37 -git https://github.com/arqv/ini commit-0880475514e8b73dee515843cb4db3ee663174e8 -git https://github.com/marlersoft/zigwin32 commit-7685bb92610ba4f34e0077eb2b6263fa6f1f36c5 +git https://github.com/nektro/zig-inquirer commit-14c3492c46f9765c3e77436741794d1a3118cbee +git https://github.com/arqv/ini commit-b93f5b5ff9449f9af68ae3081f6a5e858b6698d9 +git https://github.com/marlersoft/zigwin32 commit-a74c9dae6a1ccd361eb9a1d146a09c08d22f02b0