authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-09-15 15:54:27 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-09-15 15:54:27 -07:00
logf842053622e10883b17aec241587cd962c35971b
tree9353d90066bf5c961c30838e4e236298b0ac9780
parent3cffae7e763459d00316e73c623cab10a03dab95

add type field to zigmod.Module


2 files changed, 5 insertions(+), 0 deletions(-)

src/common.zig+3
...@@ -50,6 +50,7 @@ pub fn collect_deps_deep(cachepath: string, mdir: std.fs.Dir, options: *CollectO...@@ -50,6 +50,7 @@ pub fn collect_deps_deep(cachepath: string, mdir: std.fs.Dir, options: *CollectO
50 return zigmod.Module{50 return zigmod.Module{
51 .is_sys_lib = false,51 .is_sys_lib = false,
52 .is_framework = false,52 .is_framework = false,
53 .type = .local,
53 .id = "root",54 .id = "root",
54 .name = "root",55 .name = "root",
55 .main = m.main,56 .main = m.main,
...@@ -79,6 +80,7 @@ pub fn collect_deps(cachepath: string, mdir: std.fs.Dir, options: *CollectOption...@@ -79,6 +80,7 @@ pub fn collect_deps(cachepath: string, mdir: std.fs.Dir, options: *CollectOption
79 return zigmod.Module{80 return zigmod.Module{
80 .is_sys_lib = false,81 .is_sys_lib = false,
81 .is_framework = false,82 .is_framework = false,
83 .type = .local,
82 .id = m.id,84 .id = m.id,
83 .name = m.name,85 .name = m.name,
84 .main = m.main,86 .main = m.main,
...@@ -231,6 +233,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: string, options: *CollectO...@@ -231,6 +233,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: string, options: *CollectO
231 return zigmod.Module{233 return zigmod.Module{
232 .is_sys_lib = d.type == .system_lib,234 .is_sys_lib = d.type == .system_lib,
233 .is_framework = d.type == .framework,235 .is_framework = d.type == .framework,
236 .type = d.type,
234 .id = try u.do_hash(options.alloc, std.crypto.hash.sha3.Sha3_384, d.path),237 .id = try u.do_hash(options.alloc, std.crypto.hash.sha3.Sha3_384, d.path),
235 .name = d.path,238 .name = d.path,
236 .only_os = d.only_os,239 .only_os = d.only_os,
src/util/module.zig+2
...@@ -13,6 +13,7 @@ const common = @import("./../common.zig");...@@ -13,6 +13,7 @@ const common = @import("./../common.zig");
13pub const Module = struct {13pub const Module = struct {
14 is_sys_lib: bool,14 is_sys_lib: bool,
15 is_framework: bool,15 is_framework: bool,
16 type: zigmod.Dep.Type,
16 id: string,17 id: string,
17 name: string,18 name: string,
18 main: string,19 main: string,
...@@ -41,6 +42,7 @@ pub const Module = struct {...@@ -41,6 +42,7 @@ pub const Module = struct {
41 return Module{42 return Module{
42 .is_sys_lib = false,43 .is_sys_lib = false,
43 .is_framework = false,44 .is_framework = false,
45 .type = dep.type,
44 .id = if (dep.id.len > 0) dep.id else try u.random_string(alloc, 48),46 .id = if (dep.id.len > 0) dep.id else try u.random_string(alloc, 48),
45 .name = dep.name,47 .name = dep.name,
46 .main = dep.main,48 .main = dep.main,