authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-10 18:11:41 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-10 18:11:41 -07:00
log5a5394b6c164d9a40fc3d5dce44ee58cb76f2397
treedc7020453c335af6b5ab7e2d4daf9c7adad70cb1
parent7fd89da8f4e2cd524aeb0e88e0a22ca56a438b16

deps.zig- expose `Package.directory`, closes #9


3 files changed, 17 insertions(+), 4 deletions(-)

deps.zig+13
...@@ -31,6 +31,7 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void {...@@ -31,6 +31,7 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void {
31}31}
3232
33pub const Package = struct {33pub const Package = struct {
34 directory: string,
34 pkg: ?Pkg = null,35 pkg: ?Pkg = null,
35 c_include_dirs: []const string = &.{},36 c_include_dirs: []const string = &.{},
36 c_source_files: []const string = &.{},37 c_source_files: []const string = &.{},
...@@ -55,52 +56,64 @@ pub const dirs = struct {...@@ -55,52 +56,64 @@ pub const dirs = struct {
5556
56pub const package_data = struct {57pub const package_data = struct {
57 pub const _8mdbh0zuneb0 = Package{58 pub const _8mdbh0zuneb0 = Package{
59 .directory = dirs._8mdbh0zuneb0,
58 .c_include_dirs = &.{ "include" },60 .c_include_dirs = &.{ "include" },
59 .c_source_files = &.{ "src/api.c", "src/dumper.c", "src/emitter.c", "src/loader.c", "src/parser.c", "src/reader.c", "src/scanner.c", "src/writer.c" },61 .c_source_files = &.{ "src/api.c", "src/dumper.c", "src/emitter.c", "src/loader.c", "src/parser.c", "src/reader.c", "src/scanner.c", "src/writer.c" },
60 .c_source_flags = &.{ "-DYAML_VERSION_MAJOR=0", "-DYAML_VERSION_MINOR=2", "-DYAML_VERSION_PATCH=5", "-DYAML_VERSION_STRING=\"0.2.5\"", "-DYAML_DECLARE_STATIC=1" },62 .c_source_flags = &.{ "-DYAML_VERSION_MAJOR=0", "-DYAML_VERSION_MINOR=2", "-DYAML_VERSION_PATCH=5", "-DYAML_VERSION_STRING=\"0.2.5\"", "-DYAML_DECLARE_STATIC=1" },
61 };63 };
6264
63 pub const _s84v9o48ucb0 = Package{65 pub const _s84v9o48ucb0 = Package{
66 .directory = dirs._s84v9o48ucb0,
64 .pkg = Pkg{ .name = "ansi", .path = .{ .path = dirs._s84v9o48ucb0 ++ "/src/lib.zig" }, .dependencies = null },67 .pkg = Pkg{ .name = "ansi", .path = .{ .path = dirs._s84v9o48ucb0 ++ "/src/lib.zig" }, .dependencies = null },
65 };68 };
6669
67 pub const _2ta738wrqbaq = Package{70 pub const _2ta738wrqbaq = Package{
71 .directory = dirs._2ta738wrqbaq,
68 .pkg = Pkg{ .name = "known-folders", .path = .{ .path = dirs._2ta738wrqbaq ++ "/known-folders.zig" }, .dependencies = null },72 .pkg = Pkg{ .name = "known-folders", .path = .{ .path = dirs._2ta738wrqbaq ++ "/known-folders.zig" }, .dependencies = null },
69 };73 };
7074
71 pub const _0npcrzfdlrvk = Package{75 pub const _0npcrzfdlrvk = Package{
76 .directory = dirs._0npcrzfdlrvk,
72 .pkg = Pkg{ .name = "licenses", .path = .{ .path = dirs._0npcrzfdlrvk ++ "/src/lib.zig" }, .dependencies = null },77 .pkg = Pkg{ .name = "licenses", .path = .{ .path = dirs._0npcrzfdlrvk ++ "/src/lib.zig" }, .dependencies = null },
73 };78 };
7479
75 pub const _9k24gimke1an = Package{80 pub const _9k24gimke1an = Package{
81 .directory = dirs._9k24gimke1an,
76 .pkg = Pkg{ .name = "hzzp", .path = .{ .path = dirs._9k24gimke1an ++ "/src/main.zig" }, .dependencies = null },82 .pkg = Pkg{ .name = "hzzp", .path = .{ .path = dirs._9k24gimke1an ++ "/src/main.zig" }, .dependencies = null },
77 };83 };
7884
79 pub const _csbnipaad8n7 = Package{85 pub const _csbnipaad8n7 = Package{
86 .directory = dirs._csbnipaad8n7,
80 .pkg = Pkg{ .name = "iguanaTLS", .path = .{ .path = dirs._csbnipaad8n7 ++ "/src/main.zig" }, .dependencies = null },87 .pkg = Pkg{ .name = "iguanaTLS", .path = .{ .path = dirs._csbnipaad8n7 ++ "/src/main.zig" }, .dependencies = null },
81 };88 };
8289
83 pub const _yyhw90zkzgmu = Package{90 pub const _yyhw90zkzgmu = Package{
91 .directory = dirs._yyhw90zkzgmu,
84 .pkg = Pkg{ .name = "network", .path = .{ .path = dirs._yyhw90zkzgmu ++ "/network.zig" }, .dependencies = null },92 .pkg = Pkg{ .name = "network", .path = .{ .path = dirs._yyhw90zkzgmu ++ "/network.zig" }, .dependencies = null },
85 };93 };
8694
87 pub const _u9w9dpp6p804 = Package{95 pub const _u9w9dpp6p804 = Package{
96 .directory = dirs._u9w9dpp6p804,
88 .pkg = Pkg{ .name = "uri", .path = .{ .path = dirs._u9w9dpp6p804 ++ "/uri.zig" }, .dependencies = null },97 .pkg = Pkg{ .name = "uri", .path = .{ .path = dirs._u9w9dpp6p804 ++ "/uri.zig" }, .dependencies = null },
89 };98 };
9099
91 pub const _ejw82j2ipa0e = Package{100 pub const _ejw82j2ipa0e = Package{
101 .directory = dirs._ejw82j2ipa0e,
92 .pkg = Pkg{ .name = "zfetch", .path = .{ .path = dirs._ejw82j2ipa0e ++ "/src/main.zig" }, .dependencies = &.{ _9k24gimke1an.pkg.?, _csbnipaad8n7.pkg.?, _yyhw90zkzgmu.pkg.?, _u9w9dpp6p804.pkg.? } },102 .pkg = Pkg{ .name = "zfetch", .path = .{ .path = dirs._ejw82j2ipa0e ++ "/src/main.zig" }, .dependencies = &.{ _9k24gimke1an.pkg.?, _csbnipaad8n7.pkg.?, _yyhw90zkzgmu.pkg.?, _u9w9dpp6p804.pkg.? } },
93 };103 };
94104
95 pub const _ocmr9rtohgcc = Package{105 pub const _ocmr9rtohgcc = Package{
106 .directory = dirs._ocmr9rtohgcc,
96 .pkg = Pkg{ .name = "json", .path = .{ .path = dirs._ocmr9rtohgcc ++ "/src/lib.zig" }, .dependencies = null },107 .pkg = Pkg{ .name = "json", .path = .{ .path = dirs._ocmr9rtohgcc ++ "/src/lib.zig" }, .dependencies = null },
97 };108 };
98109
99 pub const _tnj3qf44tpeq = Package{110 pub const _tnj3qf44tpeq = Package{
111 .directory = dirs._tnj3qf44tpeq,
100 .pkg = Pkg{ .name = "range", .path = .{ .path = dirs._tnj3qf44tpeq ++ "/src/lib.zig" }, .dependencies = null },112 .pkg = Pkg{ .name = "range", .path = .{ .path = dirs._tnj3qf44tpeq ++ "/src/lib.zig" }, .dependencies = null },
101 };113 };
102114
103 pub const _89ujp8gq842x = Package{115 pub const _89ujp8gq842x = Package{
116 .directory = dirs._89ujp8gq842x,
104 .pkg = Pkg{ .name = "zigmod", .path = .{ .path = dirs._89ujp8gq842x ++ "/src/lib.zig" }, .dependencies = &.{ _s84v9o48ucb0.pkg.?, _2ta738wrqbaq.pkg.?, _0npcrzfdlrvk.pkg.?, _ejw82j2ipa0e.pkg.?, _ocmr9rtohgcc.pkg.?, _tnj3qf44tpeq.pkg.? } },117 .pkg = Pkg{ .name = "zigmod", .path = .{ .path = dirs._89ujp8gq842x ++ "/src/lib.zig" }, .dependencies = &.{ _s84v9o48ucb0.pkg.?, _2ta738wrqbaq.pkg.?, _0npcrzfdlrvk.pkg.?, _ejw82j2ipa0e.pkg.?, _ocmr9rtohgcc.pkg.?, _tnj3qf44tpeq.pkg.? } },
105 };118 };
106119
docs/deps.zig.md+1-4
...@@ -12,6 +12,7 @@ A helper function to add all of the packages, C files, and system libraries to t...@@ -12,6 +12,7 @@ A helper function to add all of the packages, C files, and system libraries to t
12### `Package`12### `Package`
13```zig13```zig
14pub const Package = struct {14pub const Package = struct {
15 directory: string,
15 pkg: ?Pkg = null,16 pkg: ?Pkg = null,
16 c_include_dirs: []const string = &.{},17 c_include_dirs: []const string = &.{},
17 c_source_files: []const string = &.{},18 c_source_files: []const string = &.{},
...@@ -20,10 +21,6 @@ pub const Package = struct {...@@ -20,10 +21,6 @@ pub const Package = struct {
20};21};
21```22```
2223
23### `dirs`
24- Type: `struct<ID, []const u8>`
25A comptime-known string array of the package directories for each dependency relative to the project root.
26
27### `package_data`24### `package_data`
28- Type: `struct<ID, Package>`25- Type: `struct<ID, Package>`
29This is a meta struct that associates ID's to their relavant `Package` definition.26This is a meta struct that associates ID's to their relavant `Package` definition.
src/cmd/fetch.zig+3
...@@ -67,6 +67,7 @@ pub fn create_depszig(dir: []const u8, top_module: u.Module, list: *std.ArrayLis...@@ -67,6 +67,7 @@ pub fn create_depszig(dir: []const u8, top_module: u.Module, list: *std.ArrayLis
67 \\}67 \\}
68 \\68 \\
69 \\pub const Package = struct {69 \\pub const Package = struct {
70 \\ directory: string,
70 \\ pkg: ?Pkg = null,71 \\ pkg: ?Pkg = null,
71 \\ c_include_dirs: []const string = &.{},72 \\ c_include_dirs: []const string = &.{},
72 \\ c_source_files: []const string = &.{},73 \\ c_source_files: []const string = &.{},
...@@ -152,9 +153,11 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(u.Module), d...@@ -152,9 +153,11 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(u.Module), d
152 if (contains_all(mod.deps, done.items)) {153 if (contains_all(mod.deps, done.items)) {
153 try w.print(154 try w.print(
154 \\ pub const _{s} = Package{{155 \\ pub const _{s} = Package{{
156 \\ .directory = dirs._{s},
155 \\157 \\
156 , .{158 , .{
157 mod.short_id(),159 mod.short_id(),
160 mod.short_id(),
158 });161 });
159 if (mod.main.len > 0 and !std.mem.eql(u8, mod.id, "root")) {162 if (mod.main.len > 0 and !std.mem.eql(u8, mod.id, "root")) {
160 try w.print(163 try w.print(