| author | |
| committer | |
| log | 345ff6f14e0cf40ddcf2fb6ec9634d868f55acb5 |
| tree | 7d2e522de9a68d8e042df848ca21231ecf78d5be |
| parent | 28b2b44a90ac0e37fbaf991d5e85e85b597a8205 |
11 files changed, 51 insertions(+), 49 deletions(-)
build.zig+8-8| ... | ... | @@ -24,7 +24,7 @@ pub fn build(b: *Builder) void { |
| 24 | 24 | exe.linkLibC(); |
| 25 | 25 | |
| 26 | 26 | exe.addIncludeDir("./libs/yaml/include"); |
| 27 | exe.addCSourceFile("./libs/yaml/src/api.c", &[_][]const u8{ | |
| 27 | exe.addCSourceFile("./libs/yaml/src/api.c", &.{ | |
| 28 | 28 | // taken from https://github.com/yaml/libyaml/blob/0.2.5/CMakeLists.txt#L5-L8 |
| 29 | 29 | "-DYAML_VERSION_MAJOR=0", |
| 30 | 30 | "-DYAML_VERSION_MINOR=2", |
| ... | ... | @@ -32,13 +32,13 @@ pub fn build(b: *Builder) void { |
| 32 | 32 | "-DYAML_VERSION_STRING=\"0.2.5\"", |
| 33 | 33 | "-DYAML_DECLARE_STATIC=1", |
| 34 | 34 | }); |
| 35 | exe.addCSourceFile("./libs/yaml/src/dumper.c", &[_][]const u8{}); | |
| 36 | exe.addCSourceFile("./libs/yaml/src/emitter.c", &[_][]const u8{}); | |
| 37 | exe.addCSourceFile("./libs/yaml/src/loader.c", &[_][]const u8{}); | |
| 38 | exe.addCSourceFile("./libs/yaml/src/parser.c", &[_][]const u8{}); | |
| 39 | exe.addCSourceFile("./libs/yaml/src/reader.c", &[_][]const u8{}); | |
| 40 | exe.addCSourceFile("./libs/yaml/src/scanner.c", &[_][]const u8{}); | |
| 41 | exe.addCSourceFile("./libs/yaml/src/writer.c", &[_][]const u8{}); | |
| 35 | exe.addCSourceFile("./libs/yaml/src/dumper.c", &.{}); | |
| 36 | exe.addCSourceFile("./libs/yaml/src/emitter.c", &.{}); | |
| 37 | exe.addCSourceFile("./libs/yaml/src/loader.c", &.{}); | |
| 38 | exe.addCSourceFile("./libs/yaml/src/parser.c", &.{}); | |
| 39 | exe.addCSourceFile("./libs/yaml/src/reader.c", &.{}); | |
| 40 | exe.addCSourceFile("./libs/yaml/src/scanner.c", &.{}); | |
| 41 | exe.addCSourceFile("./libs/yaml/src/writer.c", &.{}); | |
| 42 | 42 | |
| 43 | 43 | exe.addPackagePath("ansi", "./libs/zig-ansi/src/lib.zig"); |
| 44 | 44 | } |
deps.zig+9-7| ... | ... | @@ -75,13 +75,15 @@ pub const c_include_dirs = &[_][]const u8{ |
| 75 | 75 | }; |
| 76 | 76 | |
| 77 | 77 | pub const c_source_flags = struct { |
| 78 | pub const @"89ujp8gq842x6mzok8feypwze138n2d96zpugw44hcq7406r" = &[_][]const u8{}; | |
| 79 | pub const @"8mdbh0zuneb0i3hs5jby5je0heem1i6yxusl7c8y8qx68hqc" = &[_][]const u8{"-DYAML_VERSION_MAJOR=0","-DYAML_VERSION_MINOR=2","-DYAML_VERSION_PATCH=5","-DYAML_VERSION_STRING=\"0.2.5\"","-DYAML_DECLARE_STATIC=1",}; | |
| 80 | pub const @"s84v9o48ucb0xq0cmzq0cn433hgw0iaqztugja16h8bzxu3h" = &[_][]const u8{}; | |
| 81 | pub const @"2ta738wrqbaqzl3iwzoo8nj35k9ynwz5p5iyz80ryrpp4ttf" = &[_][]const u8{}; | |
| 82 | pub const @"2b7mq571jmq31ktmpigopu29480iw245heueajgxzxn7ab8o" = &[_][]const u8{}; | |
| 83 | pub const @"csbnipaad8n77buaszsnjvlmn6j173fl7pkprsctelswjywe" = &[_][]const u8{}; | |
| 84 | pub const @"0npcrzfdlrvkf44mzjo8bduj9gmqyefo0j3rstt6b0pm2r6r" = &[_][]const u8{}; | |
| 78 | pub const @"89ujp8gq842x6mzok8feypwze138n2d96zpugw44hcq7406r" = &.{}; | |
| 79 | pub const @"8mdbh0zuneb0i3hs5jby5je0heem1i6yxusl7c8y8qx68hqc" = &.{"-DYAML_VERSION_MAJOR=0","-DYAML_VERSION_MINOR=2","-DYAML_VERSION_PATCH=5","-DYAML_VERSION_STRING=\"0.2.5\"","-DYAML_DECLARE_STATIC=1",}; | |
| 80 | pub const @"s84v9o48ucb0xq0cmzq0cn433hgw0iaqztugja16h8bzxu3h" = &.{}; | |
| 81 | pub const @"2ta738wrqbaqzl3iwzoo8nj35k9ynwz5p5iyz80ryrpp4ttf" = &.{}; | |
| 82 | pub const @"2b7mq571jmq31ktmpigopu29480iw245heueajgxzxn7ab8o" = &.{}; | |
| 83 | pub const @"csbnipaad8n77buaszsnjvlmn6j173fl7pkprsctelswjywe" = &.{}; | |
| 84 | pub const @"0npcrzfdlrvkf44mzjo8bduj9gmqyefo0j3rstt6b0pm2r6r" = &.{}; | |
| 85 | pub const @"aoe2l16htluewam6bfwvv0khsbbno8g8jd7suonifg74u7kd" = &.{}; | |
| 86 | pub const @"icwsahmjjop2lcplra9m76n7oyganb81qismvfrsmv0iisxs" = &.{}; | |
| 85 | 87 | }; |
| 86 | 88 | |
| 87 | 89 | pub const c_source_files = &[_][2][]const u8{ |
src/cmd/license.zig+1-1| ... | ... | @@ -18,7 +18,7 @@ const Map = std.StringArrayHashMap(*List); |
| 18 | 18 | |
| 19 | 19 | pub fn execute(args: [][]u8) !void { |
| 20 | 20 | // |
| 21 | const dir = try std.fs.path.join(gpa, &[_][]const u8{".zigmod", "deps"}); | |
| 21 | const dir = try std.fs.path.join(gpa, &.{".zigmod", "deps"}); | |
| 22 | 22 | |
| 23 | 23 | const top_module = try common.collect_deps(dir, "zig.mod", .{ |
| 24 | 24 | .log = false, |
src/cmd_fetch.zig+3-3| ... | ... | @@ -11,7 +11,7 @@ const common = @import("./common.zig"); |
| 11 | 11 | |
| 12 | 12 | pub fn execute(args: [][]u8) !void { |
| 13 | 13 | // |
| 14 | const dir = try fs.path.join(gpa, &[_][]const u8{".zigmod", "deps"}); | |
| 14 | const dir = try fs.path.join(gpa, &.{".zigmod", "deps"}); | |
| 15 | 15 | |
| 16 | 16 | const top_module = try common.collect_deps(dir, "zig.mod", .{ |
| 17 | 17 | .log = true, |
| ... | ... | @@ -146,7 +146,7 @@ fn print_deps(w: fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32, array: |
| 146 | 146 | try w.print(" package_data._{s},\n", .{d.id}); |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | try w.print("{s}", .{try u.concat(&[_][]const u8{r,"}"})}); | |
| 149 | try w.print("{s}", .{try u.concat(&.{r,"}"})}); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | fn print_incl_dirs_to(w: fs.File.Writer, list: []u.Module) !void { |
| ... | ... | @@ -184,7 +184,7 @@ fn print_csrc_flags_to(w: fs.File.Writer, list: []u.Module) !void { |
| 184 | 184 | if (mod.is_sys_lib) { |
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | try w.print(" pub const @\"{s}\" = {s}", .{mod.id, "&[_][]const u8{"}); | |
| 187 | try w.print(" pub const @\"{s}\" = {s}", .{mod.id, "&.{"}); | |
| 188 | 188 | for (mod.c_source_flags) |it| { |
| 189 | 189 | try w.print("\"{s}\",", .{std.zig.fmtEscapes(it)}); |
| 190 | 190 | } |
src/cmd_init.zig+2-2| ... | ... | @@ -42,10 +42,10 @@ fn detct_mainfile(def: []const u8) ![]const u8 { |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | if (try u.does_file_exist(try std.fs.path.join(gpa, &[_][]const u8{"src", "lib.zig"}))) { | |
| 45 | if (try u.does_file_exist(try std.fs.path.join(gpa, &.{"src", "lib.zig"}))) { | |
| 46 | 46 | return "src/lib.zig"; |
| 47 | 47 | } |
| 48 | if (try u.does_file_exist(try std.fs.path.join(gpa, &[_][]const u8{"src", "main.zig"}))) { | |
| 48 | if (try u.does_file_exist(try std.fs.path.join(gpa, &.{"src", "main.zig"}))) { | |
| 49 | 49 | return "src/main.zig"; |
| 50 | 50 | } |
| 51 | 51 | u.assert(false, "unable to detect package entry point", .{}); |
src/cmd_sum.zig+1-1| ... | ... | @@ -10,7 +10,7 @@ const common = @import("./common.zig"); |
| 10 | 10 | |
| 11 | 11 | pub fn execute(args: [][]u8) !void { |
| 12 | 12 | // |
| 13 | const dir = try std.fs.path.join(gpa, &[_][]const u8{".zigmod", "deps"}); | |
| 13 | const dir = try std.fs.path.join(gpa, &.{".zigmod", "deps"}); | |
| 14 | 14 | |
| 15 | 15 | const top_module = try common.collect_deps(dir, "zig.mod", .{ |
| 16 | 16 | .log = false, |
src/common.zig+13-13| ... | ... | @@ -17,8 +17,8 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec |
| 17 | 17 | const moduledeps = &std.ArrayList(u.Module).init(gpa); |
| 18 | 18 | var moddir: []const u8 = undefined; |
| 19 | 19 | for (m.deps) |d| { |
| 20 | const p = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path()}); | |
| 21 | const pv = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path_v()}); | |
| 20 | const p = try fs.path.join(gpa, &.{dir, try d.clean_path()}); | |
| 21 | const pv = try fs.path.join(gpa, &.{dir, try d.clean_path_v()}); | |
| 22 | 22 | if (options.log) { u.print("fetch: {s}: {s}: {s}", .{m.name, @tagName(d.type), d.path}); } |
| 23 | 23 | moddir = p; |
| 24 | 24 | switch (d.type) { |
| ... | ... | @@ -48,13 +48,13 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec |
| 48 | 48 | moddir = pv; |
| 49 | 49 | break :blk; |
| 50 | 50 | } |
| 51 | if ((try u.run_cmd(p, &[_][]const u8{"git", "checkout", vers.string})) > 0) { | |
| 51 | if ((try u.run_cmd(p, &.{"git", "checkout", vers.string})) > 0) { | |
| 52 | 52 | u.assert(false, "fetch: git: {s}: {s} {s} does not exist", .{d.path, @tagName(vers.id), vers.string}); |
| 53 | 53 | } else { |
| 54 | _ = try u.run_cmd(p, &[_][]const u8{"git", "checkout", "-"}); | |
| 54 | _ = try u.run_cmd(p, &.{"git", "checkout", "-"}); | |
| 55 | 55 | } |
| 56 | 56 | try d.type.pull(d.path, pv); |
| 57 | _ = try u.run_cmd(pv, &[_][]const u8{"git", "checkout", vers.string}); | |
| 57 | _ = try u.run_cmd(pv, &.{"git", "checkout", vers.string}); | |
| 58 | 58 | if (vers.id != .branch) { |
| 59 | 59 | const pvd = try std.fs.cwd().openDir(pv, .{}); |
| 60 | 60 | try pvd.deleteTree(".git"); |
| ... | ... | @@ -77,7 +77,7 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec |
| 77 | 77 | } |
| 78 | 78 | const file_name = try u.last(try u.split(d.path, "/")); |
| 79 | 79 | if (d.version.len > 0) { |
| 80 | const file_path = try std.fs.path.join(gpa, &[_][]const u8{pv, file_name}); | |
| 80 | const file_path = try std.fs.path.join(gpa, &.{pv, file_name}); | |
| 81 | 81 | try d.type.pull(d.path, pv); |
| 82 | 82 | if (try u.validate_hash(try u.last(try u.split(pv, "/")), file_path)) { |
| 83 | 83 | try std.fs.deleteFileAbsolute(file_path); |
| ... | ... | @@ -91,7 +91,7 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec |
| 91 | 91 | if (try u.does_folder_exist(p)) { |
| 92 | 92 | try u.rm_recv(p); |
| 93 | 93 | } |
| 94 | const file_path = try std.fs.path.join(gpa, &[_][]const u8{p, file_name}); | |
| 94 | const file_path = try std.fs.path.join(gpa, &.{p, file_name}); | |
| 95 | 95 | try d.type.pull(d.path, p); |
| 96 | 96 | try std.fs.deleteFileAbsolute(file_path); |
| 97 | 97 | }, |
| ... | ... | @@ -105,16 +105,16 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec |
| 105 | 105 | .only_os = d.only_os, |
| 106 | 106 | .except_os = d.except_os, |
| 107 | 107 | .main = "", |
| 108 | .c_include_dirs = &[_][]const u8{}, | |
| 109 | .c_source_flags = &[_][]const u8{}, | |
| 110 | .c_source_files = &[_][]const u8{}, | |
| 108 | .c_include_dirs = &.{}, | |
| 109 | .c_source_flags = &.{}, | |
| 110 | .c_source_files = &.{}, | |
| 111 | 111 | .deps = &[_]u.Module{}, |
| 112 | 112 | .clean_path = d.path, |
| 113 | 113 | .yaml = null, |
| 114 | 114 | }); |
| 115 | 115 | }, |
| 116 | 116 | else => blk: { |
| 117 | var dd = try collect_deps(dir, try u.concat(&[_][]const u8{moddir, "/zig.mod"}), options) catch |e| switch (e) { | |
| 117 | var dd = try collect_deps(dir, try u.concat(&.{moddir, "/zig.mod"}), options) catch |e| switch (e) { | |
| 118 | 118 | error.FileNotFound => { |
| 119 | 119 | if (d.main.len > 0 or d.c_include_dirs.len > 0 or d.c_source_files.len > 0) { |
| 120 | 120 | var mod_from = try u.Module.from(d); |
| ... | ... | @@ -151,8 +151,8 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec |
| 151 | 151 | .c_source_files = m.c_source_files, |
| 152 | 152 | .deps = moduledeps.items, |
| 153 | 153 | .clean_path = "", |
| 154 | .only_os = &[_][]const u8{}, | |
| 155 | .except_os = &[_][]const u8{}, | |
| 154 | .only_os = &.{}, | |
| 155 | .except_os = &.{}, | |
| 156 | 156 | .yaml = m.yaml, |
| 157 | 157 | }; |
| 158 | 158 | } |
src/util/dep.zig+3-3| ... | ... | @@ -29,15 +29,15 @@ pub const Dep = struct { |
| 29 | 29 | p = u.trim_prefix(p, "https://"); |
| 30 | 30 | p = u.trim_prefix(p, "git://"); |
| 31 | 31 | p = u.trim_suffix(u8, p, ".git"); |
| 32 | p = try std.mem.join(gpa, "/", &[_][]const u8{@tagName(self.type), p}); | |
| 32 | p = try std.mem.join(gpa, "/", &.{@tagName(self.type), p}); | |
| 33 | 33 | return p; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | pub fn clean_path_v(self: Dep) ![]const u8 { |
| 37 | 37 | if (self.type == .http and self.version.len > 0) { |
| 38 | return std.mem.join(gpa, "/", &[_][]const u8{"v", @tagName(self.type), self.version}); | |
| 38 | return std.mem.join(gpa, "/", &.{"v", @tagName(self.type), self.version}); | |
| 39 | 39 | } |
| 40 | return std.mem.join(gpa, "/", &[_][]const u8{"v", try self.clean_path(), self.version}); | |
| 40 | return std.mem.join(gpa, "/", &.{"v", try self.clean_path(), self.version}); | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | pub fn is_for_this(self: Dep) bool { |
src/util/dep_type.zig+8-8| ... | ... | @@ -16,17 +16,17 @@ pub const DepType = enum { |
| 16 | 16 | switch (self) { |
| 17 | 17 | .system_lib => {}, |
| 18 | 18 | .git => { |
| 19 | _ = try u.run_cmd(null, &[_][]const u8{"git", "clone", "--recurse-submodules", rpath, dpath}); | |
| 19 | _ = try u.run_cmd(null, &.{"git", "clone", "--recurse-submodules", rpath, dpath}); | |
| 20 | 20 | }, |
| 21 | 21 | .hg => { |
| 22 | _ = try u.run_cmd(null, &[_][]const u8{"hg", "clone", rpath, dpath}); | |
| 22 | _ = try u.run_cmd(null, &.{"hg", "clone", rpath, dpath}); | |
| 23 | 23 | }, |
| 24 | 24 | .http => { |
| 25 | 25 | try u.mkdir_all(dpath); |
| 26 | _ = try u.run_cmd(dpath, &[_][]const u8{"wget", rpath}); | |
| 26 | _ = try u.run_cmd(dpath, &.{"wget", rpath}); | |
| 27 | 27 | const f = rpath[std.mem.lastIndexOf(u8, rpath, "/").?+1..]; |
| 28 | 28 | if (std.mem.endsWith(u8, f, ".zip")) { |
| 29 | _ = try u.run_cmd(dpath, &[_][]const u8{"unzip", f, "-d", "."}); | |
| 29 | _ = try u.run_cmd(dpath, &.{"unzip", f, "-d", "."}); | |
| 30 | 30 | } |
| 31 | 31 | if ( |
| 32 | 32 | std.mem.endsWith(u8, f, ".tar") |
| ... | ... | @@ -34,7 +34,7 @@ pub const DepType = enum { |
| 34 | 34 | or std.mem.endsWith(u8, f, ".tar.xz") |
| 35 | 35 | or std.mem.endsWith(u8, f, ".tar.zst") |
| 36 | 36 | ) { |
| 37 | _ = try u.run_cmd(dpath, &[_][]const u8{"tar", "-xf", f, "-C", "."}); | |
| 37 | _ = try u.run_cmd(dpath, &.{"tar", "-xf", f, "-C", "."}); | |
| 38 | 38 | } |
| 39 | 39 | }, |
| 40 | 40 | } |
| ... | ... | @@ -44,11 +44,11 @@ pub const DepType = enum { |
| 44 | 44 | switch (self) { |
| 45 | 45 | .system_lib => {}, |
| 46 | 46 | .git => { |
| 47 | _ = try u.run_cmd(dpath, &[_][]const u8{"git", "fetch"}); | |
| 48 | _ = try u.run_cmd(dpath, &[_][]const u8{"git", "pull"}); | |
| 47 | _ = try u.run_cmd(dpath, &.{"git", "fetch"}); | |
| 48 | _ = try u.run_cmd(dpath, &.{"git", "pull"}); | |
| 49 | 49 | }, |
| 50 | 50 | .hg => { |
| 51 | _ = try u.run_cmd(dpath, &[_][]const u8{"hg", "pull"}); | |
| 51 | _ = try u.run_cmd(dpath, &.{"hg", "pull"}); | |
| 52 | 52 | }, |
| 53 | 53 | .http => { |
| 54 | 54 | // |
src/util/funcs.zig+1-1| ... | ... | @@ -210,7 +210,7 @@ pub fn rm_recv(path: []const u8) anyerror!void { |
| 210 | 210 | const dir = std.fs.cwd().openDir(abs_path, .{ .iterate=true, }) catch unreachable; |
| 211 | 211 | var iter = dir.iterate(); |
| 212 | 212 | while (try iter.next()) |item| { |
| 213 | try rm_recv(try std.fs.path.join(gpa, &[_][]const u8{abs_path, item.name})); | |
| 213 | try rm_recv(try std.fs.path.join(gpa, &.{abs_path, item.name})); | |
| 214 | 214 | } |
| 215 | 215 | try std.fs.deleteDirAbsolute(abs_path); |
| 216 | 216 | } |
src/util/module.zig+2-2| ... | ... | @@ -46,7 +46,7 @@ pub const Module = struct { |
| 46 | 46 | |
| 47 | 47 | pub fn get_hash(self: Module, cdpath: []const u8) ![]const u8 { |
| 48 | 48 | const file_list_1 = &std.ArrayList([]const u8).init(gpa); |
| 49 | try u.file_list(try u.concat(&[_][]const u8{cdpath, "/", self.clean_path}), file_list_1); | |
| 49 | try u.file_list(try u.concat(&.{cdpath, "/", self.clean_path}), file_list_1); | |
| 50 | 50 | |
| 51 | 51 | const file_list_2 = &std.ArrayList([]const u8).init(gpa); |
| 52 | 52 | for (file_list_1.items) |item| { |
| ... | ... | @@ -64,7 +64,7 @@ pub const Module = struct { |
| 64 | 64 | |
| 65 | 65 | const h = &std.crypto.hash.Blake3.init(.{}); |
| 66 | 66 | for (file_list_2.items) |item| { |
| 67 | const abs_path = try u.concat(&[_][]const u8{cdpath, "/", self.clean_path, "/", item}); | |
| 67 | const abs_path = try u.concat(&.{cdpath, "/", self.clean_path, "/", item}); | |
| 68 | 68 | const file = try std.fs.cwd().openFile(abs_path, .{}); |
| 69 | 69 | defer file.close(); |
| 70 | 70 | const input = try file.reader().readAllAlloc(gpa, u.mb*100); |