authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-20 12:59:47 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-20 12:59:47 -07:00
log1c6ce7491fa6dc3dede4d9714edce861fc405b10
tree77b91f84c3a38f25f7109bd6d7ae74fc01faa967
parentaff8581f7abf459825a7bbaf93aa2b64a8f4d60f

cmd/fetch- put reference to Pkg and FileSource at top of `deps.zig`


1 files changed, 4 insertions(+), 2 deletions(-)

src/cmd/fetch.zig+4-2
...@@ -25,6 +25,8 @@ pub fn execute(args: [][]u8) !void {...@@ -25,6 +25,8 @@ pub fn execute(args: [][]u8) !void {
2525
26 const w = f.writer();26 const w = f.writer();
27 try w.writeAll("const std = @import(\"std\");\n");27 try w.writeAll("const std = @import(\"std\");\n");
28 try w.writeAll("const Pkg = std.build.Pkg;\n");
29 try w.writeAll("const FileSource = std.build.FileSource;\n");
28 try w.writeAll("\n");30 try w.writeAll("\n");
29 try w.print("pub const cache = \"{}\";\n", .{std.zig.fmtEscapes(dir)});31 try w.print("pub const cache = \"{}\";\n", .{std.zig.fmtEscapes(dir)});
30 try w.writeAll("\n");32 try w.writeAll("\n");
...@@ -139,7 +141,7 @@ fn print_deps(w: std.fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32, ar...@@ -139,7 +141,7 @@ fn print_deps(w: std.fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32, ar
139 return;141 return;
140 }142 }
141 if (array) {143 if (array) {
142 try u.print_all(w, .{"&[_]std.build.Pkg{"}, true);144 try u.print_all(w, .{"&[_]Pkg{"}, true);
143 } else {145 } else {
144 try u.print_all(w, .{"struct {"}, true);146 try u.print_all(w, .{"struct {"}, true);
145 }147 }
...@@ -220,7 +222,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(u.Module), d...@@ -220,7 +222,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(u.Module), d
220 while (notdone.items.len > 0) {222 while (notdone.items.len > 0) {
221 for (notdone.items) |mod, i| {223 for (notdone.items) |mod, i| {
222 if (contains_all(mod.deps, done.items)) {224 if (contains_all(mod.deps, done.items)) {
223 try w.print(" pub const _{s} = std.build.Pkg{{ .name = \"{s}\", .path = std.build.FileSource{{ .path = cache ++ \"/{}/{s}\" }}, .dependencies = &[_]std.build.Pkg{{", .{ mod.id[0..12], mod.name, std.zig.fmtEscapes(mod.clean_path), mod.main });225 try w.print(" pub const _{s} = Pkg{{ .name = \"{s}\", .path = FileSource{{ .path = cache ++ \"/{}/{s}\" }}, .dependencies = &[_]Pkg{{", .{ mod.id[0..12], mod.name, std.zig.fmtEscapes(mod.clean_path), mod.main });
224 for (mod.deps) |d| {226 for (mod.deps) |d| {
225 if (d.main.len > 0) {227 if (d.main.len > 0) {
226 try w.print(" _{s},", .{d.id[0..12]});228 try w.print(" _{s},", .{d.id[0..12]});