| author | |
| committer | |
| log | c4ee5cd5a47e0b973bea0a1efd4c5316d7db02f0 |
| tree | 941383460314fa03f432f1bb607068b79c9cba4a |
| parent | 271e7f758da34d2865cec4220e009bff6baccb92 |
4 files changed, 4 insertions(+), 12 deletions(-)
src/cmd/fetch.zig+1-1| ... | @@ -407,7 +407,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(zigmod.Modul | ... | @@ -407,7 +407,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(zigmod.Modul |
| 407 | /// returns if all of the zig modules in needles are in haystack | 407 | /// returns if all of the zig modules in needles are in haystack |
| 408 | fn contains_all(needles: []zigmod.Module, haystack: []const zigmod.Module) bool { | 408 | fn contains_all(needles: []zigmod.Module, haystack: []const zigmod.Module) bool { |
| 409 | for (needles) |item| { | 409 | for (needles) |item| { |
| 410 | if (item.main.len > 0 and !u.list_contains_gen(zigmod.Module, haystack, item)) { | 410 | if (item.main.len > 0 and !extras.containsAggregate(zigmod.Module, haystack, item)) { |
| 411 | return false; | 411 | return false; |
| 412 | } | 412 | } |
| 413 | } | 413 | } |
src/cmd/generate.zig+2-1| ... | @@ -1,5 +1,6 @@ | ... | @@ -1,5 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const string = []const u8; | 2 | const string = []const u8; |
| 3 | const extras = @import("extras"); | ||
| 3 | 4 | ||
| 4 | const zigmod = @import("../lib.zig"); | 5 | const zigmod = @import("../lib.zig"); |
| 5 | const u = @import("./../util/index.zig"); | 6 | const u = @import("./../util/index.zig"); |
| ... | @@ -356,7 +357,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, alloc: std.mem.Allocator, cachepath: | ... | @@ -356,7 +357,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, alloc: std.mem.Allocator, cachepath: |
| 356 | /// returns if all of the zig modules in needles are in haystack | 357 | /// returns if all of the zig modules in needles are in haystack |
| 357 | fn contains_all(needles: []zigmod.Module, haystack: []const zigmod.Module) bool { | 358 | fn contains_all(needles: []zigmod.Module, haystack: []const zigmod.Module) bool { |
| 358 | for (needles) |item| { | 359 | for (needles) |item| { |
| 359 | if (item.main.len > 0 and !u.list_contains_gen(zigmod.Module, haystack, item)) { | 360 | if (item.main.len > 0 and !extras.containsAggregate(zigmod.Module, haystack, item)) { |
| 360 | return false; | 361 | return false; |
| 361 | } | 362 | } |
| 362 | } | 363 | } |
src/common.zig+1-1| ... | @@ -90,7 +90,7 @@ pub fn collect_deps(cachepath: string, mdir: std.fs.Dir, dtype: zigmod.Dep.Type, | ... | @@ -90,7 +90,7 @@ pub fn collect_deps(cachepath: string, mdir: std.fs.Dir, dtype: zigmod.Dep.Type, |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | pub fn collect_pkgs(mod: zigmod.Module, list: *std.ArrayList(zigmod.Module)) anyerror!void { | 92 | pub fn collect_pkgs(mod: zigmod.Module, list: *std.ArrayList(zigmod.Module)) anyerror!void { |
| 93 | if (u.list_contains_gen(zigmod.Module, list.items, mod)) { | 93 | if (extras.containsAggregate(zigmod.Module, list.items, mod)) { |
| 94 | return; | 94 | return; |
| 95 | } | 95 | } |
| 96 | try list.append(mod); | 96 | try list.append(mod); |
src/util/funcs.zig-9| ... | @@ -46,15 +46,6 @@ pub fn split(alloc: std.mem.Allocator, in: string, delim: string) ![]string { | ... | @@ -46,15 +46,6 @@ pub fn split(alloc: std.mem.Allocator, in: string, delim: string) ![]string { |
| 46 | return list.toOwnedSlice(); | 46 | return list.toOwnedSlice(); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool { | ||
| 50 | for (haystack) |item| { | ||
| 51 | if (item.eql(needle)) { | ||
| 52 | return true; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | return false; | ||
| 56 | } | ||
| 57 | |||
| 58 | pub fn file_list(alloc: std.mem.Allocator, dpath: string) ![]const string { | 49 | pub fn file_list(alloc: std.mem.Allocator, dpath: string) ![]const string { |
| 59 | var dir = try std.fs.cwd().openIterableDir(dpath, .{}); | 50 | var dir = try std.fs.cwd().openIterableDir(dpath, .{}); |
| 60 | defer dir.close(); | 51 | defer dir.close(); |