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:
1515 - run: git submodule update --init --recursive
1616
1717 - run: apt -y install xz-utils jq
18 - run: ./download_zig.sh 0.7.1
18 - run: ./download_zig.sh 0.8.0-dev.1071+fdc875ed0
1919 - run: zig version
2020 - run: zig env
2121 - run: ./build_all_zig.sh
build.zig+2-2
......@@ -9,8 +9,8 @@ pub fn build(b: *Builder) void {
99 const mode = b.standardReleaseOptions();
1010
1111 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)});
13 const exe_name = b.fmt("{}{}", .{ "zigmod", if (use_full_name) with_arch_os else "" });
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("{s}{s}", .{ "zigmod", if (use_full_name) with_arch_os else "" });
1414
1515 const exe = b.addExecutable(exe_name, "src/main.zig");
1616 exe.setTarget(target);
build_all_zig.sh+1-1
......@@ -19,5 +19,5 @@ x86_64-macos-gnu
1919for item in $targets
2020do
2121 echo "$tag-$item"
22 zig build -Dtarget=$item -Drelease -Duse-full-name -Dtag=$tag
22 zig build -Dtarget=$item -Duse-full-name -Dtag=$tag
2323done
src/cmd_add.zig+1-1
......@@ -51,5 +51,5 @@ pub fn execute(args: [][]u8) !void {
5151 try w.print(" path: {}\n", .{d.path});
5252 }
5353
54 u.print("Successfully added {}", .{path});
54 u.print("Successfully added {s}", .{path});
5555}
src/cmd_fetch.zig+22-22
......@@ -22,9 +22,9 @@ pub fn execute(args: [][]u8) !void {
2222 try w.writeAll("const std = @import(\"std\");\n");
2323 try w.writeAll("const build = std.build;\n");
2424 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)});
2626 try w.writeAll("\n");
27 try w.print("{}\n", .{
27 try w.print("{s}\n", .{
2828 \\pub fn addAllTo(exe: *build.LibExeObjStep) void {
2929 \\ @setEvalBranchQuota(1_000_000);
3030 \\ for (packages) |pkg| {
......@@ -57,7 +57,7 @@ pub fn execute(args: [][]u8) !void {
5757 try print_ids(w, list.items);
5858 try w.writeAll("};\n\n");
5959
60 try w.print("pub const _paths = {}\n", .{".{"});
60 try w.print("pub const _paths = {s}\n", .{".{"});
6161 try print_paths(w, list.items);
6262 try w.writeAll("};\n\n");
6363
......@@ -103,7 +103,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
103103 for (m.deps) |d| {
104104 const p = try fs.path.join(gpa, &[_][]const u8{dir, try d.clean_path()});
105105 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});
107107 moddir = p;
108108 switch (d.type) {
109109 .system_lib => {
......@@ -121,7 +121,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
121121 error.IterEmpty => unreachable,
122122 error.NoMemberFound => {
123123 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});
125125 unreachable;
126126 },
127127 };
......@@ -133,7 +133,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
133133 break :blk;
134134 }
135135 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});
137137 } else {
138138 _ = try u.run_cmd(p, &[_][]const u8{"git", "checkout", "-"});
139139 }
......@@ -169,7 +169,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
169169 break :blk;
170170 }
171171 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});
173173 break :blk;
174174 }
175175 if (try u.does_folder_exist(p)) {
......@@ -244,7 +244,7 @@ fn print_ids(w: fs.File.Writer, list: []u.Module) !void {
244244 if (mod.is_sys_lib) {
245245 continue;
246246 }
247 try w.print(" \"{}\",\n", .{mod.id});
247 try w.print(" \"{s}\",\n", .{mod.id});
248248 }
249249}
250250
......@@ -257,7 +257,7 @@ fn print_paths(w: fs.File.Writer, list: []u.Module) !void {
257257 try w.print(" \"\",\n", .{});
258258 } else {
259259 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)});
261261 }
262262 }
263263}
......@@ -279,13 +279,13 @@ fn print_deps(w: fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32, array:
279279 continue;
280280 }
281281 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});
283283 }
284284 else {
285 try w.print(" package_data._{},\n", .{d.id});
285 try w.print(" package_data._{s},\n", .{d.id});
286286 }
287287 }
288 try w.print("{}", .{try u.concat(&[_][]const u8{r,"}"})});
288 try w.print("{s}", .{try u.concat(&[_][]const u8{r,"}"})});
289289}
290290
291291fn 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 {
295295 }
296296 for (mod.c_include_dirs) |it| {
297297 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)});
299299 } else {
300 try w.print(" \"{Z}\",\n", .{it});
300 try w.print(" \"{s}\",\n", .{std.zig.fmtEscapes(it)});
301301 }
302302 }
303303 }
......@@ -310,9 +310,9 @@ fn print_csrc_dirs_to(w: fs.File.Writer, list: []u.Module) !void {
310310 }
311311 for (mod.c_source_files) |it| {
312312 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, "}"});
314314 } 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, "}"});
316316 }
317317 }
318318 }
......@@ -323,11 +323,11 @@ fn print_csrc_flags_to(w: fs.File.Writer, list: []u.Module) !void {
323323 if (mod.is_sys_lib) {
324324 continue;
325325 }
326 try w.print(" pub const @\"{}\" = {}", .{mod.id, "&[_][]const u8{"});
326 try w.print(" pub const @\"{s}\" = {s}", .{mod.id, "&[_][]const u8{"});
327327 for (mod.c_source_flags) |it| {
328 try w.print("\"{Z}\",", .{it});
328 try w.print("\"{s}\",", .{std.zig.fmtEscapes(it)});
329329 }
330 try w.print("{};\n", .{"}"});
330 try w.print("{s};\n", .{"}"});
331331
332332 }
333333}
......@@ -337,7 +337,7 @@ fn print_sys_libs_to(w: fs.File.Writer, list: []u.Module, list2: *std.ArrayList(
337337 if (!mod.is_sys_lib) {
338338 continue;
339339 }
340 try w.print(" \"{}\",\n", .{mod.name});
340 try w.print(" \"{s}\",\n", .{mod.name});
341341 }
342342}
343343
......@@ -357,10 +357,10 @@ fn print_pkg_data_to(w: fs.File.Writer, list: *std.ArrayList(u.Module), list2: *
357357 while (i < list.items.len) : (i += 1) {
358358 const mod = list.items[i];
359359 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});
361361 for (mod.deps) |d| {
362362 if (d.main.len > 0) {
363 try w.print(" _{},", .{d.id});
363 try w.print(" _{s},", .{d.id});
364364 }
365365 }
366366 try w.print(" }} }};\n", .{});
src/cmd_init.zig+4-4
......@@ -14,12 +14,12 @@ pub fn execute(args: [][]u8) !void {
1414 defer file.close();
1515
1616 const fwriter = file.writer();
17 try fwriter.print("id: {}\n", .{u.random_string(48)});
18 try fwriter.print("name: {}\n", .{name});
19 try fwriter.print("main: {}\n", .{mainf});
17 try fwriter.print("id: {s}\n", .{u.random_string(48)});
18 try fwriter.print("name: {s}\n", .{name});
19 try fwriter.print("main: {s}\n", .{mainf});
2020 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});
2323}
2424
2525fn detect_pkgname(def: []const u8) ![]const u8 {
src/cmd_sum.zig+1-1
......@@ -25,7 +25,7 @@ pub fn execute(args: [][]u8) !void {
2525
2626 for (module_list.items) |m| {
2727 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});
2929 }
3030}
3131
src/common.zig+1-1
......@@ -17,7 +17,7 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
1717 if (try u.does_file_exist(pv)) {
1818 moddir = pv;
1919 } 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});
2121 moddir = p;
2222 }
2323 switch (d.type) {
src/main.zig+3-3
......@@ -21,7 +21,7 @@ pub fn main() !void {
2121 const args = proc_args[1..];
2222
2323 if (args.len == 0) {
24 u.print("zigmod {} {} {} {}", .{
24 u.print("zigmod {s} {s} {s} {s}", .{
2525 @import("build_options").version,
2626 @tagName(builtin.os.tag),
2727 @tagName(builtin.arch),
......@@ -39,14 +39,14 @@ pub fn main() !void {
3939 }
4040
4141 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]}));
4343 for (args[1..]) |item| {
4444 try sub_cmd_args.append(item);
4545 }
4646 const result = std.ChildProcess.exec(.{ .allocator = gpa, .argv = sub_cmd_args.items, }) catch |e| switch(e) {
4747 else => return e,
4848 error.FileNotFound => {
49 u.assert(false, "unknown command \"{}\" for \"zigmod\"", .{args[0]});
49 u.assert(false, "unknown command \"{s}\" for \"zigmod\"", .{args[0]});
5050 unreachable;
5151 },
5252 };
src/util/funcs.zig+5-5
......@@ -98,7 +98,7 @@ pub fn repeat(s: []const u8, times: i32) ![]const u8 {
9898pub fn join(xs: [][]const u8, delim: []const u8) ![]const u8 {
9999 var res: []const u8 = "";
100100 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 ""});
102102 }
103103 return res;
104104}
......@@ -106,7 +106,7 @@ pub fn join(xs: [][]const u8, delim: []const u8) ![]const u8 {
106106pub fn concat(items: [][]const u8) ![]const u8 {
107107 var buf: []const u8 = "";
108108 for (items) |x| {
109 buf = try std.fmt.allocPrint(gpa, "{}{}", .{buf, x});
109 buf = try std.fmt.allocPrint(gpa, "{s}{s}", .{buf, x});
110110 }
111111 return buf;
112112}
......@@ -114,9 +114,9 @@ pub fn concat(items: [][]const u8) ![]const u8 {
114114pub fn print_all(w: std.fs.File.Writer, items: anytype, ln: bool) !void {
115115 inline for (items) |x, i| {
116116 if (i == 0) {
117 try w.print("{}", .{x});
117 try w.print("{s}", .{x});
118118 } else {
119 try w.print(" {}", .{x});
119 try w.print(" {s}", .{x});
120120 }
121121 }
122122 if (ln) {
......@@ -160,7 +160,7 @@ pub fn file_list(dpath: []const u8, list: *std.ArrayList([]const u8)) !void {
160160pub fn run_cmd(dir: ?[]const u8, args: []const []const u8) !u32 {
161161 const result = std.ChildProcess.exec(.{ .allocator = gpa, .cwd = dir, .argv = args, }) catch |e| switch(e) {
162162 error.FileNotFound => {
163 u.assert(false, "\"{}\" command not found", .{args[0]});
163 u.assert(false, "\"{s}\" command not found", .{args[0]});
164164 unreachable;
165165 },
166166 else => return e,