authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-02-15 15:07:38 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-02-15 15:07:38 -08:00
logc960a0ca49fe83a32b078b02594df799da908341
tree986c9949074d1468fa99354d4f89b06d0e0e23c4
parent9088248938a96929648d9fcddd37746017da3820

expose yaml mapping in module struct


3 files changed, 7 insertions(+), 0 deletions(-)

src/common.zig+2
...@@ -110,6 +110,7 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec...@@ -110,6 +110,7 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec
110 .c_source_files = &[_][]const u8{},110 .c_source_files = &[_][]const u8{},
111 .deps = &[_]u.Module{},111 .deps = &[_]u.Module{},
112 .clean_path = d.path,112 .clean_path = d.path,
113 .yaml = null,
113 });114 });
114 },115 },
115 else => blk: {116 else => blk: {
...@@ -152,6 +153,7 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec...@@ -152,6 +153,7 @@ pub fn collect_deps(dir: []const u8, mpath: []const u8, comptime options: Collec
152 .clean_path = "",153 .clean_path = "",
153 .only_os = &[_][]const u8{},154 .only_os = &[_][]const u8{},
154 .except_os = &[_][]const u8{},155 .except_os = &[_][]const u8{},
156 .yaml = m.yaml,
155 };157 };
156}158}
157159
src/util/modfile.zig+2
...@@ -21,6 +21,7 @@ pub const ModFile = struct {...@@ -21,6 +21,7 @@ pub const ModFile = struct {
21 c_source_flags: [][]const u8,21 c_source_flags: [][]const u8,
22 c_source_files: [][]const u8,22 c_source_files: [][]const u8,
23 deps: []u.Dep,23 deps: []u.Dep,
24 yaml: yaml.Mapping,
2425
25 pub fn init(alloc: *std.mem.Allocator, fpath: []const u8) !Self {26 pub fn init(alloc: *std.mem.Allocator, fpath: []const u8) !Self {
26 //27 //
...@@ -76,6 +77,7 @@ pub const ModFile = struct {...@@ -76,6 +77,7 @@ pub const ModFile = struct {
76 .c_source_flags = try doc.mapping.get_string_array(alloc, "c_source_flags"),77 .c_source_flags = try doc.mapping.get_string_array(alloc, "c_source_flags"),
77 .c_source_files = try doc.mapping.get_string_array(alloc, "c_source_files"),78 .c_source_files = try doc.mapping.get_string_array(alloc, "c_source_files"),
78 .deps = dep_list.items,79 .deps = dep_list.items,
80 .yaml = doc.mapping,
79 };81 };
80 }82 }
81};83};
src/util/module.zig+3
...@@ -3,6 +3,7 @@ const gpa = std.heap.c_allocator;...@@ -3,6 +3,7 @@ const gpa = std.heap.c_allocator;
3const builtin = @import("builtin");3const builtin = @import("builtin");
44
5const u = @import("index.zig");5const u = @import("index.zig");
6const yaml = @import("./yaml.zig");
67
7//8//
8//9//
...@@ -17,6 +18,7 @@ pub const Module = struct {...@@ -17,6 +18,7 @@ pub const Module = struct {
17 c_source_files: [][]const u8,18 c_source_files: [][]const u8,
18 only_os: [][]const u8,19 only_os: [][]const u8,
19 except_os: [][]const u8,20 except_os: [][]const u8,
21 yaml: ?yaml.Mapping,
2022
21 deps: []Module,23 deps: []Module,
22 clean_path: []const u8,24 clean_path: []const u8,
...@@ -34,6 +36,7 @@ pub const Module = struct {...@@ -34,6 +36,7 @@ pub const Module = struct {
34 .clean_path = try dep.clean_path(),36 .clean_path = try dep.clean_path(),
35 .only_os = dep.only_os,37 .only_os = dep.only_os,
36 .except_os = dep.except_os,38 .except_os = dep.except_os,
39 .yaml = null,
37 };40 };
38 }41 }
3942