authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-20 21:41:06 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-20 21:41:06 -07:00
log090a4e57e0f600139fdf7aa7971ece3ac00cb4b3
treef6eab6bc80f5b6d96f33bab0f35cb35298e1f1a7
parenta0f1d58a2b0f9cbe04288c5550e078ca57b98708

rework lockfile parsing to accept a Dir instead of a path


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

src/cmd/ci.zig+2-1
......@@ -10,12 +10,13 @@ const common = @import("./../common.zig");
1010pub fn execute(args: [][]u8) !void {
1111 _ = args;
1212
13 const dir = std.fs.cwd();
1314 const cachepath = try std.fs.path.join(gpa, &.{ ".zigmod", "deps" });
1415
1516 var options = common.CollectOptions{
1617 .log = true,
1718 .update = false,
18 .lock = try common.parse_lockfile("zigmod.lock"),
19 .lock = try common.parse_lockfile(dir),
1920 };
2021 const top_module = try common.collect_deps_deep(cachepath, "zig.mod", &options);
2122
src/common.zig+2-2
......@@ -335,10 +335,10 @@ pub fn add_files_package(pkg_name: []const u8, dirs: []const []const u8, parent_
335335 return (try get_module_from_dep(&d, destination, parent_name, &options)).?;
336336}
337337
338pub fn parse_lockfile(path: []const u8) ![]const [4][]const u8 {
338pub fn parse_lockfile(dir: std.fs.Dir) ![]const [4][]const u8 {
339339 var list = std.ArrayList([4][]const u8).init(gpa);
340340 const max = std.math.maxInt(usize);
341 const f = try std.fs.cwd().openFile(path, .{});
341 const f = try dir.openFile("zigmod.lock", .{});
342342 const r = f.reader();
343343 var i: usize = 0;
344344 var v: usize = 1;