authorgravatar for hello@nektro.netMeghan <hello@nektro.net> 2021-01-11 02:04:12 -08:00
committergravatar for hello@nektro.netMeghan <hello@nektro.net> 2021-01-11 02:04:12 -08:00
log8ce6e12106c6247e58058614f600fc7fe749a059
tree3c4bcc50143e4f1f44713cdd2b210794855c628d
parent486f6185ea963fca97954c78920f5aebef2583ec

add support for the src dep attribute


2 files changed, 13 insertions(+), 6 deletions(-)

README.md+3-4
......@@ -98,10 +98,8 @@ id: t5ch3nfmdaa25ndlch7ucz7yztq8n1iaanv2d7iwiw4q5n65
9898name: my_app
9999main: src/main.zig
100100dependencies:
101- type: git
102 path: https://github.com/Hejsil/zig-clap
103- type: git
104 path: https://github.com/alexnask/ctregex.zig
101- src: git https://github.com/Hejsil/zig-clap
102- src: git https://github.com/alexnask/ctregex.zig
105103 # ctregex.zig doesn't have a zig.mod file so we can manually
106104 # define its entry point. this can also be used generally to
107105 # override any attribute we want in this dependency.
......@@ -124,6 +122,7 @@ dependencies:
124122|------|------|------|-------------|
125123| `type` | `string` | required, enum | One of `system_lib`, `git`, `hg`, `http` |
126124| `path` | `string` | required | URL/path to this dependency. depends on the type |
125| `src` | `string` | Shorthand for the format `type path`. |
127126| `version` | `string` | only on some types | pin this dependency at a specific version |
128127| `only_os` | `string` | | comma separated list of OS names to add this Dep to |
129128| `except_os` | `string` | | comma separated list of OS names to exclude this Dep from |
src/util/modfile.zig+10-2
......@@ -38,8 +38,16 @@ pub const ModFile = struct {
3838 if (doc.mapping.get("dependencies")) |dep_seq| {
3939 if (dep_seq == .sequence) {
4040 for (dep_seq.sequence) |item| {
41 const dtype = item.mapping.get("type").?.string;
42 const path = item.mapping.get("path").?.string;
41 var dtype: []const u8 = undefined;
42 var path: []const u8 = undefined;
43 if (item.mapping.get("src")) |val| {
44 var src_iter = std.mem.split(val.string, " ");
45 dtype = src_iter.next().?;
46 path = src_iter.next().?;
47 } else {
48 dtype = item.mapping.get("type").?.string;
49 path = item.mapping.get("path").?.string;
50 }
4351 const dep_type = std.meta.stringToEnum(u.DepType, dtype).?;
4452
4553 try dep_list.append(u.Dep{