authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-01-29 15:06:58 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-01-29 15:06:58 -08:00
logdd76f16f116fb3310cf053e0e2e7fdd26a43e737
treefebc4617f6a2c9a351407fa269c6e696a9e853a9
parent7b9f1c00246e6203e2e00c4b7ff24500ca0a5563

fetch: fix building of local projects


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

src/cmd_fetch.zig+10-17
......@@ -193,7 +193,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
193193 .c_source_flags = &[_][]const u8{},
194194 .c_source_files = &[_][]const u8{},
195195 .deps = &[_]u.Module{},
196 .clean_path = "",
196 .clean_path = d.path,
197197 });
198198 },
199199 else => blk: {
......@@ -244,11 +244,7 @@ fn print_ids(w: fs.File.Writer, list: []u.Module) !void {
244244 if (mod.is_sys_lib) {
245245 continue;
246246 }
247 if (mod.clean_path.len == 0) {
248 try w.print(" \"\",\n", .{});
249 } else {
250 try w.print(" \"{}\",\n", .{mod.id});
251 }
247 try w.print(" \"{}\",\n", .{mod.id});
252248 }
253249}
254250
......@@ -283,7 +279,7 @@ fn print_deps(w: fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32, array:
283279 continue;
284280 }
285281 if (!array) {
286 try w.print(" pub const {} = packages[{}];\n", .{d.name, i});
282 try w.print(" pub const {} = packages[{}];\n", .{std.mem.replaceOwned(u8, gpa, d.name, "-", "_"), i});
287283 }
288284 else {
289285 try w.print(" package_data._{},\n", .{d.id});
......@@ -301,7 +297,7 @@ fn print_incl_dirs_to(w: fs.File.Writer, list: []u.Module) !void {
301297 if (i > 0) {
302298 try w.print(" cache ++ _paths[{}] ++ \"{Z}\",\n", .{i, it});
303299 } else {
304 try w.print(" \"\",\n", .{});
300 try w.print(" \"{Z}\",\n", .{it});
305301 }
306302 }
307303 }
......@@ -316,7 +312,7 @@ fn print_csrc_dirs_to(w: fs.File.Writer, list: []u.Module) !void {
316312 if (i > 0) {
317313 try w.print(" {}_ids[{}], cache ++ _paths[{}] ++ \"{}\"{},\n", .{"[_][]const u8{", i, i, it, "}"});
318314 } else {
319 try w.print(" {}\"{}\", \".{}/{}\"{},\n", .{"[_][]const u8{", mod.clean_path, mod.clean_path, it, "}"});
315 try w.print(" {}_ids[{}], \".{}/{}\"{},\n", .{"[_][]const u8{", i, mod.clean_path, it, "}"});
320316 }
321317 }
322318 }
......@@ -327,15 +323,12 @@ fn print_csrc_flags_to(w: fs.File.Writer, list: []u.Module) !void {
327323 if (mod.is_sys_lib) {
328324 continue;
329325 }
330 if (i == 0) {
331 try w.print(" pub const @\"{}\" = {};\n", .{"", "&[_][]const u8{}"});
332 } else {
333 try w.print(" pub const @\"{}\" = {}", .{mod.id, "&[_][]const u8{"});
334 for (mod.c_source_flags) |it| {
335 try w.print("\"{Z}\",", .{it});
336 }
337 try w.print("{};\n", .{"}"});
326 try w.print(" pub const @\"{}\" = {}", .{mod.id, "&[_][]const u8{"});
327 for (mod.c_source_flags) |it| {
328 try w.print("\"{Z}\",", .{it});
338329 }
330 try w.print("{};\n", .{"}"});
331
339332 }
340333}
341334