| ... | @@ -34,11 +34,11 @@ pub fn collect_deps_deep(cachepath: []const u8, mdir: std.fs.Dir, options: *Coll | ... | @@ -34,11 +34,11 @@ pub fn collect_deps_deep(cachepath: []const u8, mdir: std.fs.Dir, options: *Coll |
| 34 | defer moduledeps.deinit(); | 34 | defer moduledeps.deinit(); |
| 35 | if (m.root_files.len > 0) { | 35 | if (m.root_files.len > 0) { |
| 36 | try std.fs.cwd().makePath(".zigmod/deps/files"); | 36 | try std.fs.cwd().makePath(".zigmod/deps/files"); |
| 37 | try moduledeps.append(try add_files_package("root", m.root_files, m.name)); | 37 | try moduledeps.append(try add_files_package("root", m.root_files)); |
| 38 | } | 38 | } |
| 39 | try moduledeps.append(try collect_deps(cachepath, mdir, options)); | 39 | try moduledeps.append(try collect_deps(cachepath, mdir, options)); |
| 40 | for (m.devdeps) |*d| { | 40 | for (m.devdeps) |*d| { |
| 41 | if (try get_module_from_dep(d, cachepath, m.name, options)) |founddep| { | 41 | if (try get_module_from_dep(d, cachepath, options)) |founddep| { |
| 42 | try moduledeps.append(founddep); | 42 | try moduledeps.append(founddep); |
| 43 | } | 43 | } |
| 44 | } | 44 | } |
| ... | @@ -60,10 +60,10 @@ pub fn collect_deps(cachepath: []const u8, mdir: std.fs.Dir, options: *CollectOp | ... | @@ -60,10 +60,10 @@ pub fn collect_deps(cachepath: []const u8, mdir: std.fs.Dir, options: *CollectOp |
| 60 | defer moduledeps.deinit(); | 60 | defer moduledeps.deinit(); |
| 61 | if (m.files.len > 0) { | 61 | if (m.files.len > 0) { |
| 62 | try std.fs.cwd().makePath(".zigmod/deps/files"); | 62 | try std.fs.cwd().makePath(".zigmod/deps/files"); |
| 63 | try moduledeps.append(try add_files_package(m.id, m.files, m.name)); | 63 | try moduledeps.append(try add_files_package(m.id, m.files)); |
| 64 | } | 64 | } |
| 65 | for (m.deps) |*d| { | 65 | for (m.deps) |*d| { |
| 66 | if (try get_module_from_dep(d, cachepath, m.name, options)) |founddep| { | 66 | if (try get_module_from_dep(d, cachepath, options)) |founddep| { |
| 67 | try moduledeps.append(founddep); | 67 | try moduledeps.append(founddep); |
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| ... | @@ -92,7 +92,7 @@ pub fn collect_pkgs(mod: u.Module, list: *std.ArrayList(u.Module)) anyerror!void | ... | @@ -92,7 +92,7 @@ pub fn collect_pkgs(mod: u.Module, list: *std.ArrayList(u.Module)) anyerror!void |
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| 94 | | 94 | |
| 95 | pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, options: *CollectOptions) ![]const u8 { | 95 | pub fn get_modpath(cachepath: []const u8, d: u.Dep, options: *CollectOptions) ![]const u8 { |
| 96 | const p = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path() }); | 96 | const p = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path() }); |
| 97 | const pv = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path_v() }); | 97 | const pv = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path_v() }); |
| 98 | | 98 | |
| ... | @@ -101,7 +101,7 @@ pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, opt | ... | @@ -101,7 +101,7 @@ pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, opt |
| 101 | if (!nocache and u.list_contains(options.already_fetched.items, pv)) return pv; | 101 | if (!nocache and u.list_contains(options.already_fetched.items, pv)) return pv; |
| 102 | | 102 | |
| 103 | if (options.log and d.type != .local) { | 103 | if (options.log and d.type != .local) { |
| 104 | u.print("fetch: {s}: {s}: {s}", .{ parent_name, @tagName(d.type), d.path }); | 104 | u.print("fetch: {s}: {s}", .{ @tagName(d.type), d.path }); |
| 105 | } | 105 | } |
| 106 | defer { | 106 | defer { |
| 107 | if (!bootstrap and options.log and d.type != .local) { | 107 | if (!bootstrap and options.log and d.type != .local) { |
| ... | @@ -197,7 +197,7 @@ pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, opt | ... | @@ -197,7 +197,7 @@ pub fn get_modpath(cachepath: []const u8, d: u.Dep, parent_name: []const u8, opt |
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | | 199 | |
| 200 | pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []const u8, options: *CollectOptions) anyerror!?u.Module { | 200 | pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, options: *CollectOptions) anyerror!?u.Module { |
| 201 | if (options.lock) |lock| { | 201 | if (options.lock) |lock| { |
| 202 | for (lock) |item| { | 202 | for (lock) |item| { |
| 203 | if (std.mem.eql(u8, item[0], try d.clean_path())) { | 203 | if (std.mem.eql(u8, item[0], try d.clean_path())) { |
| ... | @@ -208,7 +208,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons | ... | @@ -208,7 +208,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons |
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | const modpath = try get_modpath(cachepath, d.*, parent_name, options); | 211 | const modpath = try get_modpath(cachepath, d.*, options); |
| 212 | const moddir = if (std.mem.eql(u8, modpath, "files") or modpath.len == 0) try std.fs.cwd().openDir(cachepath, .{}) else try std.fs.cwd().openDir(modpath, .{}); | 212 | const moddir = if (std.mem.eql(u8, modpath, "files") or modpath.len == 0) try std.fs.cwd().openDir(cachepath, .{}) else try std.fs.cwd().openDir(modpath, .{}); |
| 213 | | 213 | |
| 214 | const nocache = d.type == .local or d.type == .system_lib; | 214 | const nocache = d.type == .local or d.type == .system_lib; |
| ... | @@ -276,7 +276,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons | ... | @@ -276,7 +276,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: []const u8, parent_name: []cons |
| 276 | } | 276 | } |
| 277 | } | 277 | } |
| 278 | | 278 | |
| 279 | pub fn add_files_package(pkg_name: []const u8, dirs: []const []const u8, parent_name: []const u8) !u.Module { | 279 | pub fn add_files_package(pkg_name: []const u8, dirs: []const []const u8) !u.Module { |
| 280 | const destination = ".zigmod/deps/files"; | 280 | const destination = ".zigmod/deps/files"; |
| 281 | const fname = try std.mem.join(gpa, "", &.{ pkg_name, ".zig" }); | 281 | const fname = try std.mem.join(gpa, "", &.{ pkg_name, ".zig" }); |
| 282 | | 282 | |
| ... | @@ -335,7 +335,7 @@ pub fn add_files_package(pkg_name: []const u8, dirs: []const []const u8, parent_ | ... | @@ -335,7 +335,7 @@ pub fn add_files_package(pkg_name: []const u8, dirs: []const []const u8, parent_ |
| 335 | .log = false, | 335 | .log = false, |
| 336 | .update = false, | 336 | .update = false, |
| 337 | }; | 337 | }; |
| 338 | return (try get_module_from_dep(&d, destination, parent_name, &options)).?; | 338 | return (try get_module_from_dep(&d, destination, &options)).?; |
| 339 | } | 339 | } |
| 340 | | 340 | |
| 341 | pub fn parse_lockfile(dir: std.fs.Dir) ![]const [4][]const u8 { | 341 | pub fn parse_lockfile(dir: std.fs.Dir) ![]const [4][]const u8 { |