authoravatarMeghan Denny<hello@nektro.net>2026-10-16 00:36:39-07:00
committeravatarMeghan Denny<hello@nektro.net>2026-10-16 00:37:26-07:00
logc6d2581c4663bc7d1ee2a172b526734a1cc56a5a
tree41569848a22da76707195575c7f0d4ce2e7cdc65
parent0319d62e9b650aaeae25d7e9d317a0b4fe83a9d7
signature Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

cmd/generate: remove Package store


2 files changed, 84 insertions(+), 155 deletions(-)

deps.zig+53-97
...@@ -4,78 +4,54 @@ const builtin = @import("builtin");...@@ -4,78 +4,54 @@ const builtin = @import("builtin");
4const string = []const u8;4const string = []const u8;
55
6pub const GitExactStep = struct {6pub const GitExactStep = struct {
7 step: std.Build.Step,7 step: *std.Build.Step,
8 builder: *std.Build,8 path: std.Build.LazyPath,
9 url: string,
10 commit: string,
119
12 pub fn create(b: *std.Build, url: string, commit: string) *GitExactStep {10 pub fn create(b: *std.Build, url: string, commit: string) GitExactStep {
13 var result = b.allocator.create(GitExactStep) catch @panic("memory");11 const sc_clone = b.addSystemCommand(&.{ "git", "clone" });
14 result.* = GitExactStep{12 sc_clone.addArg("--quiet");
15 .step = std.Build.Step.init(.{13 sc_clone.addArg("--progress");
16 .id = .custom,14 sc_clone.addArg("--depth");
17 .name = b.fmt("git clone {s} @ {s}", .{ url, commit }),15 sc_clone.addArg("1");
18 .owner = b,16 sc_clone.addArg("--revision");
19 .makeFn = make,17 sc_clone.addArg(commit);
20 }),18 sc_clone.addArg(url);
21 .builder = b,19 const path = sc_clone.addOutputDirectoryArg(std.fs.path.basenamePosix(url));
22 .url = url,20 return .{
23 .commit = commit,21 .step = &sc_clone.step,
24 };22 .path = path,
2523 };
2624 }
27
28 var urlpath = url;
29 urlpath = trimPrefix(u8, urlpath, "https://");
30 urlpath = trimPrefix(u8, urlpath, "git://");
31 const repopath = b.fmt("{s}/zigmod/deps/git/{s}/{s}", .{ b.cache_root.path.?, urlpath, commit });
32 flip(std.Io.Dir.cwd().access(std.Options.debug_io, repopath, .{})) catch return result;
33
34 var clonestep = std.Build.Step.Run.create(b, "clone");
35 clonestep.addArgs(&.{ "git", "clone", "-q", "--progress", url, repopath });
36
37 var checkoutstep = std.Build.Step.Run.create(b, "checkout");
38 checkoutstep.addArgs(&.{ "git", "-C", repopath, "checkout", "-q", commit });
39 result.step.dependOn(&checkoutstep.step);
40 checkoutstep.step.dependOn(&clonestep.step);
41
42 return result;
43 }
44
45 fn make(step: *std.Build.Step, options: std.Build.Step.MakeOptions) !void {
46 _ = step;
47 _ = options;
48 }
49};25};
5026
51pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {27pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {
52 const b = exe.step.owner;28 const b = exe.step.owner;
53 const step = b.step("fetch", "");29 const step = b.step("fetch", "");
54 step.dependOn(&GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "9f15c276b4e9d05afd34a10d8662a7dfc34647ea").step);30 dependOnGit(GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "9f15c276b4e9d05afd34a10d8662a7dfc34647ea"), step, &@field(package_data, "_o6ogpor87xc2"));
55 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "d2465c64833590a04bd9b7f50c87363fd03e65bf").step);31 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "d2465c64833590a04bd9b7f50c87363fd03e65bf"), step, &@field(package_data, "_u7sysdckdymi"));
56 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "bebb39ae30d9848a1c212cee582d0b1c102d8b87").step);32 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "bebb39ae30d9848a1c212cee582d0b1c102d8b87"), step, &@field(package_data, "_s84v9o48ucb0"));
57 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "6de79b4ff8f7462e26f224f4bed3c81710c8893b").step);33 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "6de79b4ff8f7462e26f224f4bed3c81710c8893b"), step, &@field(package_data, "_2ovav391ivak"));
58 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "8f6c4761e5c22c6a5c83a032e764154b840275bc").step);34 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-extras", "8f6c4761e5c22c6a5c83a032e764154b840275bc"), step, &@field(package_data, "_f7dubzb7cyqe"));
59 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-git", "88b94a1960be841bb93a0bca65d556cb6385d1fd").step);35 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-git", "88b94a1960be841bb93a0bca65d556cb6385d1fd"), step, &@field(package_data, "_0k64oe2nuzvj"));
60 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "e745b018f87ddc4c8958370332e6cf61625403cc").step);36 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "e745b018f87ddc4c8958370332e6cf61625403cc"), step, &@field(package_data, "_c1xirp1ota5p"));
61 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-intrusive-parser", "800cbe5b241fc52370cb8f892f0d9c6f97133725").step);37 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-intrusive-parser", "800cbe5b241fc52370cb8f892f0d9c6f97133725"), step, &@field(package_data, "_7l3oxw6nqqws"));
62 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-json", "a731b57ee685ff1ddeea9456a924f45ce4da3031").step);38 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-json", "a731b57ee685ff1ddeea9456a924f45ce4da3031"), step, &@field(package_data, "_ocmr9rtohgcc"));
63 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "014971d4b1e327a5c61322c3a6b9369fd1863864").step);39 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-leven", "014971d4b1e327a5c61322c3a6b9369fd1863864"), step, &@field(package_data, "_96h80ezrvj7i"));
64 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "bc1cd51625c13d6c7df819fd0d85968e617f5c57").step);40 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-licenses", "bc1cd51625c13d6c7df819fd0d85968e617f5c57"), step, &@field(package_data, "_0npcrzfdlrvk"));
65 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "a9d067c3c4d6c226a1de5531b66785bc15d869ee").step);41 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-licenses-text", "a9d067c3c4d6c226a1de5531b66785bc15d869ee"), step, &@field(package_data, "_pt88y5d80m25"));
66 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nfs", "1a27fe574706f0b91c9f66b22fe7d3fa8f5129d5").step);42 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-nfs", "1a27fe574706f0b91c9f66b22fe7d3fa8f5129d5"), step, &@field(package_data, "_vph9l0hxpeze"));
67 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-nio", "17c4f044b15917efc1d3f018765881d53fa27e48").step);43 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-nio", "17c4f044b15917efc1d3f018765881d53fa27e48"), step, &@field(package_data, "_kscsl0145t7x"));
68 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-darwin", "b349aa32b55aae4cf2ae56740003f8aff0394920").step);44 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-sys-darwin", "b349aa32b55aae4cf2ae56740003f8aff0394920"), step, &@field(package_data, "_73bukkeci2u6"));
69 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-freebsd", "f97e6c2de30af76818572490735c84ce1015958b").step);45 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-sys-freebsd", "f97e6c2de30af76818572490735c84ce1015958b"), step, &@field(package_data, "_qfev2g50alvp"));
70 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-linux", "6dabe7cce239d882c8fd132ab5cda1d1f9ff3634").step);46 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-sys-linux", "6dabe7cce239d882c8fd132ab5cda1d1f9ff3634"), step, &@field(package_data, "_h7tv7ayhffak"));
71 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-netbsd", "5ad432ca421c59099be3630b9d0dda49e8bef0a7").step);47 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-sys-netbsd", "5ad432ca421c59099be3630b9d0dda49e8bef0a7"), step, &@field(package_data, "_uvkgl6xf1azv"));
72 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-sys-openbsd", "164646a5e7c4129eb92ac524a60f1759605c99df").step);48 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-sys-openbsd", "164646a5e7c4129eb92ac524a60f1759605c99df"), step, &@field(package_data, "_4rmxgmcykiba"));
73 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "1349fb2c8aaaa1503e8730facea6f87c5fe75dc0").step);49 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-time", "1349fb2c8aaaa1503e8730facea6f87c5fe75dc0"), step, &@field(package_data, "_iecwp4b3bsfm"));
74 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "4ad0602d52a3f40ef74f59f648602c61409f7ba7").step);50 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "4ad0602d52a3f40ef74f59f648602c61409f7ba7"), step, &@field(package_data, "_ede2wygpe1iy"));
75 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "dff9fd43ebf1046c70090bdccfeb2e4f1c0d584b").step);51 dependOnGit(GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "dff9fd43ebf1046c70090bdccfeb2e4f1c0d584b"), step, &@field(package_data, "_g982zq6e8wsv"));
76 step.dependOn(&GitExactStep.create(b, "https://github.com/madler/zlib", "da607da739fa6047df13e66a2af6b8bec7c2a498").step);52 dependOnGit(GitExactStep.create(b, "https://github.com/madler/zlib", "da607da739fa6047df13e66a2af6b8bec7c2a498"), step, &@field(package_data, "_0e2d06bb494b"));
77 step.dependOn(&GitExactStep.create(b, "https://github.com/yaml/libyaml", "2c891fc7a770e8ba2fec34fc6b545c672beb37e6").step);53 dependOnGit(GitExactStep.create(b, "https://github.com/yaml/libyaml", "2c891fc7a770e8ba2fec34fc6b545c672beb37e6"), step, &@field(package_data, "_8mdbh0zuneb0"));
78 step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "207c34a16e4365edc20d92c7892f962b3bed46e8").step);54 dependOnGit(GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "207c34a16e4365edc20d92c7892f962b3bed46e8"), step, &@field(package_data, "_2ta738wrqbaq"));
79 return step;55 return step;
80}56}
8157
...@@ -103,11 +79,16 @@ pub fn addAllTo(exe: *std.Build.Step.Compile) void {...@@ -103,11 +79,16 @@ pub fn addAllTo(exe: *std.Build.Step.Compile) void {
103 inline for (comptime std.meta.declarations(package_data)) |decl| @field(package_data, decl.name).module_memo = null;79 inline for (comptime std.meta.declarations(package_data)) |decl| @field(package_data, decl.name).module_memo = null;
104}80}
10581
82pub fn dependOnGit(ge: GitExactStep, s: *std.Build.Step, p: *Package) void {
83 s.dependOn(ge.step);
84 p.path = ge.path;
85}
86
106var link_lib_c = false;87var link_lib_c = false;
107pub const Package = struct {88pub const Package = struct {
108 name: string = "",89 name: string = "",
109 store: ?string = null,
110 main: ?string = null,90 main: ?string = null,
91 path: ?std.Build.LazyPath = null,
111 deps: []const *Package = &.{},92 deps: []const *Package = &.{},
112 c_include_dirs: []const string = &.{},93 c_include_dirs: []const string = &.{},
113 c_source_files: []const string = &.{},94 c_source_files: []const string = &.{},
...@@ -137,8 +118,8 @@ pub const Package = struct {...@@ -137,8 +118,8 @@ pub const Package = struct {
137 dummy_library.step.dependOn(fetch_step);118 dummy_library.step.dependOn(fetch_step);
138 var links: u32 = 0;119 var links: u32 = 0;
139 if (self.main) |m| {120 if (self.main) |m| {
140 if (self.store) |s| {121 if (self.path) |p| {
141 result.root_source_file = (std.Build.LazyPath{ .cwd_relative = b.cache_root.path.? }).path(b, "zigmod/deps").path(b, s[1..]).path(b, m);122 result.root_source_file = p.path(b, m);
142 } else {123 } else {
143 result.root_source_file = b.path(m);124 result.root_source_file = b.path(m);
144 }125 }
...@@ -157,13 +138,13 @@ pub const Package = struct {...@@ -157,13 +138,13 @@ pub const Package = struct {
157 }138 }
158 }139 }
159 for (self.c_include_dirs) |item| {140 for (self.c_include_dirs) |item| {
160 result.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) });141 result.addIncludePath(self.path.?.path(b, item));
161 dummy_library.root_module.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) });142 dummy_library.root_module.addIncludePath(self.path.?.path(b, item));
162 link_lib_c = true;143 link_lib_c = true;
163 links += 1;144 links += 1;
164 }145 }
165 for (self.c_source_files) |item| {146 for (self.c_source_files) |item| {
166 dummy_library.root_module.addCSourceFile(.{ .file = .{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }, .flags = self.c_source_flags });147 dummy_library.root_module.addCSourceFile(.{ .file = self.path.?.path(b, item), .flags = self.c_source_flags });
167 links += 1;148 links += 1;
168 }149 }
169 for (self.system_libs) |item| {150 for (self.system_libs) |item| {
...@@ -195,139 +176,114 @@ fn checkMinZig(current: std.SemanticVersion, exe: *std.Build.Step.Compile) void...@@ -195,139 +176,114 @@ fn checkMinZig(current: std.SemanticVersion, exe: *std.Build.Step.Compile) void
195176
196pub const package_data = struct {177pub const package_data = struct {
197 pub var _o6ogpor87xc2 = Package{178 pub var _o6ogpor87xc2 = Package{
198 .store = "/git/github.com/marlersoft/zigwin32/9f15c276b4e9d05afd34a10d8662a7dfc34647ea",
199 .name = "win32",179 .name = "win32",
200 .main = "win32.zig",180 .main = "win32.zig",
201 };181 };
202 pub var _u7sysdckdymi = Package{182 pub var _u7sysdckdymi = Package{
203 .store = "/git/github.com/nektro/arqv-ini/d2465c64833590a04bd9b7f50c87363fd03e65bf",
204 .name = "ini",183 .name = "ini",
205 .main = "src/ini.zig",184 .main = "src/ini.zig",
206 };185 };
207 pub var _s84v9o48ucb0 = Package{186 pub var _s84v9o48ucb0 = Package{
208 .store = "/git/github.com/nektro/zig-ansi/bebb39ae30d9848a1c212cee582d0b1c102d8b87",
209 .name = "ansi",187 .name = "ansi",
210 .main = "src/lib.zig",188 .main = "src/lib.zig",
211 };189 };
212 pub var _f7dubzb7cyqe = Package{190 pub var _f7dubzb7cyqe = Package{
213 .store = "/git/github.com/nektro/zig-extras/8f6c4761e5c22c6a5c83a032e764154b840275bc",
214 .name = "extras",191 .name = "extras",
215 .main = "src/lib.zig",192 .main = "src/lib.zig",
216 };193 };
217 pub var _c1xirp1ota5p = Package{194 pub var _c1xirp1ota5p = Package{
218 .store = "/git/github.com/nektro/zig-inquirer/e745b018f87ddc4c8958370332e6cf61625403cc",
219 .name = "inquirer",195 .name = "inquirer",
220 .main = "src/lib.zig",196 .main = "src/lib.zig",
221 .deps = &[_]*Package{ &_s84v9o48ucb0 },197 .deps = &[_]*Package{ &_s84v9o48ucb0 },
222 };198 };
223 pub var _96h80ezrvj7i = Package{199 pub var _96h80ezrvj7i = Package{
224 .store = "/git/github.com/nektro/zig-leven/014971d4b1e327a5c61322c3a6b9369fd1863864",
225 .name = "leven",200 .name = "leven",
226 .main = "src/lib.zig",201 .main = "src/lib.zig",
227 };202 };
228 pub var _0npcrzfdlrvk = Package{203 pub var _0npcrzfdlrvk = Package{
229 .store = "/git/github.com/nektro/zig-licenses/bc1cd51625c13d6c7df819fd0d85968e617f5c57",
230 .name = "licenses",204 .name = "licenses",
231 .main = "src/lib.zig",205 .main = "src/lib.zig",
232 };206 };
233 pub var _pt88y5d80m25 = Package{207 pub var _pt88y5d80m25 = Package{
234 .store = "/git/github.com/nektro/zig-licenses-text/a9d067c3c4d6c226a1de5531b66785bc15d869ee",
235 .name = "licenses-text",208 .name = "licenses-text",
236 .main = "src/lib.zig",209 .main = "src/lib.zig",
237 };210 };
238 pub var _73bukkeci2u6 = Package{211 pub var _73bukkeci2u6 = Package{
239 .store = "/git/github.com/nektro/zig-sys-darwin/b349aa32b55aae4cf2ae56740003f8aff0394920",
240 .name = "sys-darwin",212 .name = "sys-darwin",
241 .main = "sys_darwin.zig",213 .main = "sys_darwin.zig",
242 };214 };
243 pub var _qfev2g50alvp = Package{215 pub var _qfev2g50alvp = Package{
244 .store = "/git/github.com/nektro/zig-sys-freebsd/f97e6c2de30af76818572490735c84ce1015958b",
245 .name = "sys-freebsd",216 .name = "sys-freebsd",
246 .main = "freebsd.zig",217 .main = "freebsd.zig",
247 };218 };
248 pub var _h7tv7ayhffak = Package{219 pub var _h7tv7ayhffak = Package{
249 .store = "/git/github.com/nektro/zig-sys-linux/6dabe7cce239d882c8fd132ab5cda1d1f9ff3634",
250 .name = "sys-linux",220 .name = "sys-linux",
251 .main = "mod.zig",221 .main = "mod.zig",
252 };222 };
253 pub var _uvkgl6xf1azv = Package{223 pub var _uvkgl6xf1azv = Package{
254 .store = "/git/github.com/nektro/zig-sys-netbsd/5ad432ca421c59099be3630b9d0dda49e8bef0a7",
255 .name = "sys-netbsd",224 .name = "sys-netbsd",
256 .main = "netbsd.zig",225 .main = "netbsd.zig",
257 };226 };
258 pub var _4rmxgmcykiba = Package{227 pub var _4rmxgmcykiba = Package{
259 .store = "/git/github.com/nektro/zig-sys-openbsd/164646a5e7c4129eb92ac524a60f1759605c99df",
260 .name = "sys-openbsd",228 .name = "sys-openbsd",
261 .main = "openbsd.zig",229 .main = "openbsd.zig",
262 };230 };
263 pub var _kscsl0145t7x = Package{231 pub var _kscsl0145t7x = Package{
264 .store = "/git/github.com/nektro/zig-nio/17c4f044b15917efc1d3f018765881d53fa27e48",
265 .name = "nio",232 .name = "nio",
266 .main = "nio.zig",233 .main = "nio.zig",
267 .deps = &[_]*Package{ &_h7tv7ayhffak, &_f7dubzb7cyqe, &_73bukkeci2u6, &_qfev2g50alvp, &_uvkgl6xf1azv, &_4rmxgmcykiba },234 .deps = &[_]*Package{ &_h7tv7ayhffak, &_f7dubzb7cyqe, &_73bukkeci2u6, &_qfev2g50alvp, &_uvkgl6xf1azv, &_4rmxgmcykiba },
268 };235 };
269 pub var _7l3oxw6nqqws = Package{236 pub var _7l3oxw6nqqws = Package{
270 .store = "/git/github.com/nektro/zig-intrusive-parser/800cbe5b241fc52370cb8f892f0d9c6f97133725",
271 .name = "intrusive-parser",237 .name = "intrusive-parser",
272 .main = "intrusive_parser.zig",238 .main = "intrusive_parser.zig",
273 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_kscsl0145t7x },239 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_kscsl0145t7x },
274 };240 };
275 pub var _iecwp4b3bsfm = Package{241 pub var _iecwp4b3bsfm = Package{
276 .store = "/git/github.com/nektro/zig-time/1349fb2c8aaaa1503e8730facea6f87c5fe75dc0",
277 .name = "time",242 .name = "time",
278 .main = "time.zig",243 .main = "time.zig",
279 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_73bukkeci2u6, &_kscsl0145t7x, &_qfev2g50alvp, &_uvkgl6xf1azv, &_4rmxgmcykiba },244 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_73bukkeci2u6, &_kscsl0145t7x, &_qfev2g50alvp, &_uvkgl6xf1azv, &_4rmxgmcykiba },
280 };245 };
281 pub var _vph9l0hxpeze = Package{246 pub var _vph9l0hxpeze = Package{
282 .store = "/git/github.com/nektro/zig-nfs/1a27fe574706f0b91c9f66b22fe7d3fa8f5129d5",
283 .name = "nfs",247 .name = "nfs",
284 .main = "nfs.zig",248 .main = "nfs.zig",
285 .deps = &[_]*Package{ &_h7tv7ayhffak, &_kscsl0145t7x, &_iecwp4b3bsfm, &_73bukkeci2u6, &_qfev2g50alvp, &_uvkgl6xf1azv, &_4rmxgmcykiba },249 .deps = &[_]*Package{ &_h7tv7ayhffak, &_kscsl0145t7x, &_iecwp4b3bsfm, &_73bukkeci2u6, &_qfev2g50alvp, &_uvkgl6xf1azv, &_4rmxgmcykiba },
286 };250 };
287 pub var _2ovav391ivak = Package{251 pub var _2ovav391ivak = Package{
288 .store = "/git/github.com/nektro/zig-detect-license/6de79b4ff8f7462e26f224f4bed3c81710c8893b",
289 .name = "detect-license",252 .name = "detect-license",
290 .main = "src/lib.zig",253 .main = "src/lib.zig",
291 .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i, &_vph9l0hxpeze },254 .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i, &_vph9l0hxpeze },
292 };255 };
293 pub var _ede2wygpe1iy = Package{256 pub var _ede2wygpe1iy = Package{
294 .store = "/git/github.com/nektro/zig-tracer/4ad0602d52a3f40ef74f59f648602c61409f7ba7",
295 .name = "tracer",257 .name = "tracer",
296 .main = "src/mod.zig",258 .main = "src/mod.zig",
297 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_vph9l0hxpeze, &_kscsl0145t7x, &_iecwp4b3bsfm },259 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_vph9l0hxpeze, &_kscsl0145t7x, &_iecwp4b3bsfm },
298 };260 };
299 pub var _0k64oe2nuzvj = Package{261 pub var _0k64oe2nuzvj = Package{
300 .store = "/git/github.com/nektro/zig-git/88b94a1960be841bb93a0bca65d556cb6385d1fd",
301 .name = "git",262 .name = "git",
302 .main = "git.zig",263 .main = "git.zig",
303 .deps = &[_]*Package{ &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_ede2wygpe1iy, &_vph9l0hxpeze, &_kscsl0145t7x, &_0e2d06bb494b },264 .deps = &[_]*Package{ &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_ede2wygpe1iy, &_vph9l0hxpeze, &_kscsl0145t7x, &_0e2d06bb494b },
304 };265 };
305 pub var _ocmr9rtohgcc = Package{266 pub var _ocmr9rtohgcc = Package{
306 .store = "/git/github.com/nektro/zig-json/a731b57ee685ff1ddeea9456a924f45ce4da3031",
307 .name = "json",267 .name = "json",
308 .main = "json.zig",268 .main = "json.zig",
309 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_ede2wygpe1iy, &_7l3oxw6nqqws, &_kscsl0145t7x },269 .deps = &[_]*Package{ &_f7dubzb7cyqe, &_ede2wygpe1iy, &_7l3oxw6nqqws, &_kscsl0145t7x },
310 };270 };
311 pub var _g982zq6e8wsv = Package{271 pub var _g982zq6e8wsv = Package{
312 .store = "/git/github.com/nektro/zig-yaml/dff9fd43ebf1046c70090bdccfeb2e4f1c0d584b",
313 .name = "yaml",272 .name = "yaml",
314 .main = "yaml.zig",273 .main = "yaml.zig",
315 .deps = &[_]*Package{ &_8mdbh0zuneb0 },274 .deps = &[_]*Package{ &_8mdbh0zuneb0 },
316 };275 };
317 pub var _0e2d06bb494b = Package{276 pub var _0e2d06bb494b = Package{
318 .store = "/git/github.com/madler/zlib/da607da739fa6047df13e66a2af6b8bec7c2a498",
319 .c_include_dirs = &.{ "" },277 .c_include_dirs = &.{ "" },
320 .c_source_files = &.{ "inftrees.c", "inflate.c", "adler32.c", "zutil.c", "trees.c", "gzclose.c", "gzwrite.c", "gzread.c", "deflate.c", "compress.c", "crc32.c", "infback.c", "gzlib.c", "uncompr.c", "inffast.c" },278 .c_source_files = &.{ "inftrees.c", "inflate.c", "adler32.c", "zutil.c", "trees.c", "gzclose.c", "gzwrite.c", "gzread.c", "deflate.c", "compress.c", "crc32.c", "infback.c", "gzlib.c", "uncompr.c", "inffast.c" },
321 .c_source_flags = &.{ "-DZ_HAVE_UNISTD_H=1" },279 .c_source_flags = &.{ "-DZ_HAVE_UNISTD_H=1" },
322 };280 };
323 pub var _8mdbh0zuneb0 = Package{281 pub var _8mdbh0zuneb0 = Package{
324 .store = "/git/github.com/yaml/libyaml/2c891fc7a770e8ba2fec34fc6b545c672beb37e6",
325 .c_include_dirs = &.{ "include" },282 .c_include_dirs = &.{ "include" },
326 .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" },283 .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" },
327 .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" },284 .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" },
328 };285 };
329 pub var _2ta738wrqbaq = Package{286 pub var _2ta738wrqbaq = Package{
330 .store = "/git/github.com/ziglibs/known-folders/207c34a16e4365edc20d92c7892f962b3bed46e8",
331 .name = "known-folders",287 .name = "known-folders",
332 .main = "known-folders.zig",288 .main = "known-folders.zig",
333 };289 };
src/cmd/generate.zig+31-58
...@@ -47,48 +47,24 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf...@@ -47,48 +47,24 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf
47 try w.writeAll("\n");47 try w.writeAll("\n");
48 try w.writeAll(48 try w.writeAll(
49 \\pub const GitExactStep = struct {49 \\pub const GitExactStep = struct {
50 \\ step: std.Build.Step,50 \\ step: *std.Build.Step,
51 \\ builder: *std.Build,51 \\ path: std.Build.LazyPath,
52 \\ url: string,
53 \\ commit: string,
54 \\52 \\
55 \\ pub fn create(b: *std.Build, url: string, commit: string) *GitExactStep {53 \\ pub fn create(b: *std.Build, url: string, commit: string) GitExactStep {
56 \\ var result = b.allocator.create(GitExactStep) catch @panic("memory");54 \\ const sc_clone = b.addSystemCommand(&.{ "git", "clone" });
57 \\ result.* = GitExactStep{55 \\ sc_clone.addArg("--quiet");
58 \\ .step = std.Build.Step.init(.{56 \\ sc_clone.addArg("--progress");
59 \\ .id = .custom,57 \\ sc_clone.addArg("--depth");
60 \\ .name = b.fmt("git clone {s} @ {s}", .{ url, commit }),58 \\ sc_clone.addArg("1");
61 \\ .owner = b,59 \\ sc_clone.addArg("--revision");
62 \\ .makeFn = make,60 \\ sc_clone.addArg(commit);
63 \\ }),61 \\ sc_clone.addArg(url);
64 \\ .builder = b,62 \\ const path = sc_clone.addOutputDirectoryArg(std.fs.path.basenamePosix(url));
65 \\ .url = url,63 \\ return .{
66 \\ .commit = commit,64 \\ .step = &sc_clone.step,
67 \\ };65 \\ .path = path,
68 \\66 \\ };
69 \\ var urlpath = url;67 \\ }
70 \\ urlpath = trimPrefix(u8, urlpath, "https://");
71 \\ urlpath = trimPrefix(u8, urlpath, "git://");
72 \\ const repopath = b.fmt("{s}/zigmod/deps/git/{s}/{s}", .{ b.cache_root.path.?, urlpath, commit });
73 \\ flip(std.Io.Dir.cwd().access(std.Options.debug_io, repopath, .{})) catch return result;
74 \\
75 \\ var clonestep = std.Build.Step.Run.create(b, "clone");
76 \\ clonestep.addArgs(&.{ "git", "clone", "-q", "--progress", url, repopath });
77 \\
78 \\ var checkoutstep = std.Build.Step.Run.create(b, "checkout");
79 \\ checkoutstep.addArgs(&.{ "git", "-C", repopath, "checkout", "-q", commit });
80 \\ result.step.dependOn(&checkoutstep.step);
81 \\ checkoutstep.step.dependOn(&clonestep.step);
82 // TODO rm the .git folder
83 // TODO mark folder as read-only
84 \\
85 \\ return result;
86 \\ }
87 \\
88 \\ fn make(step: *std.Build.Step, options: std.Build.Step.MakeOptions) !void {
89 \\ _ = step;
90 \\ _ = options;
91 \\ }
92 \\};68 \\};
93 \\69 \\
94 \\pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {70 \\pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {
...@@ -101,7 +77,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf...@@ -101,7 +77,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf
101 .local => {},77 .local => {},
102 .system_lib => {},78 .system_lib => {},
103 .framework => {},79 .framework => {},
104 .git => try w.print(" step.dependOn(&GitExactStep.create(b, \"{s}\", \"{s}\").step);\n", .{ module.dep.?.path, try module.pin(alloc, cachepath, options) }),80 .git => try w.print(" dependOnGit(GitExactStep.create(b, \"{s}\", \"{s}\"), step, &@field(package_data, \"_{s}\"));\n", .{ module.dep.?.path, try module.pin(alloc, cachepath, options), module.short_id() }),
105 .hg => @panic("TODO"),81 .hg => @panic("TODO"),
106 .http => @panic("TODO"),82 .http => @panic("TODO"),
107 }83 }
...@@ -134,11 +110,16 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf...@@ -134,11 +110,16 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf
134 \\ inline for (comptime std.meta.declarations(package_data)) |decl| @field(package_data, decl.name).module_memo = null;110 \\ inline for (comptime std.meta.declarations(package_data)) |decl| @field(package_data, decl.name).module_memo = null;
135 \\}111 \\}
136 \\112 \\
113 \\pub fn dependOnGit(ge: GitExactStep, s: *std.Build.Step, p: *Package) void {
114 \\ s.dependOn(ge.step);
115 \\ p.path = ge.path;
116 \\}
117 \\
137 \\var link_lib_c = false;118 \\var link_lib_c = false;
138 \\pub const Package = struct {119 \\pub const Package = struct {
139 \\ name: string = "",120 \\ name: string = "",
140 \\ store: ?string = null,
141 \\ main: ?string = null,121 \\ main: ?string = null,
122 \\ path: ?std.Build.LazyPath = null,
142 \\ deps: []const *Package = &.{},123 \\ deps: []const *Package = &.{},
143 \\ c_include_dirs: []const string = &.{},124 \\ c_include_dirs: []const string = &.{},
144 \\ c_source_files: []const string = &.{},125 \\ c_source_files: []const string = &.{},
...@@ -168,8 +149,8 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf...@@ -168,8 +149,8 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf
168 \\ dummy_library.step.dependOn(fetch_step);149 \\ dummy_library.step.dependOn(fetch_step);
169 \\ var links: u32 = 0;150 \\ var links: u32 = 0;
170 \\ if (self.main) |m| {151 \\ if (self.main) |m| {
171 \\ if (self.store) |s| {152 \\ if (self.path) |p| {
172 \\ result.root_source_file = (std.Build.LazyPath{ .cwd_relative = b.cache_root.path.? }).path(b, "zigmod/deps").path(b, s[1..]).path(b, m);153 \\ result.root_source_file = p.path(b, m);
173 \\ } else {154 \\ } else {
174 \\ result.root_source_file = b.path(m);155 \\ result.root_source_file = b.path(m);
175 \\ }156 \\ }
...@@ -188,13 +169,13 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf...@@ -188,13 +169,13 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf
188 \\ }169 \\ }
189 \\ }170 \\ }
190 \\ for (self.c_include_dirs) |item| {171 \\ for (self.c_include_dirs) |item| {
191 \\ result.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) });172 \\ result.addIncludePath(self.path.?.path(b, item));
192 \\ dummy_library.root_module.addIncludePath(.{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) });173 \\ dummy_library.root_module.addIncludePath(self.path.?.path(b, item));
193 \\ link_lib_c = true;174 \\ link_lib_c = true;
194 \\ links += 1;175 \\ links += 1;
195 \\ }176 \\ }
196 \\ for (self.c_source_files) |item| {177 \\ for (self.c_source_files) |item| {
197 \\ dummy_library.root_module.addCSourceFile(.{ .file = .{ .cwd_relative = b.fmt("{s}/zigmod/deps{s}/{s}", .{ b.cache_root.path.?, self.store.?, item }) }, .flags = self.c_source_flags });178 \\ dummy_library.root_module.addCSourceFile(.{ .file = self.path.?.path(b, item), .flags = self.c_source_flags });
198 \\ links += 1;179 \\ links += 1;
199 \\ }180 \\ }
200 \\ for (self.system_libs) |item| {181 \\ for (self.system_libs) |item| {
...@@ -240,7 +221,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf...@@ -240,7 +221,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf
240 }221 }
241 try duped.append(mod);222 try duped.append(mod);
242 }223 }
243 try print_pkg_data_to(w, alloc, cachepath, &duped, &done, options);224 try print_pkg_data_to(w, &duped, &done);
244 try w.writeAll("};\n\n");225 try w.writeAll("};\n\n");
245226
246 try w.writeAll("pub const packages = ");227 try w.writeAll("pub const packages = ");
...@@ -281,7 +262,7 @@ fn print_deps(w: nfs.File, m: zigmod.Module) !void {...@@ -281,7 +262,7 @@ fn print_deps(w: nfs.File, m: zigmod.Module) !void {
281 try w.writeAll("}");262 try w.writeAll("}");
282}263}
283264
284fn print_pkg_data_to(w: nfs.File, alloc: std.mem.Allocator, cachepath: [:0]const u8, notdone: *std.array_list.Managed(zigmod.Module), done: *std.array_list.Managed(zigmod.Module), options: *common.CollectOptions) !void {265fn print_pkg_data_to(w: nfs.File, notdone: *std.array_list.Managed(zigmod.Module), done: *std.array_list.Managed(zigmod.Module)) !void {
285 var len: usize = notdone.items.len;266 var len: usize = notdone.items.len;
286 while (notdone.items.len > 0) {267 while (notdone.items.len > 0) {
287 for (notdone.items, 0..) |mod, i| {268 for (notdone.items, 0..) |mod, i| {
...@@ -292,14 +273,6 @@ fn print_pkg_data_to(w: nfs.File, alloc: std.mem.Allocator, cachepath: [:0]const...@@ -292,14 +273,6 @@ fn print_pkg_data_to(w: nfs.File, alloc: std.mem.Allocator, cachepath: [:0]const
292 , .{273 , .{
293 mod.short_id(),274 mod.short_id(),
294 });275 });
295 const fixed_path = if (std.mem.startsWith(u8, mod.clean_path, "v/")) mod.clean_path[2..std.mem.lastIndexOfScalar(u8, mod.clean_path, '/').?] else mod.clean_path;
296 switch (mod.type) {
297 .system_lib, .framework => {},
298 .local => {},
299 .git => try w.print(" .store = \"/{}/{s}\",\n", .{ u.altStringEscape(fixed_path), try mod.pin(alloc, cachepath, options) }),
300 .hg => @panic("TODO"),
301 .http => @panic("TODO"),
302 }
303 if (mod.main.len > 0 and !std.mem.eql(u8, &mod.id, &zigmod.Module.ROOT)) {276 if (mod.main.len > 0 and !std.mem.eql(u8, &mod.id, &zigmod.Module.ROOT)) {
304 try w.print(" .name = \"{s}\",\n", .{mod.name});277 try w.print(" .name = \"{s}\",\n", .{mod.name});
305 try w.print(" .main = \"{s}\",\n", .{mod.main});278 try w.print(" .main = \"{s}\",\n", .{mod.main});