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) !
134134 },
135135 .git => {
136136 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) {
138138 error.IterEmpty => unreachable,
139139 error.NoMemberFound => {
140140 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 {
6767 }
6868 return switch (self.type) {
6969 .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);
7171 if (vers.id.frozen()) break :blk self.version;
7272 break :blk try self.type.exact_version(alloc, dpath);
7373 },
src/util/dep_type.zig+20-11
......@@ -85,17 +85,26 @@ pub const DepType = enum {
8585 };
8686 }
8787
88 pub const GitVersion = enum {
89 branch,
90 tag,
91 commit,
88 pub const Version = union(DepType) {
89 local: void,
90 system_lib: void,
91 framework: void,
92 git: Git,
93 hg: void,
94 http: void,
9295
93 pub fn frozen(self: GitVersion) bool {
94 return switch (self) {
95 .branch => false,
96 .tag => true,
97 .commit => true,
98 };
99 }
96 pub const Git = enum {
97 branch,
98 tag,
99 commit,
100
101 pub fn frozen(self: Git) bool {
102 return switch (self) {
103 .branch => false,
104 .tag => true,
105 .commit => true,
106 };
107 }
108 };
100109 };
101110};