| ... | @@ -24,7 +24,7 @@ pub fn execute(args: [][]u8) !void { | ... | @@ -24,7 +24,7 @@ pub fn execute(args: [][]u8) !void { |
| 24 | | 24 | |
| 25 | // | 25 | // |
| 26 | const module_list = &std.ArrayList(u.Module).init(gpa); | 26 | const module_list = &std.ArrayList(u.Module).init(gpa); |
| 27 | try dedupe_mod_list(module_list, top_module); | 27 | try common.collect_pkgs(top_module, module_list); |
| 28 | | 28 | |
| 29 | for (module_list.items) |m| { | 29 | for (module_list.items) |m| { |
| 30 | if (m.clean_path.len == 0) { continue; } | 30 | if (m.clean_path.len == 0) { continue; } |
| ... | @@ -32,15 +32,3 @@ pub fn execute(args: [][]u8) !void { | ... | @@ -32,15 +32,3 @@ pub fn execute(args: [][]u8) !void { |
| 32 | try w.print("{s} {s}\n", .{hash, m.clean_path}); | 32 | try w.print("{s} {s}\n", .{hash, m.clean_path}); |
| 33 | } | 33 | } |
| 34 | } | 34 | } |
| 35 | | | |
| 36 | fn dedupe_mod_list(list: *std.ArrayList(u.Module), module: u.Module) anyerror!void { | | |
| 37 | if (u.list_contains_gen(u.Module, list, module)) { | | |
| 38 | return; | | |
| 39 | } | | |
| 40 | if (module.clean_path.len > 0) { | | |
| 41 | try list.append(module); | | |
| 42 | } | | |
| 43 | for (module.deps) |m| { | | |
| 44 | try dedupe_mod_list(list, m); | | |
| 45 | } | | |
| 46 | } | | |