authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-01-31 11:58:36 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-01-31 11:58:36 -08:00
log810f25e254135fcb1b666f7acb982b05d08ce946
treef935cf6c88f8d1854feeafb0f11b838b403351c3
parentb7cac658821b12f186e7ed21b340f545598e9a59

update to zig 0.8.0-dev.1071+fdc875ed0


10 files changed, 41 insertions(+), 41 deletions(-)

.circleci/config.yml+1-1
...@@ -15,7 +15,7 @@ jobs:...@@ -15,7 +15,7 @@ jobs:
15 - run: git submodule update --init --recursive15 - run: git submodule update --init --recursive
1616
17 - run: apt -y install xz-utils jq17 - run: apt -y install xz-utils jq
18 - run: ./download_zig.sh 0.7.118 - run: ./download_zig.sh 0.8.0-dev.1071+fdc875ed0
19 - run: zig version19 - run: zig version
20 - run: zig env20 - run: zig env
21 - run: ./build_all_zig.sh21 - run: ./build_all_zig.sh
build.zig+2-2
...@@ -9,8 +9,8 @@ pub fn build(b: *Builder) void {...@@ -9,8 +9,8 @@ pub fn build(b: *Builder) void {
9 const mode = b.standardReleaseOptions();9 const mode = b.standardReleaseOptions();
1010
11 const use_full_name = b.option(bool, "use-full-name", "") orelse false;11 const use_full_name = b.option(bool, "use-full-name", "") orelse false;
12 const with_arch_os = b.fmt("-{}-{}", .{@tagName(target.cpu_arch orelse builtin.arch), @tagName(target.os_tag orelse builtin.os.tag)});12 const with_arch_os = b.fmt("-{s}-{s}", .{@tagName(target.cpu_arch orelse builtin.arch), @tagName(target.os_tag orelse builtin.os.tag)});
13 const exe_name = b.fmt("{}{}", .{ "zigmod", if (use_full_name) with_arch_os else "" });13 const exe_name = b.fmt("{s}{s}", .{ "zigmod", if (use_full_name) with_arch_os else "" });
1414
15 const exe = b.addExecutable(exe_name, "src/main.zig");15 const exe = b.addExecutable(exe_name, "src/main.zig");
16 exe.setTarget(target);16 exe.setTarget(target);
build_all_zig.sh+1-1
...@@ -19,5 +19,5 @@ x86_64-macos-gnu...@@ -19,5 +19,5 @@ x86_64-macos-gnu
19for item in $targets19for item in $targets
20do20do
21 echo "$tag-$item"21 echo "$tag-$item"
22 zig build -Dtarget=$item -Drelease -Duse-full-name -Dtag=$tag22 zig build -Dtarget=$item -Duse-full-name -Dtag=$tag
23done23done
src/cmd_add.zig+1-1
...@@ -51,5 +51,5 @@ pub fn execute(args: [][]u8) !void {...@@ -51,5 +51,5 @@ pub fn execute(args: [][]u8) !void {
51 try w.print(" path: {}\n", .{d.path});51 try w.print(" path: {}\n", .{d.path});
52 }52 }
5353
54 u.print("Successfully added {}", .{path});54 u.print("Successfully added {s}", .{path});
55}55}
src/cmd_fetch.zig+22-22
...@@ -22,9 +22,9 @@ pub fn execute(args: [][]u8) !void {...@@ -22,9 +22,9 @@ pub fn execute(args: [][]u8) !void {
22 try w.writeAll("const std = @import(\"std\");\n");22 try w.writeAll("const std = @import(\"std\");\n");
23 try w.writeAll("const build = std.build;\n");23 try w.writeAll("const build = std.build;\n");
24 try w.writeAll("\n");24 try w.writeAll("\n");
25 try w.print("const cache = \"{Z}\";\n", .{dir});25 try w.print("const cache = \"{s}\";\n", .{std.zig.fmtEscapes(dir)});
26 try w.writeAll("\n");26 try w.writeAll("\n");
27 try w.print("{}\n", .{27 try w.print("{s}\n", .{
28 \\pub fn addAllTo(exe: *build.LibExeObjStep) void {28 \\pub fn addAllTo(exe: *build.LibExeObjStep) void {
29 \\ @setEvalBranchQuota(1_000_000);29 \\ @setEvalBranchQuota(1_000_000);
30 \\ for (packages) |pkg| {30 \\ for (packages) |pkg| {
...@@ -57,7 +57,7 @@ pub fn execute(args: [][]u8) !void {...@@ -57,7 +57,7 @@ pub fn execute(args: [][]u8) !void {
57 try print_ids(w, list.items);57 try print_ids(w, list.items);
58 try w.writeAll("};\n\n");58 try w.writeAll("};\n\n");
5959
60 try w.print("pub const _paths = {}\n", .{".{"});60 try w.print("pub const _paths = {s}\n", .{".{"});
61 try print_paths(w, list.items);61 try print_paths(w, list.items);
62 try w.writeAll("};\n\n");62 try w.writeAll("};\n\n");
6363
...@@ -103,7 +103,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {...@@ -103,7 +103,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
103 for (m.deps) |d| {103 for (m.deps) |d| {
104 const p = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path()});104 const p = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path()});
105 const pv = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path_v()});105 const pv = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path_v()});
106 u.print("fetch: {}: {}: {}", .{m.name, @tagName(d.type), d.path});106 u.print("fetch: {s}: {s}: {s}", .{m.name, @tagName(d.type), d.path});
107 moddir = p;107 moddir = p;
108 switch (d.type) {108 switch (d.type) {
109 .system_lib => {109 .system_lib => {
...@@ -121,7 +121,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {...@@ -121,7 +121,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
121 error.IterEmpty => unreachable,121 error.IterEmpty => unreachable,
122 error.NoMemberFound => {122 error.NoMemberFound => {
123 const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?];123 const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?];
124 u.assert(false, "fetch: git: version type '{}' is invalid.", .{vtype});124 u.assert(false, "fetch: git: version type '{s}' is invalid.", .{vtype});
125 unreachable;125 unreachable;
126 },126 },
127 };127 };
...@@ -133,7 +133,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {...@@ -133,7 +133,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
133 break :blk;133 break :blk;
134 }134 }
135 if ((try u.run_cmd(p, &[_][]const u8{"git", "checkout", vers.string})) > 0) {135 if ((try u.run_cmd(p, &[_][]const u8{"git", "checkout", vers.string})) > 0) {
136 u.assert(false, "fetch: git: {}: {} {} does not exist", .{d.path, @tagName(vers.id), vers.string});136 u.assert(false, "fetch: git: {s}: {s} {s} does not exist", .{d.path, @tagName(vers.id), vers.string});
137 } else {137 } else {
138 _ = try u.run_cmd(p, &[_][]const u8{"git", "checkout", "-"});138 _ = try u.run_cmd(p, &[_][]const u8{"git", "checkout", "-"});
139 }139 }
...@@ -169,7 +169,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {...@@ -169,7 +169,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
169 break :blk;169 break :blk;
170 }170 }
171 try u.rm_recv(pv);171 try u.rm_recv(pv);
172 u.assert(false, "{} does not match hash {}", .{d.path, d.version});172 u.assert(false, "{s} does not match hash {s}", .{d.path, d.version});
173 break :blk;173 break :blk;
174 }174 }
175 if (try u.does_folder_exist(p)) {175 if (try u.does_folder_exist(p)) {
...@@ -244,7 +244,7 @@ fn print_ids(w: fs.File.Writer, list: []u.Module) !void {...@@ -244,7 +244,7 @@ fn print_ids(w: fs.File.Writer, list: []u.Module) !void {
244 if (mod.is_sys_lib) {244 if (mod.is_sys_lib) {
245 continue;245 continue;
246 }246 }
247 try w.print(" \"{}\",\n", .{mod.id});247 try w.print(" \"{s}\",\n", .{mod.id});
248 }248 }
249}249}
250250
...@@ -257,7 +257,7 @@ fn print_paths(w: fs.File.Writer, list: []u.Module) !void {...@@ -257,7 +257,7 @@ fn print_paths(w: fs.File.Writer, list: []u.Module) !void {
257 try w.print(" \"\",\n", .{});257 try w.print(" \"\",\n", .{});
258 } else {258 } else {
259 const s = std.fs.path.sep_str;259 const s = std.fs.path.sep_str;
260 try w.print(" \"{Z}{Z}{Z}\",\n", .{s, mod.clean_path, s});260 try w.print(" \"{s}{s}{s}\",\n", .{std.zig.fmtEscapes(s), std.zig.fmtEscapes(mod.clean_path), std.zig.fmtEscapes(s)});
261 }261 }
262 }262 }
263}263}
...@@ -279,13 +279,13 @@ fn print_deps(w: fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32, array:...@@ -279,13 +279,13 @@ fn print_deps(w: fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32, array:
279 continue;279 continue;
280 }280 }
281 if (!array) {281 if (!array) {
282 try w.print(" pub const {} = packages[{}];\n", .{std.mem.replaceOwned(u8, gpa, d.name, "-", "_"), i});282 try w.print(" pub const {s} = packages[{}];\n", .{std.mem.replaceOwned(u8, gpa, d.name, "-", "_"), i});
283 }283 }
284 else {284 else {
285 try w.print(" package_data._{},\n", .{d.id});285 try w.print(" package_data._{s},\n", .{d.id});
286 }286 }
287 }287 }
288 try w.print("{}", .{try u.concat(&[_][]const u8{r,"}"})});288 try w.print("{s}", .{try u.concat(&[_][]const u8{r,"}"})});
289}289}
290290
291fn print_incl_dirs_to(w: fs.File.Writer, list: []u.Module) !void {291fn print_incl_dirs_to(w: fs.File.Writer, list: []u.Module) !void {
...@@ -295,9 +295,9 @@ fn print_incl_dirs_to(w: fs.File.Writer, list: []u.Module) !void {...@@ -295,9 +295,9 @@ fn print_incl_dirs_to(w: fs.File.Writer, list: []u.Module) !void {
295 }295 }
296 for (mod.c_include_dirs) |it| {296 for (mod.c_include_dirs) |it| {
297 if (i > 0) {297 if (i > 0) {
298 try w.print(" cache ++ _paths[{}] ++ \"{Z}\",\n", .{i, it});298 try w.print(" cache ++ _paths[{}] ++ \"{s}\",\n", .{i, std.zig.fmtEscapes(it)});
299 } else {299 } else {
300 try w.print(" \"{Z}\",\n", .{it});300 try w.print(" \"{s}\",\n", .{std.zig.fmtEscapes(it)});
301 }301 }
302 }302 }
303 }303 }
...@@ -310,9 +310,9 @@ fn print_csrc_dirs_to(w: fs.File.Writer, list: []u.Module) !void {...@@ -310,9 +310,9 @@ fn print_csrc_dirs_to(w: fs.File.Writer, list: []u.Module) !void {
310 }310 }
311 for (mod.c_source_files) |it| {311 for (mod.c_source_files) |it| {
312 if (i > 0) {312 if (i > 0) {
313 try w.print(" {}_ids[{}], cache ++ _paths[{}] ++ \"{}\"{},\n", .{"[_][]const u8{", i, i, it, "}"});313 try w.print(" {s}_ids[{}], cache ++ _paths[{}] ++ \"{s}\"{s},\n", .{"[_][]const u8{", i, i, it, "}"});
314 } else {314 } else {
315 try w.print(" {}_ids[{}], \".{}/{}\"{},\n", .{"[_][]const u8{", i, mod.clean_path, it, "}"});315 try w.print(" {s}_ids[{}], \".{s}/{s}\"{s},\n", .{"[_][]const u8{", i, std.zig.fmtEscapes(mod.clean_path), it, "}"});
316 }316 }
317 }317 }
318 }318 }
...@@ -323,11 +323,11 @@ fn print_csrc_flags_to(w: fs.File.Writer, list: []u.Module) !void {...@@ -323,11 +323,11 @@ fn print_csrc_flags_to(w: fs.File.Writer, list: []u.Module) !void {
323 if (mod.is_sys_lib) {323 if (mod.is_sys_lib) {
324 continue;324 continue;
325 }325 }
326 try w.print(" pub const @\"{}\" = {}", .{mod.id, "&[_][]const u8{"});326 try w.print(" pub const @\"{s}\" = {s}", .{mod.id, "&[_][]const u8{"});
327 for (mod.c_source_flags) |it| {327 for (mod.c_source_flags) |it| {
328 try w.print("\"{Z}\",", .{it});328 try w.print("\"{s}\",", .{std.zig.fmtEscapes(it)});
329 }329 }
330 try w.print("{};\n", .{"}"});330 try w.print("{s};\n", .{"}"});
331331
332 }332 }
333}333}
...@@ -337,7 +337,7 @@ fn print_sys_libs_to(w: fs.File.Writer, list: []u.Module, list2: *std.ArrayList(...@@ -337,7 +337,7 @@ fn print_sys_libs_to(w: fs.File.Writer, list: []u.Module, list2: *std.ArrayList(
337 if (!mod.is_sys_lib) {337 if (!mod.is_sys_lib) {
338 continue;338 continue;
339 }339 }
340 try w.print(" \"{}\",\n", .{mod.name});340 try w.print(" \"{s}\",\n", .{mod.name});
341 }341 }
342}342}
343343
...@@ -357,10 +357,10 @@ fn print_pkg_data_to(w: fs.File.Writer, list: *std.ArrayList(u.Module), list2: *...@@ -357,10 +357,10 @@ fn print_pkg_data_to(w: fs.File.Writer, list: *std.ArrayList(u.Module), list2: *
357 while (i < list.items.len) : (i += 1) {357 while (i < list.items.len) : (i += 1) {
358 const mod = list.items[i];358 const mod = list.items[i];
359 if (contains_all(mod.deps, list2)) {359 if (contains_all(mod.deps, list2)) {
360 try w.print(" pub const _{} = build.Pkg{{ .name = \"{}\", .path = cache ++ \"/{Z}/{}\", .dependencies = &[_]build.Pkg{{", .{mod.id, mod.name, mod.clean_path, mod.main});360 try w.print(" pub const _{s} = build.Pkg{{ .name = \"{s}\", .path = cache ++ \"/{s}/{s}\", .dependencies = &[_]build.Pkg{{", .{mod.id, mod.name, std.zig.fmtEscapes(mod.clean_path), mod.main});
361 for (mod.deps) |d| {361 for (mod.deps) |d| {
362 if (d.main.len > 0) {362 if (d.main.len > 0) {
363 try w.print(" _{},", .{d.id});363 try w.print(" _{s},", .{d.id});
364 }364 }
365 }365 }
366 try w.print(" }} }};\n", .{});366 try w.print(" }} }};\n", .{});
src/cmd_init.zig+4-4
...@@ -14,12 +14,12 @@ pub fn execute(args: [][]u8) !void {...@@ -14,12 +14,12 @@ pub fn execute(args: [][]u8) !void {
14 defer file.close();14 defer file.close();
1515
16 const fwriter = file.writer();16 const fwriter = file.writer();
17 try fwriter.print("id: {}\n", .{u.random_string(48)});17 try fwriter.print("id: {s}\n", .{u.random_string(48)});
18 try fwriter.print("name: {}\n", .{name});18 try fwriter.print("name: {s}\n", .{name});
19 try fwriter.print("main: {}\n", .{mainf});19 try fwriter.print("main: {s}\n", .{mainf});
20 try fwriter.print("dependencies:\n", .{});20 try fwriter.print("dependencies:\n", .{});
2121
22 u.print("Initialized a new package named {} with entry point {}", .{name, mainf});22 u.print("Initialized a new package named {s} with entry point {s}", .{name, mainf});
23}23}
2424
25fn detect_pkgname(def: []const u8) ![]const u8 {25fn detect_pkgname(def: []const u8) ![]const u8 {
src/cmd_sum.zig+1-1
...@@ -25,7 +25,7 @@ pub fn execute(args: [][]u8) !void {...@@ -25,7 +25,7 @@ pub fn execute(args: [][]u8) !void {
2525
26 for (module_list.items) |m| {26 for (module_list.items) |m| {
27 const hash = try m.get_hash(dir);27 const hash = try m.get_hash(dir);
28 try w.print("{} {}\n", .{hash, m.clean_path});28 try w.print("{s} {s}\n", .{hash, m.clean_path});
29 }29 }
30}30}
3131
src/common.zig+1-1
...@@ -17,7 +17,7 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {...@@ -17,7 +17,7 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
17 if (try u.does_file_exist(pv)) {17 if (try u.does_file_exist(pv)) {
18 moddir = pv;18 moddir = pv;
19 } else {19 } else {
20 u.assert(try u.does_file_exist(p), "unable to find dep: {} {}, please run zigmod fetch", .{d.path, d.version});20 u.assert(try u.does_file_exist(p), "unable to find dep: {s} {s}, please run zigmod fetch", .{d.path, d.version});
21 moddir = p;21 moddir = p;
22 }22 }
23 switch (d.type) {23 switch (d.type) {
src/main.zig+3-3
...@@ -21,7 +21,7 @@ pub fn main() !void {...@@ -21,7 +21,7 @@ pub fn main() !void {
21 const args = proc_args[1..];21 const args = proc_args[1..];
2222
23 if (args.len == 0) {23 if (args.len == 0) {
24 u.print("zigmod {} {} {} {}", .{24 u.print("zigmod {s} {s} {s} {s}", .{
25 @import("build_options").version,25 @import("build_options").version,
26 @tagName(builtin.os.tag),26 @tagName(builtin.os.tag),
27 @tagName(builtin.arch),27 @tagName(builtin.arch),
...@@ -39,14 +39,14 @@ pub fn main() !void {...@@ -39,14 +39,14 @@ pub fn main() !void {
39 }39 }
4040
41 var sub_cmd_args = &std.ArrayList([]const u8).init(gpa);41 var sub_cmd_args = &std.ArrayList([]const u8).init(gpa);
42 try sub_cmd_args.append(try std.fmt.allocPrint(gpa, "zigmod-{}", .{args[0]}));42 try sub_cmd_args.append(try std.fmt.allocPrint(gpa, "zigmod-{s}", .{args[0]}));
43 for (args[1..]) |item| {43 for (args[1..]) |item| {
44 try sub_cmd_args.append(item);44 try sub_cmd_args.append(item);
45 }45 }
46 const result = std.ChildProcess.exec(.{ .allocator = gpa, .argv = sub_cmd_args.items, }) catch |e| switch(e) {46 const result = std.ChildProcess.exec(.{ .allocator = gpa, .argv = sub_cmd_args.items, }) catch |e| switch(e) {
47 else => return e,47 else => return e,
48 error.FileNotFound => {48 error.FileNotFound => {
49 u.assert(false, "unknown command \"{}\" for \"zigmod\"", .{args[0]});49 u.assert(false, "unknown command \"{s}\" for \"zigmod\"", .{args[0]});
50 unreachable;50 unreachable;
51 },51 },
52 };52 };
src/util/funcs.zig+5-5
...@@ -98,7 +98,7 @@ pub fn repeat(s: []const u8, times: i32) ![]const u8 {...@@ -98,7 +98,7 @@ pub fn repeat(s: []const u8, times: i32) ![]const u8 {
98pub fn join(xs: [][]const u8, delim: []const u8) ![]const u8 {98pub fn join(xs: [][]const u8, delim: []const u8) ![]const u8 {
99 var res: []const u8 = "";99 var res: []const u8 = "";
100 for (xs) |x, i| {100 for (xs) |x, i| {
101 res = try std.fmt.allocPrint(gpa, "{}{}{}", .{res, x, if (i < xs.len-1) delim else ""});101 res = try std.fmt.allocPrint(gpa, "{s}{s}{s}", .{res, x, if (i < xs.len-1) delim else ""});
102 }102 }
103 return res;103 return res;
104}104}
...@@ -106,7 +106,7 @@ pub fn join(xs: [][]const u8, delim: []const u8) ![]const u8 {...@@ -106,7 +106,7 @@ pub fn join(xs: [][]const u8, delim: []const u8) ![]const u8 {
106pub fn concat(items: [][]const u8) ![]const u8 {106pub fn concat(items: [][]const u8) ![]const u8 {
107 var buf: []const u8 = "";107 var buf: []const u8 = "";
108 for (items) |x| {108 for (items) |x| {
109 buf = try std.fmt.allocPrint(gpa, "{}{}", .{buf, x});109 buf = try std.fmt.allocPrint(gpa, "{s}{s}", .{buf, x});
110 }110 }
111 return buf;111 return buf;
112}112}
...@@ -114,9 +114,9 @@ pub fn concat(items: [][]const u8) ![]const u8 {...@@ -114,9 +114,9 @@ pub fn concat(items: [][]const u8) ![]const u8 {
114pub fn print_all(w: std.fs.File.Writer, items: anytype, ln: bool) !void {114pub fn print_all(w: std.fs.File.Writer, items: anytype, ln: bool) !void {
115 inline for (items) |x, i| {115 inline for (items) |x, i| {
116 if (i == 0) {116 if (i == 0) {
117 try w.print("{}", .{x});117 try w.print("{s}", .{x});
118 } else {118 } else {
119 try w.print(" {}", .{x});119 try w.print(" {s}", .{x});
120 }120 }
121 }121 }
122 if (ln) {122 if (ln) {
...@@ -160,7 +160,7 @@ pub fn file_list(dpath: []const u8, list: *std.ArrayList([]const u8)) !void {...@@ -160,7 +160,7 @@ pub fn file_list(dpath: []const u8, list: *std.ArrayList([]const u8)) !void {
160pub fn run_cmd(dir: ?[]const u8, args: []const []const u8) !u32 {160pub fn run_cmd(dir: ?[]const u8, args: []const []const u8) !u32 {
161 const result = std.ChildProcess.exec(.{ .allocator = gpa, .cwd = dir, .argv = args, }) catch |e| switch(e) {161 const result = std.ChildProcess.exec(.{ .allocator = gpa, .cwd = dir, .argv = args, }) catch |e| switch(e) {
162 error.FileNotFound => {162 error.FileNotFound => {
163 u.assert(false, "\"{}\" command not found", .{args[0]});163 u.assert(false, "\"{s}\" command not found", .{args[0]});
164 unreachable;164 unreachable;
165 },165 },
166 else => return e,166 else => return e,