| ... | @@ -39,12 +39,12 @@ pub fn collect_deps_deep(cachepath: [:0]const u8, mdir: nfs.Dir, options: *Colle | ... | @@ -39,12 +39,12 @@ pub fn collect_deps_deep(cachepath: [:0]const u8, mdir: nfs.Dir, options: *Colle |
| 39 | } | 39 | } |
| 40 | try moduledeps.append(try collect_deps(cachepath, mdir, ".", .local, options)); | 40 | try moduledeps.append(try collect_deps(cachepath, mdir, ".", .local, options)); |
| 41 | for (m.rootdeps) |*d| { | 41 | for (m.rootdeps) |*d| { |
| 42 | if (try get_module_from_dep(d, cachepath, options)) |founddep| { | 42 | if (try get_module_from_dep(d, mdir, cachepath, options)) |founddep| { |
| 43 | try moduledeps.append(founddep); | 43 | try moduledeps.append(founddep); |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | for (m.builddeps) |*d| { | 46 | for (m.builddeps) |*d| { |
| 47 | if (try get_module_from_dep(d, cachepath, options)) |founddep| { | 47 | if (try get_module_from_dep(d, mdir, cachepath, options)) |founddep| { |
| 48 | try moduledeps.append(founddep); | 48 | try moduledeps.append(founddep); |
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| ... | @@ -72,7 +72,7 @@ pub fn collect_deps(cachepath: [:0]const u8, mdir: nfs.Dir, mdir_path: string, d | ... | @@ -72,7 +72,7 @@ pub fn collect_deps(cachepath: [:0]const u8, mdir: nfs.Dir, mdir_path: string, d |
| 72 | try gen_files_package(options.alloc, cachepath, mdir, m.files); | 72 | try gen_files_package(options.alloc, cachepath, mdir, m.files); |
| 73 | } | 73 | } |
| 74 | for (m.deps) |*d| { | 74 | for (m.deps) |*d| { |
| 75 | if (try get_module_from_dep(d, cachepath, options)) |founddep| { | 75 | if (try get_module_from_dep(d, if (dtype == .local) mdir else nfs.cwd(), cachepath, options)) |founddep| { |
| 76 | try moduledeps.append(founddep); | 76 | try moduledeps.append(founddep); |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| ... | @@ -122,9 +122,6 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) ! | ... | @@ -122,9 +122,6 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) ! |
| 122 | } | 122 | } |
| 123 | switch (d.type) { | 123 | switch (d.type) { |
| 124 | .local => { | 124 | .local => { |
| 125 | if (!std.mem.endsWith(u8, d.main, ".zig")) { | | |
| 126 | return gpa.dupeSentinel(u8, d.main, 0); | | |
| 127 | } | | |
| 128 | return d.path; | 125 | return d.path; |
| 129 | }, | 126 | }, |
| 130 | .system_lib, .framework => { | 127 | .system_lib, .framework => { |
| ... | @@ -216,7 +213,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) ! | ... | @@ -216,7 +213,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) ! |
| 216 | } | 213 | } |
| 217 | } | 214 | } |
| 218 | | 215 | |
| 219 | pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: [:0]const u8, options: *CollectOptions) anyerror!?zigmod.Module { | 216 | pub fn get_module_from_dep(d: *zigmod.Dep, localdir: nfs.Dir, cachepath: [:0]const u8, options: *CollectOptions) anyerror!?zigmod.Module { |
| 220 | if (options.lock) |lock| { | 217 | if (options.lock) |lock| { |
| 221 | for (lock) |item| { | 218 | for (lock) |item| { |
| 222 | if (std.mem.eql(u8, item[0], try d.clean_path(options.alloc))) { | 219 | if (std.mem.eql(u8, item[0], try d.clean_path(options.alloc))) { |
| ... | @@ -229,7 +226,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: [:0]const u8, options: *Co | ... | @@ -229,7 +226,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: [:0]const u8, options: *Co |
| 229 | } | 226 | } |
| 230 | if (!d.is_for_this()) return null; | 227 | if (!d.is_for_this()) return null; |
| 231 | const modpath = try get_modpath(cachepath, d.*, options); | 228 | const modpath = try get_modpath(cachepath, d.*, options); |
| 232 | const moddir = if (modpath.len == 0) try nfs.cwd().openDir(cachepath, .{}) else try nfs.cwd().openDir(modpath, .{}); | 229 | const moddir = if (modpath.len == 0) try nfs.cwd().openDir(cachepath, .{}) else try localdir.openDir(modpath, .{}); |
| 233 | | 230 | |
| 234 | const nocache = d.type.isLocal(); | 231 | const nocache = d.type.isLocal(); |
| 235 | if (!nocache) try options.already_fetched.append(modpath); | 232 | if (!nocache) try options.already_fetched.append(modpath); |
| ... | @@ -287,10 +284,12 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: [:0]const u8, options: *Co | ... | @@ -287,10 +284,12 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: [:0]const u8, options: *Co |
| 287 | }; | 284 | }; |
| 288 | dd.dep = d.*; | 285 | dd.dep = d.*; |
| 289 | dd.for_build = d.for_build; | 286 | dd.for_build = d.for_build; |
| 290 | const save = dd; | | |
| 291 | if (d.type != .local) { | 287 | if (d.type != .local) { |
| 292 | const new_clean_path = extras.trimPrefix(modpath, cachepath)[1..]; | 288 | const new_clean_path = extras.trimPrefix(modpath, cachepath)[1..]; |
| 293 | dd.clean_path = new_clean_path.ptr[0..new_clean_path.len :0]; | 289 | dd.clean_path = new_clean_path.ptr[0..new_clean_path.len :0]; |
| | 290 | } else { |
| | 291 | dd.clean_path = try moddir.realpathAlloc(gpa, "."); |
| | 292 | dd.clean_path = dd.clean_path[std.fs.path.dirname(std.fs.path.dirname(cachepath).?).?.len + 1 ..]; |
| 294 | } | 293 | } |
| 295 | if (std.mem.eql(u8, &dd.id, &zigmod.Dep.EMPTY)) dd.id = u.random_string(48); | 294 | if (std.mem.eql(u8, &dd.id, &zigmod.Dep.EMPTY)) dd.id = u.random_string(48); |
| 296 | if (d.name.len > 0) dd.name = d.name; | 295 | if (d.name.len > 0) dd.name = d.name; |
| ... | @@ -300,7 +299,6 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: [:0]const u8, options: *Co | ... | @@ -300,7 +299,6 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: [:0]const u8, options: *Co |
| 300 | if (d.c_source_files.len > 0) dd.c_source_files = d.c_source_files; | 299 | if (d.c_source_files.len > 0) dd.c_source_files = d.c_source_files; |
| 301 | if (d.only_os.len > 0) dd.only_os = d.only_os; | 300 | if (d.only_os.len > 0) dd.only_os = d.only_os; |
| 302 | if (d.except_os.len > 0) dd.except_os = d.except_os; | 301 | if (d.except_os.len > 0) dd.except_os = d.except_os; |
| 303 | if (d.type == .local) dd.main = try std.fs.path.join(options.alloc, &.{ d.main, save.main }); | | |
| 304 | if (dd.is_for_this()) return dd; | 302 | if (dd.is_for_this()) return dd; |
| 305 | return null; | 303 | return null; |
| 306 | }, | 304 | }, |