authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-09-15 15:53:29 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-09-15 15:53:29 -07:00
log55a0abba1dea88b5cb4c05c203bbb87a6c856678
tree9425129ca88fdf5680342f442cb8119f488e9f1d
parent2a940e891dec481e0f33eeebc198bfaee48e7b68

zigmod.DepType -> zigmod.Dep.Type


4 files changed, 8 insertions(+), 7 deletions(-)

src/common.zig+3-3
......@@ -134,7 +134,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !
134134 },
135135 .git => {
136136 if (d.version.len > 0) {
137 const vers = u.parse_split(zigmod.DepType.Version.Git, "-").do(d.version) catch |e| switch (e) {
137 const vers = u.parse_split(zigmod.Dep.Type.Version.Git, "-").do(d.version) catch |e| switch (e) {
138138 error.IterEmpty => unreachable,
139139 error.NoMemberFound => {
140140 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
212212 if (options.lock) |lock| {
213213 for (lock) |item| {
214214 if (std.mem.eql(u8, item[0], try d.clean_path(options.alloc))) {
215 d.type = std.meta.stringToEnum(zigmod.DepType, item[1]).?;
215 d.type = std.meta.stringToEnum(zigmod.Dep.Type, item[1]).?;
216216 d.path = item[2];
217217 d.version = item[3];
218218 break;
......@@ -375,7 +375,7 @@ pub fn parse_lockfile(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const [4]str
375375 2 => {
376376 var iter = std.mem.split(u8, line, " ");
377377 const asdep = zigmod.Dep{
378 .type = std.meta.stringToEnum(zigmod.DepType, iter.next().?).?,
378 .type = std.meta.stringToEnum(zigmod.Dep.Type, iter.next().?).?,
379379 .path = iter.next().?,
380380 .version = iter.next().?,
381381 .id = "",
src/lib.zig-1
......@@ -23,7 +23,6 @@ pub fn deinit() void {
2323 zfetch.deinit();
2424}
2525
26pub const DepType = @import("./util/dep_type.zig").DepType;
2726pub const Dep = @import("./util/dep.zig").Dep;
2827pub const ModFile = @import("./util/modfile.zig").ModFile;
2928pub const Module = @import("./util/module.zig").Module;
src/util/dep.zig+4-2
......@@ -12,7 +12,7 @@ const yaml = @import("./yaml.zig");
1212pub const Dep = struct {
1313 const Self = @This();
1414
15 type: zigmod.DepType,
15 type: Type,
1616 path: string,
1717 id: string,
1818 name: string,
......@@ -29,6 +29,8 @@ pub const Dep = struct {
2929 vcpkg: bool = false,
3030 for_build: bool = false,
3131
32 pub const Type = @import("./dep_type.zig").DepType;
33
3234 pub fn clean_path(self: Dep, alloc: std.mem.Allocator) !string {
3335 if (self.type == .local) {
3436 return if (self.path.len == 0) "../.." else self.path;
......@@ -67,7 +69,7 @@ pub const Dep = struct {
6769 }
6870 return switch (self.type) {
6971 .git => blk: {
70 const vers = try u.parse_split(zigmod.DepType.Version.Git, "-").do(self.version);
72 const vers = try u.parse_split(zigmod.Dep.Type.Version.Git, "-").do(self.version);
7173 if (vers.id.frozen()) break :blk self.version;
7274 break :blk try self.type.exact_version(alloc, dpath);
7375 },
src/util/modfile.zig+1-1
......@@ -110,7 +110,7 @@ pub const ModFile = struct {
110110 if (version == null) {
111111 version = "";
112112 }
113 const dep_type = std.meta.stringToEnum(zigmod.DepType, dtype).?;
113 const dep_type = std.meta.stringToEnum(zigmod.Dep.Type, dtype).?;
114114 if (dep_type == .local) {
115115 if (path.len > 0) {
116116 name = path;