| ... | @@ -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"); |
| 59 | | 59 | |
| 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"); |
| 63 | | 63 | |
| ... | @@ -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 | } |
| 250 | | 250 | |
| ... | @@ -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 | } |
| 290 | | 290 | |
| 291 | fn print_incl_dirs_to(w: fs.File.Writer, list: []u.Module) !void { | 291 | 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,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", .{"}"}); |
| 331 | | 331 | |
| 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 | } |
| 343 | | 343 | |
| ... | @@ -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", .{}); |