diff --git a/src/common.zig b/src/common.zig index 147fd21a8286dceb7611696745f0fe3888fdf172..720a94ef55e1dbe7cfa8517088994a233067f692 100644 --- a/src/common.zig +++ b/src/common.zig @@ -134,7 +134,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) ! }, .git => { if (d.version.len > 0) { - const vers = u.parse_split(zigmod.DepType.Version.Git, "-").do(d.version) catch |e| switch (e) { + const vers = u.parse_split(zigmod.Dep.Type.Version.Git, "-").do(d.version) catch |e| switch (e) { error.IterEmpty => unreachable, error.NoMemberFound => { const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?]; @@ -212,7 +212,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: string, options: *CollectO if (options.lock) |lock| { for (lock) |item| { if (std.mem.eql(u8, item[0], try d.clean_path(options.alloc))) { - d.type = std.meta.stringToEnum(zigmod.DepType, item[1]).?; + d.type = std.meta.stringToEnum(zigmod.Dep.Type, item[1]).?; d.path = item[2]; d.version = item[3]; break; @@ -375,7 +375,7 @@ pub fn parse_lockfile(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const [4]str 2 => { var iter = std.mem.split(u8, line, " "); const asdep = zigmod.Dep{ - .type = std.meta.stringToEnum(zigmod.DepType, iter.next().?).?, + .type = std.meta.stringToEnum(zigmod.Dep.Type, iter.next().?).?, .path = iter.next().?, .version = iter.next().?, .id = "", diff --git a/src/lib.zig b/src/lib.zig index 2b8667a25feed045b1ac306bdd6087107d22c6d3..524d68c82d31b697dab362925e50b02ba4994059 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -23,7 +23,6 @@ pub fn deinit() void { zfetch.deinit(); } -pub const DepType = @import("./util/dep_type.zig").DepType; pub const Dep = @import("./util/dep.zig").Dep; pub const ModFile = @import("./util/modfile.zig").ModFile; pub const Module = @import("./util/module.zig").Module; diff --git a/src/util/dep.zig b/src/util/dep.zig index d53b47609f69f7275056507c5aac44aac0f17143..10785fb15b894f70aa94c5a4d461bebd6b4b22b1 100644 --- a/src/util/dep.zig +++ b/src/util/dep.zig @@ -12,7 +12,7 @@ const yaml = @import("./yaml.zig"); pub const Dep = struct { const Self = @This(); - type: zigmod.DepType, + type: Type, path: string, id: string, name: string, @@ -29,6 +29,8 @@ pub const Dep = struct { vcpkg: bool = false, for_build: bool = false, + pub const Type = @import("./dep_type.zig").DepType; + pub fn clean_path(self: Dep, alloc: std.mem.Allocator) !string { if (self.type == .local) { return if (self.path.len == 0) "../.." else self.path; @@ -67,7 +69,7 @@ pub const Dep = struct { } return switch (self.type) { .git => blk: { - const vers = try u.parse_split(zigmod.DepType.Version.Git, "-").do(self.version); + const vers = try u.parse_split(zigmod.Dep.Type.Version.Git, "-").do(self.version); if (vers.id.frozen()) break :blk self.version; break :blk try self.type.exact_version(alloc, dpath); }, diff --git a/src/util/modfile.zig b/src/util/modfile.zig index 263b9619a61a541beb733d694a577148a2b73108..8b919318265f221a882b4fdbdf68c0eee8152c02 100644 --- a/src/util/modfile.zig +++ b/src/util/modfile.zig @@ -110,7 +110,7 @@ pub const ModFile = struct { if (version == null) { version = ""; } - const dep_type = std.meta.stringToEnum(zigmod.DepType, dtype).?; + const dep_type = std.meta.stringToEnum(zigmod.Dep.Type, dtype).?; if (dep_type == .local) { if (path.len > 0) { name = path;