authorgravatar for hello@nektro.netMeghan <hello@nektro.net> 2021-01-11 01:55:48 -08:00
committergravatar for hello@nektro.netMeghan <hello@nektro.net> 2021-01-11 01:55:48 -08:00
log486f6185ea963fca97954c78920f5aebef2583ec
treec41481c738da4c3e963f943b30ab802befa3d72c
parentc756359635d8dfc436ac52a2708e625a331e2e94

fetch: code cleanup


1 files changed, 17 insertions(+), 17 deletions(-)

src/cmd_fetch.zig+17-17
...@@ -55,12 +55,12 @@ pub fn execute(args: [][]u8) !void {...@@ -55,12 +55,12 @@ pub fn execute(args: [][]u8) !void {
5555
56 try w.writeAll("pub const _ids = .{\n");56 try w.writeAll("pub const _ids = .{\n");
57 try print_ids(w, list.items);57 try print_ids(w, list.items);
58 try w.writeAll("};\n");58 try w.writeAll("};\n\n");
59 try w.writeAll("\n");59
60 try w.print("pub const _paths = {}\n", .{".{"});60 try w.print("pub const _paths = {}\n", .{".{"});
61 try print_paths(w, list.items);61 try print_paths(w, list.items);
62 try w.writeAll("};\n");62 try w.writeAll("};\n\n");
63 try w.writeAll("\n");63
64 try w.writeAll("pub const package_data = struct {\n");64 try w.writeAll("pub const package_data = struct {\n");
65 const duped = &std.ArrayList(u.Module).init(gpa);65 const duped = &std.ArrayList(u.Module).init(gpa);
66 for (list.items) |mod| {66 for (list.items) |mod| {
...@@ -69,31 +69,31 @@ pub fn execute(args: [][]u8) !void {...@@ -69,31 +69,31 @@ pub fn execute(args: [][]u8) !void {
69 }69 }
70 }70 }
71 try print_pkg_data_to(w, duped, &std.ArrayList(u.Module).init(gpa));71 try print_pkg_data_to(w, duped, &std.ArrayList(u.Module).init(gpa));
72 try w.writeAll("};\n");72 try w.writeAll("};\n\n");
73 try w.writeAll("\n");73
74 try w.writeAll("pub const packages = ");74 try w.writeAll("pub const packages = ");
75 try print_deps(w, dir, top_module, 0, true);75 try print_deps(w, dir, top_module, 0, true);
76 try w.writeAll(";\n");76 try w.writeAll(";\n\n");
77 try w.writeAll("\n");77
78 try w.writeAll("pub const pkgs = ");78 try w.writeAll("pub const pkgs = ");
79 try print_deps(w, dir, top_module, 0, false);79 try print_deps(w, dir, top_module, 0, false);
80 try w.writeAll(";\n");80 try w.writeAll(";\n\n");
81 try w.writeAll("\n");81
82 try w.writeAll("pub const c_include_dirs = &[_][]const u8{\n");82 try w.writeAll("pub const c_include_dirs = &[_][]const u8{\n");
83 try print_incl_dirs_to(w, list.items);83 try print_incl_dirs_to(w, list.items);
84 try w.writeAll("};\n");84 try w.writeAll("};\n\n");
85 try w.writeAll("\n");85
86 try w.writeAll("pub const c_source_flags = struct {\n");86 try w.writeAll("pub const c_source_flags = struct {\n");
87 try print_csrc_flags_to(w, list.items);87 try print_csrc_flags_to(w, list.items);
88 try w.writeAll("};\n");88 try w.writeAll("};\n\n");
89 try w.writeAll("\n");89
90 try w.writeAll("pub const c_source_files = &[_][2][]const u8{\n");90 try w.writeAll("pub const c_source_files = &[_][2][]const u8{\n");
91 try print_csrc_dirs_to(w, list.items);91 try print_csrc_dirs_to(w, list.items);
92 try w.writeAll("};\n");92 try w.writeAll("};\n\n");
93 try w.writeAll("\n");93
94 try w.writeAll("pub const system_libs = &[_][]const u8{\n");94 try w.writeAll("pub const system_libs = &[_][]const u8{\n");
95 try print_sys_libs_to(w, list.items, &std.ArrayList([]const u8).init(gpa));95 try print_sys_libs_to(w, list.items, &std.ArrayList([]const u8).init(gpa));
96 try w.writeAll("};\n");96 try w.writeAll("};\n\n");
97}97}
9898
99fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {99fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {