authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-03-11 18:48:53 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-03-11 18:48:53 -08:00
loga6628cf1f529c85a4f2e561bd056764d4dcb58b4
tree50b4d55f9525ae7fefe24673b333bfffd2974df4
parent7d322ed64d0f4ff70634dd8a268b2f9d352a814d

DepType- GitVersion -> Version.Git


3 files changed, 22 insertions(+), 13 deletions(-)

src/common.zig+1-1
...@@ -134,7 +134,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !...@@ -134,7 +134,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !
134 },134 },
135 .git => {135 .git => {
136 if (d.version.len > 0) {136 if (d.version.len > 0) {
137 const vers = u.parse_split(zigmod.DepType.GitVersion, "-").do(d.version) catch |e| switch (e) {137 const vers = u.parse_split(zigmod.DepType.Version.Git, "-").do(d.version) catch |e| switch (e) {
138 error.IterEmpty => unreachable,138 error.IterEmpty => unreachable,
139 error.NoMemberFound => {139 error.NoMemberFound => {
140 const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?];140 const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?];
src/util/dep.zig+1-1
...@@ -67,7 +67,7 @@ pub const Dep = struct {...@@ -67,7 +67,7 @@ pub const Dep = struct {
67 }67 }
68 return switch (self.type) {68 return switch (self.type) {
69 .git => blk: {69 .git => blk: {
70 const vers = try u.parse_split(zigmod.DepType.GitVersion, "-").do(self.version);70 const vers = try u.parse_split(zigmod.DepType.Version.Git, "-").do(self.version);
71 if (vers.id.frozen()) break :blk self.version;71 if (vers.id.frozen()) break :blk self.version;
72 break :blk try self.type.exact_version(alloc, dpath);72 break :blk try self.type.exact_version(alloc, dpath);
73 },73 },
src/util/dep_type.zig+20-11
...@@ -85,17 +85,26 @@ pub const DepType = enum {...@@ -85,17 +85,26 @@ pub const DepType = enum {
85 };85 };
86 }86 }
8787
88 pub const GitVersion = enum {88 pub const Version = union(DepType) {
89 branch,89 local: void,
90 tag,90 system_lib: void,
91 commit,91 framework: void,
92 git: Git,
93 hg: void,
94 http: void,
9295
93 pub fn frozen(self: GitVersion) bool {96 pub const Git = enum {
94 return switch (self) {97 branch,
95 .branch => false,98 tag,
96 .tag => true,99 commit,
97 .commit => true,100
98 };101 pub fn frozen(self: Git) bool {
99 }102 return switch (self) {
103 .branch => false,
104 .tag => true,
105 .commit => true,
106 };
107 }
108 };
100 };109 };
101};110};