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 {...@@ -193,7 +193,7 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module {
193 .c_source_flags = &[_][]const u8{},193 .c_source_flags = &[_][]const u8{},
194 .c_source_files = &[_][]const u8{},194 .c_source_files = &[_][]const u8{},
195 .deps = &[_]u.Module{},195 .deps = &[_]u.Module{},
196 .clean_path = "",196 .clean_path = d.path,
197 });197 });
198 },198 },
199 else => blk: {199 else => blk: {
...@@ -244,11 +244,7 @@ fn print_ids(w: fs.File.Writer, list: []u.Module) !void {...@@ -244,11 +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 if (mod.clean_path.len == 0) {247 try w.print(" \"{}\",\n", .{mod.id});
248 try w.print(" \"\",\n", .{});
249 } else {
250 try w.print(" \"{}\",\n", .{mod.id});
251 }
252 }248 }
253}249}
254250
...@@ -283,7 +279,7 @@ fn print_deps(w: fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32, array:...@@ -283,7 +279,7 @@ fn print_deps(w: fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32, array:
283 continue;279 continue;
284 }280 }
285 if (!array) {281 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});
287 }283 }
288 else {284 else {
289 try w.print(" package_data._{},\n", .{d.id});285 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 {...@@ -301,7 +297,7 @@ fn print_incl_dirs_to(w: fs.File.Writer, list: []u.Module) !void {
301 if (i > 0) {297 if (i > 0) {
302 try w.print(" cache ++ _paths[{}] ++ \"{Z}\",\n", .{i, it});298 try w.print(" cache ++ _paths[{}] ++ \"{Z}\",\n", .{i, it});
303 } else {299 } else {
304 try w.print(" \"\",\n", .{});300 try w.print(" \"{Z}\",\n", .{it});
305 }301 }
306 }302 }
307 }303 }
...@@ -316,7 +312,7 @@ fn print_csrc_dirs_to(w: fs.File.Writer, list: []u.Module) !void {...@@ -316,7 +312,7 @@ fn print_csrc_dirs_to(w: fs.File.Writer, list: []u.Module) !void {
316 if (i > 0) {312 if (i > 0) {
317 try w.print(" {}_ids[{}], cache ++ _paths[{}] ++ \"{}\"{},\n", .{"[_][]const u8{", i, i, it, "}"});313 try w.print(" {}_ids[{}], cache ++ _paths[{}] ++ \"{}\"{},\n", .{"[_][]const u8{", i, i, it, "}"});
318 } else {314 } 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, "}"});
320 }316 }
321 }317 }
322 }318 }
...@@ -327,15 +323,12 @@ fn print_csrc_flags_to(w: fs.File.Writer, list: []u.Module) !void {...@@ -327,15 +323,12 @@ fn print_csrc_flags_to(w: fs.File.Writer, list: []u.Module) !void {
327 if (mod.is_sys_lib) {323 if (mod.is_sys_lib) {
328 continue;324 continue;
329 }325 }
330 if (i == 0) {326 try w.print(" pub const @\"{}\" = {}", .{mod.id, "&[_][]const u8{"});
331 try w.print(" pub const @\"{}\" = {};\n", .{"", "&[_][]const u8{}"});327 for (mod.c_source_flags) |it| {
332 } else {328 try w.print("\"{Z}\",", .{it});
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", .{"}"});
338 }329 }
330 try w.print("{};\n", .{"}"});
331
339 }332 }
340}333}
341334