authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-03-12 15:42:33 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-03-12 15:42:33 -08:00
log9602c574e96844aa5e96bc148f340619d9d8730c
tree98363b19fa4291fd910e1de4939e9e849bb02d4b
parent81ff8a984327255c471d975433aa7bd434d2e787

util/modfile: allow src attribute to accept version in 3rd space


2 files changed, 16 insertions(+), 15 deletions(-)

src/util/modfile.zig+9-2
...@@ -44,14 +44,21 @@ pub const ModFile = struct {...@@ -44,14 +44,21 @@ pub const ModFile = struct {
44 for (dep_seq.sequence) |item| {44 for (dep_seq.sequence) |item| {
45 var dtype: []const u8 = undefined;45 var dtype: []const u8 = undefined;
46 var path: []const u8 = undefined;46 var path: []const u8 = undefined;
47 var version: []const u8 = undefined;
47 if (item.mapping.get("src")) |val| {48 if (item.mapping.get("src")) |val| {
48 var src_iter = std.mem.split(val.string, " ");49 var src_iter = std.mem.tokenize(val.string, " ");
49 dtype = src_iter.next().?;50 dtype = src_iter.next().?;
50 path = src_iter.next().?;51 path = src_iter.next().?;
52 if (src_iter.next()) |dver| {
53 version = dver;
54 }
51 } else {55 } else {
52 dtype = item.mapping.get("type").?.string;56 dtype = item.mapping.get("type").?.string;
53 path = item.mapping.get("path").?.string;57 path = item.mapping.get("path").?.string;
54 }58 }
59 if (item.mapping.get("version")) |verv| {
60 version = verv.string;
61 }
55 const dep_type = std.meta.stringToEnum(u.DepType, dtype).?;62 const dep_type = std.meta.stringToEnum(u.DepType, dtype).?;
5663
57 try dep_list.append(u.Dep{64 try dep_list.append(u.Dep{
...@@ -60,7 +67,7 @@ pub const ModFile = struct {...@@ -60,7 +67,7 @@ pub const ModFile = struct {
60 .id = item.mapping.get_string("id"),67 .id = item.mapping.get_string("id"),
61 .name = item.mapping.get_string("name"),68 .name = item.mapping.get_string("name"),
62 .main = item.mapping.get_string("main"),69 .main = item.mapping.get_string("main"),
63 .version = item.mapping.get_string("version"),70 .version = version,
64 .c_include_dirs = try item.mapping.get_string_array(alloc, "c_include_dirs"),71 .c_include_dirs = try item.mapping.get_string_array(alloc, "c_include_dirs"),
65 .c_source_flags = try item.mapping.get_string_array(alloc, "c_source_flags"),72 .c_source_flags = try item.mapping.get_string_array(alloc, "c_source_flags"),
66 .c_source_files = try item.mapping.get_string_array(alloc, "c_source_files"),73 .c_source_files = try item.mapping.get_string_array(alloc, "c_source_files"),
zig.mod+7-13
...@@ -3,8 +3,7 @@ name: zigmod...@@ -3,8 +3,7 @@ name: zigmod
3main: src/main.zig3main: src/main.zig
4license: MIT4license: MIT
5dependencies:5dependencies:
6 - src: git https://github.com/yaml/libyaml6 - src: git https://github.com/yaml/libyaml tag-0.2.5
7 version: tag-0.2.5
8 id: 8mdbh0zuneb0i3hs5jby5je0heem1i6yxusl7c8y8qx68hqc7 id: 8mdbh0zuneb0i3hs5jby5je0heem1i6yxusl7c8y8qx68hqc
9 license: MIT8 license: MIT
10 c_include_dirs:9 c_include_dirs:
...@@ -25,21 +24,16 @@ dependencies:...@@ -25,21 +24,16 @@ dependencies:
25 - src/scanner.c24 - src/scanner.c
26 - src/writer.c25 - src/writer.c
2726
28 - src: git https://github.com/nektro/zig-ansi27 - src: git https://github.com/nektro/zig-ansi commit-25039ca
29 version: commit-25039ca
3028
31 # Entries above this line are needed to bootstrap and kept as git submodules29 # Entries above this line are needed to bootstrap and kept as git submodules
32 # --------30 # --------
33 # Entries below this line are only fetched with zigmod itself 31 # Entries below this line are only fetched with zigmod itself
3432
35 - src: git https://github.com/ziglibs/known-folders33 - src: git https://github.com/ziglibs/known-folders commit-f0f4188
36 version: commit-f0f4188
3734
38 - src: git https://github.com/Vexu/zuri35 - src: git https://github.com/Vexu/zuri commit-41bcd78
39 version: commit-41bcd78
4036
41 - src: git https://github.com/alexnask/iguanaTLS37 - src: git https://github.com/alexnask/iguanaTLS commit-2c21764
42 version: commit-2c2176438
43 39 - src: git https://github.com/nektro/zig-licenses commit-73bc493
44 - src: git https://github.com/nektro/zig-licenses
45 version: commit-73bc493