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 {
4444 for (dep_seq.sequence) |item| {
4545 var dtype: []const u8 = undefined;
4646 var path: []const u8 = undefined;
47 var version: []const u8 = undefined;
4748 if (item.mapping.get("src")) |val| {
48 var src_iter = std.mem.split(val.string, " ");
49 var src_iter = std.mem.tokenize(val.string, " ");
4950 dtype = src_iter.next().?;
5051 path = src_iter.next().?;
52 if (src_iter.next()) |dver| {
53 version = dver;
54 }
5155 } else {
5256 dtype = item.mapping.get("type").?.string;
5357 path = item.mapping.get("path").?.string;
5458 }
59 if (item.mapping.get("version")) |verv| {
60 version = verv.string;
61 }
5562 const dep_type = std.meta.stringToEnum(u.DepType, dtype).?;
5663
5764 try dep_list.append(u.Dep{
......@@ -60,7 +67,7 @@ pub const ModFile = struct {
6067 .id = item.mapping.get_string("id"),
6168 .name = item.mapping.get_string("name"),
6269 .main = item.mapping.get_string("main"),
63 .version = item.mapping.get_string("version"),
70 .version = version,
6471 .c_include_dirs = try item.mapping.get_string_array(alloc, "c_include_dirs"),
6572 .c_source_flags = try item.mapping.get_string_array(alloc, "c_source_flags"),
6673 .c_source_files = try item.mapping.get_string_array(alloc, "c_source_files"),
zig.mod+7-13
......@@ -3,8 +3,7 @@ name: zigmod
33main: src/main.zig
44license: MIT
55dependencies:
6 - src: git https://github.com/yaml/libyaml
7 version: tag-0.2.5
6 - src: git https://github.com/yaml/libyaml tag-0.2.5
87 id: 8mdbh0zuneb0i3hs5jby5je0heem1i6yxusl7c8y8qx68hqc
98 license: MIT
109 c_include_dirs:
......@@ -25,21 +24,16 @@ dependencies:
2524 - src/scanner.c
2625 - src/writer.c
2726
28 - src: git https://github.com/nektro/zig-ansi
29 version: commit-25039ca
27 - src: git https://github.com/nektro/zig-ansi commit-25039ca
3028
3129 # Entries above this line are needed to bootstrap and kept as git submodules
3230 # --------
3331 # Entries below this line are only fetched with zigmod itself
3432
35 - src: git https://github.com/ziglibs/known-folders
36 version: commit-f0f4188
33 - src: git https://github.com/ziglibs/known-folders commit-f0f4188
3734
38 - src: git https://github.com/Vexu/zuri
39 version: commit-41bcd78
35 - src: git https://github.com/Vexu/zuri commit-41bcd78
4036
41 - src: git https://github.com/alexnask/iguanaTLS
42 version: commit-2c21764
43
44 - src: git https://github.com/nektro/zig-licenses
45 version: commit-73bc493
37 - src: git https://github.com/alexnask/iguanaTLS commit-2c21764
38
39 - src: git https://github.com/nektro/zig-licenses commit-73bc493