diff --git a/deps.zig b/deps.zig index 64461523beaebc7b6821f6a73b3fe2466f4cc90d..22929503c75468e86640d573d26f9523fc5b7495 100644 --- a/deps.zig +++ b/deps.zig @@ -51,11 +51,6 @@ pub const GitExactStep = struct { pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step { const b = exe.step.owner; const step = b.step("fetch", ""); - inline for (comptime std.meta.declarations(package_data)) |decl| { - const path = &@field(package_data, decl.name).entry; - const root = if (@field(package_data, decl.name).store) |_| b.cache_root.path.? else "."; - if (path.* != null) path.* = b.fmt("{s}/zigmod/deps{s}", .{ root, path.*.? }); - } step.dependOn(&GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "9f15c276b4e9d05afd34a10d8662a7dfc34647ea").step); step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "d2465c64833590a04bd9b7f50c87363fd03e65bf").step); step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "bebb39ae30d9848a1c212cee582d0b1c102d8b87").step); @@ -111,7 +106,6 @@ pub fn addAllTo(exe: *std.Build.Step.Compile) void { var link_lib_c = false; pub const Package = struct { name: string = "", - entry: ?string = null, store: ?string = null, main: ?string = null, deps: []const *Package = &.{}, @@ -142,8 +136,12 @@ pub const Package = struct { }); dummy_library.step.dependOn(fetch_step); var links: u32 = 0; - if (self.entry) |capture| { - result.root_source_file = .{ .cwd_relative = capture }; + if (self.main) |m| { + if (self.store) |s| { + result.root_source_file = (std.Build.LazyPath{ .cwd_relative = b.cache_root.path.? }).path(b, "zigmod/deps").path(b, s[1..]).path(b, m); + } else { + result.root_source_file = b.path(m); + } } for (self.deps) |item| { const module_dep = item.module(exe, fetch_step); @@ -199,142 +197,120 @@ pub const package_data = struct { pub var _o6ogpor87xc2 = Package{ .store = "/git/github.com/marlersoft/zigwin32/9f15c276b4e9d05afd34a10d8662a7dfc34647ea", .name = "win32", - .entry = "/git/github.com/marlersoft/zigwin32/9f15c276b4e9d05afd34a10d8662a7dfc34647ea/win32.zig", .main = "win32.zig", }; pub var _u7sysdckdymi = Package{ .store = "/git/github.com/nektro/arqv-ini/d2465c64833590a04bd9b7f50c87363fd03e65bf", .name = "ini", - .entry = "/git/github.com/nektro/arqv-ini/d2465c64833590a04bd9b7f50c87363fd03e65bf/src/ini.zig", .main = "src/ini.zig", }; pub var _s84v9o48ucb0 = Package{ .store = "/git/github.com/nektro/zig-ansi/bebb39ae30d9848a1c212cee582d0b1c102d8b87", .name = "ansi", - .entry = "/git/github.com/nektro/zig-ansi/bebb39ae30d9848a1c212cee582d0b1c102d8b87/src/lib.zig", .main = "src/lib.zig", }; pub var _f7dubzb7cyqe = Package{ .store = "/git/github.com/nektro/zig-extras/8f6c4761e5c22c6a5c83a032e764154b840275bc", .name = "extras", - .entry = "/git/github.com/nektro/zig-extras/8f6c4761e5c22c6a5c83a032e764154b840275bc/src/lib.zig", .main = "src/lib.zig", }; pub var _c1xirp1ota5p = Package{ .store = "/git/github.com/nektro/zig-inquirer/e745b018f87ddc4c8958370332e6cf61625403cc", .name = "inquirer", - .entry = "/git/github.com/nektro/zig-inquirer/e745b018f87ddc4c8958370332e6cf61625403cc/src/lib.zig", .main = "src/lib.zig", .deps = &[_]*Package{ &_s84v9o48ucb0 }, }; pub var _96h80ezrvj7i = Package{ .store = "/git/github.com/nektro/zig-leven/014971d4b1e327a5c61322c3a6b9369fd1863864", .name = "leven", - .entry = "/git/github.com/nektro/zig-leven/014971d4b1e327a5c61322c3a6b9369fd1863864/src/lib.zig", .main = "src/lib.zig", }; pub var _0npcrzfdlrvk = Package{ .store = "/git/github.com/nektro/zig-licenses/bc1cd51625c13d6c7df819fd0d85968e617f5c57", .name = "licenses", - .entry = "/git/github.com/nektro/zig-licenses/bc1cd51625c13d6c7df819fd0d85968e617f5c57/src/lib.zig", .main = "src/lib.zig", }; pub var _pt88y5d80m25 = Package{ .store = "/git/github.com/nektro/zig-licenses-text/a9d067c3c4d6c226a1de5531b66785bc15d869ee", .name = "licenses-text", - .entry = "/git/github.com/nektro/zig-licenses-text/a9d067c3c4d6c226a1de5531b66785bc15d869ee/src/lib.zig", .main = "src/lib.zig", }; pub var _73bukkeci2u6 = Package{ .store = "/git/github.com/nektro/zig-sys-darwin/b349aa32b55aae4cf2ae56740003f8aff0394920", .name = "sys-darwin", - .entry = "/git/github.com/nektro/zig-sys-darwin/b349aa32b55aae4cf2ae56740003f8aff0394920/sys_darwin.zig", .main = "sys_darwin.zig", }; pub var _qfev2g50alvp = Package{ .store = "/git/github.com/nektro/zig-sys-freebsd/f97e6c2de30af76818572490735c84ce1015958b", .name = "sys-freebsd", - .entry = "/git/github.com/nektro/zig-sys-freebsd/f97e6c2de30af76818572490735c84ce1015958b/freebsd.zig", .main = "freebsd.zig", }; pub var _h7tv7ayhffak = Package{ .store = "/git/github.com/nektro/zig-sys-linux/6dabe7cce239d882c8fd132ab5cda1d1f9ff3634", .name = "sys-linux", - .entry = "/git/github.com/nektro/zig-sys-linux/6dabe7cce239d882c8fd132ab5cda1d1f9ff3634/mod.zig", .main = "mod.zig", }; pub var _uvkgl6xf1azv = Package{ .store = "/git/github.com/nektro/zig-sys-netbsd/5ad432ca421c59099be3630b9d0dda49e8bef0a7", .name = "sys-netbsd", - .entry = "/git/github.com/nektro/zig-sys-netbsd/5ad432ca421c59099be3630b9d0dda49e8bef0a7/netbsd.zig", .main = "netbsd.zig", }; pub var _4rmxgmcykiba = Package{ .store = "/git/github.com/nektro/zig-sys-openbsd/164646a5e7c4129eb92ac524a60f1759605c99df", .name = "sys-openbsd", - .entry = "/git/github.com/nektro/zig-sys-openbsd/164646a5e7c4129eb92ac524a60f1759605c99df/openbsd.zig", .main = "openbsd.zig", }; pub var _kscsl0145t7x = Package{ .store = "/git/github.com/nektro/zig-nio/17c4f044b15917efc1d3f018765881d53fa27e48", .name = "nio", - .entry = "/git/github.com/nektro/zig-nio/17c4f044b15917efc1d3f018765881d53fa27e48/nio.zig", .main = "nio.zig", .deps = &[_]*Package{ &_h7tv7ayhffak, &_f7dubzb7cyqe, &_73bukkeci2u6, &_qfev2g50alvp, &_uvkgl6xf1azv, &_4rmxgmcykiba }, }; pub var _7l3oxw6nqqws = Package{ .store = "/git/github.com/nektro/zig-intrusive-parser/800cbe5b241fc52370cb8f892f0d9c6f97133725", .name = "intrusive-parser", - .entry = "/git/github.com/nektro/zig-intrusive-parser/800cbe5b241fc52370cb8f892f0d9c6f97133725/intrusive_parser.zig", .main = "intrusive_parser.zig", .deps = &[_]*Package{ &_f7dubzb7cyqe, &_kscsl0145t7x }, }; pub var _iecwp4b3bsfm = Package{ .store = "/git/github.com/nektro/zig-time/1349fb2c8aaaa1503e8730facea6f87c5fe75dc0", .name = "time", - .entry = "/git/github.com/nektro/zig-time/1349fb2c8aaaa1503e8730facea6f87c5fe75dc0/time.zig", .main = "time.zig", .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_73bukkeci2u6, &_kscsl0145t7x, &_qfev2g50alvp, &_uvkgl6xf1azv, &_4rmxgmcykiba }, }; pub var _vph9l0hxpeze = Package{ .store = "/git/github.com/nektro/zig-nfs/1a27fe574706f0b91c9f66b22fe7d3fa8f5129d5", .name = "nfs", - .entry = "/git/github.com/nektro/zig-nfs/1a27fe574706f0b91c9f66b22fe7d3fa8f5129d5/nfs.zig", .main = "nfs.zig", .deps = &[_]*Package{ &_h7tv7ayhffak, &_kscsl0145t7x, &_iecwp4b3bsfm, &_73bukkeci2u6, &_qfev2g50alvp, &_uvkgl6xf1azv, &_4rmxgmcykiba }, }; pub var _2ovav391ivak = Package{ .store = "/git/github.com/nektro/zig-detect-license/6de79b4ff8f7462e26f224f4bed3c81710c8893b", .name = "detect-license", - .entry = "/git/github.com/nektro/zig-detect-license/6de79b4ff8f7462e26f224f4bed3c81710c8893b/src/lib.zig", .main = "src/lib.zig", .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i, &_vph9l0hxpeze }, }; pub var _ede2wygpe1iy = Package{ .store = "/git/github.com/nektro/zig-tracer/4ad0602d52a3f40ef74f59f648602c61409f7ba7", .name = "tracer", - .entry = "/git/github.com/nektro/zig-tracer/4ad0602d52a3f40ef74f59f648602c61409f7ba7/src/mod.zig", .main = "src/mod.zig", .deps = &[_]*Package{ &_f7dubzb7cyqe, &_h7tv7ayhffak, &_vph9l0hxpeze, &_kscsl0145t7x, &_iecwp4b3bsfm }, }; pub var _0k64oe2nuzvj = Package{ .store = "/git/github.com/nektro/zig-git/88b94a1960be841bb93a0bca65d556cb6385d1fd", .name = "git", - .entry = "/git/github.com/nektro/zig-git/88b94a1960be841bb93a0bca65d556cb6385d1fd/git.zig", .main = "git.zig", .deps = &[_]*Package{ &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_ede2wygpe1iy, &_vph9l0hxpeze, &_kscsl0145t7x, &_0e2d06bb494b }, }; pub var _ocmr9rtohgcc = Package{ .store = "/git/github.com/nektro/zig-json/a731b57ee685ff1ddeea9456a924f45ce4da3031", .name = "json", - .entry = "/git/github.com/nektro/zig-json/a731b57ee685ff1ddeea9456a924f45ce4da3031/json.zig", .main = "json.zig", .deps = &[_]*Package{ &_f7dubzb7cyqe, &_ede2wygpe1iy, &_7l3oxw6nqqws, &_kscsl0145t7x }, }; pub var _g982zq6e8wsv = Package{ .store = "/git/github.com/nektro/zig-yaml/dff9fd43ebf1046c70090bdccfeb2e4f1c0d584b", .name = "yaml", - .entry = "/git/github.com/nektro/zig-yaml/dff9fd43ebf1046c70090bdccfeb2e4f1c0d584b/yaml.zig", .main = "yaml.zig", .deps = &[_]*Package{ &_8mdbh0zuneb0 }, }; @@ -353,12 +329,10 @@ pub const package_data = struct { pub var _2ta738wrqbaq = Package{ .store = "/git/github.com/ziglibs/known-folders/207c34a16e4365edc20d92c7892f962b3bed46e8", .name = "known-folders", - .entry = "/git/github.com/ziglibs/known-folders/207c34a16e4365edc20d92c7892f962b3bed46e8/known-folders.zig", .main = "known-folders.zig", }; pub var _89ujp8gq842x = Package{ .name = "zigmod", - .entry = "/../..//src/lib.zig", .main = "src/lib.zig", .deps = &[_]*Package{ &_g982zq6e8wsv, &_s84v9o48ucb0, &_2ta738wrqbaq, &_0npcrzfdlrvk, &_2ovav391ivak, &_c1xirp1ota5p, &_u7sysdckdymi, &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_0k64oe2nuzvj, &_ocmr9rtohgcc, &_kscsl0145t7x, &_vph9l0hxpeze }, }; diff --git a/src/cmd/generate.zig b/src/cmd/generate.zig index 4121a1b6d54a6bb2f2230618a8854b5f1fd35bef..8337114fa31096846de61d48d0317b82fc1e5c45 100644 --- a/src/cmd/generate.zig +++ b/src/cmd/generate.zig @@ -94,11 +94,6 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf \\pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step { \\ const b = exe.step.owner; \\ const step = b.step("fetch", ""); - \\ inline for (comptime std.meta.declarations(package_data)) |decl| { - \\ const path = &@field(package_data, decl.name).entry; - \\ const root = if (@field(package_data, decl.name).store) |_| b.cache_root.path.? else "."; - \\ if (path.* != null) path.* = b.fmt("{s}/zigmod/deps{s}", .{ root, path.*.? }); - \\ } \\ ); for (list) |module| { @@ -142,7 +137,6 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf \\var link_lib_c = false; \\pub const Package = struct { \\ name: string = "", - \\ entry: ?string = null, \\ store: ?string = null, \\ main: ?string = null, \\ deps: []const *Package = &.{}, @@ -173,8 +167,12 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: [:0]const u8, dir: nf \\ }); \\ dummy_library.step.dependOn(fetch_step); \\ var links: u32 = 0; - \\ if (self.entry) |capture| { - \\ result.root_source_file = .{ .cwd_relative = capture }; + \\ if (self.main) |m| { + \\ if (self.store) |s| { + \\ result.root_source_file = (std.Build.LazyPath{ .cwd_relative = b.cache_root.path.? }).path(b, "zigmod/deps").path(b, s[1..]).path(b, m); + \\ } else { + \\ result.root_source_file = b.path(m); + \\ } \\ } \\ for (self.deps) |item| { \\ const module_dep = item.module(exe, fetch_step); @@ -304,7 +302,6 @@ fn print_pkg_data_to(w: nfs.File, alloc: std.mem.Allocator, cachepath: [:0]const } if (mod.main.len > 0 and !std.mem.eql(u8, &mod.id, &zigmod.Module.ROOT)) { try w.print(" .name = \"{s}\",\n", .{mod.name}); - try w.print(" .entry = \"/{}/{s}/{s}\",\n", .{ u.altStringEscape(fixed_path), try mod.pin(alloc, cachepath, options), mod.main }); try w.print(" .main = \"{s}\",\n", .{mod.main}); if (mod.deps.len != 0) {