| author | |
| committer | |
| log | 6fd42714e7ec2ab81732770c6eebc9ff7a683b5e |
| tree | ae73da38c86fbb8025f1ec7c93b25004f3add618 |
| parent | e16a1f6d945521ff0cd81d6486dbbe86ae7c038f |
5 files changed, 11 insertions(+), 7 deletions(-)
src/common.zig+4-3| ... | @@ -5,6 +5,7 @@ const gpa = std.heap.c_allocator; | ... | @@ -5,6 +5,7 @@ const gpa = std.heap.c_allocator; |
| 5 | 5 | ||
| 6 | const ansi = @import("ansi"); | 6 | const ansi = @import("ansi"); |
| 7 | 7 | ||
| 8 | const zigmod = @import("./lib.zig"); | ||
| 8 | const u = @import("./util/index.zig"); | 9 | const u = @import("./util/index.zig"); |
| 9 | const yaml = @import("./util/yaml.zig"); | 10 | const yaml = @import("./util/yaml.zig"); |
| 10 | 11 | ||
| ... | @@ -123,7 +124,7 @@ pub fn get_modpath(cachepath: string, d: u.Dep, options: *CollectOptions) !strin | ... | @@ -123,7 +124,7 @@ pub fn get_modpath(cachepath: string, d: u.Dep, options: *CollectOptions) !strin |
| 123 | }, | 124 | }, |
| 124 | .git => { | 125 | .git => { |
| 125 | if (d.version.len > 0) { | 126 | if (d.version.len > 0) { |
| 126 | const vers = u.parse_split(u.DepType.GitVersion, "-").do(d.version) catch |e| switch (e) { | 127 | const vers = u.parse_split(zigmod.DepType.GitVersion, "-").do(d.version) catch |e| switch (e) { |
| 127 | error.IterEmpty => unreachable, | 128 | error.IterEmpty => unreachable, |
| 128 | error.NoMemberFound => { | 129 | error.NoMemberFound => { |
| 129 | const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?]; | 130 | const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?]; |
| ... | @@ -201,7 +202,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: string, options: *CollectOption | ... | @@ -201,7 +202,7 @@ pub fn get_module_from_dep(d: *u.Dep, cachepath: string, options: *CollectOption |
| 201 | if (options.lock) |lock| { | 202 | if (options.lock) |lock| { |
| 202 | for (lock) |item| { | 203 | for (lock) |item| { |
| 203 | if (std.mem.eql(u8, item[0], try d.clean_path())) { | 204 | if (std.mem.eql(u8, item[0], try d.clean_path())) { |
| 204 | d.type = std.meta.stringToEnum(u.DepType, item[1]).?; | 205 | d.type = std.meta.stringToEnum(zigmod.DepType, item[1]).?; |
| 205 | d.path = item[2]; | 206 | d.path = item[2]; |
| 206 | d.version = item[3]; | 207 | d.version = item[3]; |
| 207 | break; | 208 | break; |
| ... | @@ -367,7 +368,7 @@ pub fn parse_lockfile(dir: std.fs.Dir) ![]const [4]string { | ... | @@ -367,7 +368,7 @@ pub fn parse_lockfile(dir: std.fs.Dir) ![]const [4]string { |
| 367 | 2 => { | 368 | 2 => { |
| 368 | var iter = std.mem.split(u8, line, " "); | 369 | var iter = std.mem.split(u8, line, " "); |
| 369 | const asdep = u.Dep{ | 370 | const asdep = u.Dep{ |
| 370 | .type = std.meta.stringToEnum(u.DepType, iter.next().?).?, | 371 | .type = std.meta.stringToEnum(zigmod.DepType, iter.next().?).?, |
| 371 | .path = iter.next().?, | 372 | .path = iter.next().?, |
| 372 | .version = iter.next().?, | 373 | .version = iter.next().?, |
| 373 | .id = "", | 374 | .id = "", |
src/lib.zig+2| ... | @@ -22,3 +22,5 @@ pub fn init() !void { | ... | @@ -22,3 +22,5 @@ pub fn init() !void { |
| 22 | pub fn deinit() void { | 22 | pub fn deinit() void { |
| 23 | zfetch.deinit(); | 23 | zfetch.deinit(); |
| 24 | } | 24 | } |
| 25 | |||
| 26 | pub const DepType = @import("./util/dep_type.zig").DepType; |
src/util/dep.zig+3-2| ... | @@ -3,6 +3,7 @@ const string = []const u8; | ... | @@ -3,6 +3,7 @@ const string = []const u8; |
| 3 | const gpa = std.heap.c_allocator; | 3 | const gpa = std.heap.c_allocator; |
| 4 | const builtin = std.builtin; | 4 | const builtin = std.builtin; |
| 5 | 5 | ||
| 6 | const zigmod = @import("../lib.zig"); | ||
| 6 | const u = @import("index.zig"); | 7 | const u = @import("index.zig"); |
| 7 | const yaml = @import("./yaml.zig"); | 8 | const yaml = @import("./yaml.zig"); |
| 8 | 9 | ||
| ... | @@ -12,7 +13,7 @@ const yaml = @import("./yaml.zig"); | ... | @@ -12,7 +13,7 @@ const yaml = @import("./yaml.zig"); |
| 12 | pub const Dep = struct { | 13 | pub const Dep = struct { |
| 13 | const Self = @This(); | 14 | const Self = @This(); |
| 14 | 15 | ||
| 15 | type: u.DepType, | 16 | type: zigmod.DepType, |
| 16 | path: string, | 17 | path: string, |
| 17 | 18 | ||
| 18 | id: string, | 19 | id: string, |
| ... | @@ -65,7 +66,7 @@ pub const Dep = struct { | ... | @@ -65,7 +66,7 @@ pub const Dep = struct { |
| 65 | } | 66 | } |
| 66 | return switch (self.type) { | 67 | return switch (self.type) { |
| 67 | .git => blk: { | 68 | .git => blk: { |
| 68 | const vers = try u.parse_split(u.DepType.GitVersion, "-").do(self.version); | 69 | const vers = try u.parse_split(zigmod.DepType.GitVersion, "-").do(self.version); |
| 69 | if (vers.id.frozen()) break :blk self.version; | 70 | if (vers.id.frozen()) break :blk self.version; |
| 70 | break :blk try self.type.exact_version(dpath); | 71 | break :blk try self.type.exact_version(dpath); |
| 71 | }, | 72 | }, |
src/util/index.zig-1| ... | @@ -1,5 +1,4 @@ | ... | @@ -1,5 +1,4 @@ |
| 1 | usingnamespace @import("./funcs.zig"); | 1 | usingnamespace @import("./funcs.zig"); |
| 2 | usingnamespace @import("./dep_type.zig"); | ||
| 3 | usingnamespace @import("./dep.zig"); | 2 | usingnamespace @import("./dep.zig"); |
| 4 | usingnamespace @import("./modfile.zig"); | 3 | usingnamespace @import("./modfile.zig"); |
| 5 | usingnamespace @import("./module.zig"); | 4 | usingnamespace @import("./module.zig"); |
src/util/modfile.zig+2-1| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const string = []const u8; | 2 | const string = []const u8; |
| 3 | 3 | ||
| 4 | const zigmod = @import("../lib.zig"); | ||
| 4 | const u = @import("index.zig"); | 5 | const u = @import("index.zig"); |
| 5 | const yaml = @import("./yaml.zig"); | 6 | const yaml = @import("./yaml.zig"); |
| 6 | 7 | ||
| ... | @@ -94,7 +95,7 @@ pub const ModFile = struct { | ... | @@ -94,7 +95,7 @@ pub const ModFile = struct { |
| 94 | if (version == null) { | 95 | if (version == null) { |
| 95 | version = ""; | 96 | version = ""; |
| 96 | } | 97 | } |
| 97 | const dep_type = std.meta.stringToEnum(u.DepType, dtype).?; | 98 | const dep_type = std.meta.stringToEnum(zigmod.DepType, dtype).?; |
| 98 | if (dep_type == .local) { | 99 | if (dep_type == .local) { |
| 99 | if (path.len > 0) { | 100 | if (path.len > 0) { |
| 100 | name = path; | 101 | name = path; |