authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-28 02:41:32 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-28 02:41:32 -07:00
log70ce68b8e7b7f00821d74b4f559ef80bfacdaed4
tree84f39370dc9d8d24c6c7af3f26223d25352322ab
parent791f4831c20376be1511bef09eb018533a3cdcbf

move ModFile to lib entry point


6 files changed, 8 insertions(+), 6 deletions(-)

src/cmd/aquila/add.zig+2-1
...@@ -2,6 +2,7 @@ const std = @import("std");...@@ -2,6 +2,7 @@ const std = @import("std");
2const string = []const u8;2const string = []const u8;
3const gpa = std.heap.c_allocator;3const gpa = std.heap.c_allocator;
44
5const zigmod = @import("../../lib.zig");
5const u = @import("./../../util/index.zig");6const u = @import("./../../util/index.zig");
6const aq = @import("./../aq.zig");7const aq = @import("./../aq.zig");
78
...@@ -23,7 +24,7 @@ pub fn do(dir: std.fs.Dir, pkg_id: string) !string {...@@ -23,7 +24,7 @@ pub fn do(dir: std.fs.Dir, pkg_id: string) !string {
23 val.getT(.{ "pkg", "RemoteName" }, .String).?,24 val.getT(.{ "pkg", "RemoteName" }, .String).?,
24 });25 });
2526
26 const m = try u.ModFile.from_dir(gpa, dir);27 const m = try zigmod.ModFile.from_dir(gpa, dir);
27 for (m.devdeps) |d| {28 for (m.devdeps) |d| {
28 if (std.mem.eql(u8, d.path, pkg_url)) {29 if (std.mem.eql(u8, d.path, pkg_url)) {
29 return pkg_url;30 return pkg_url;
src/cmd/aquila/install.zig+1-1
...@@ -29,7 +29,7 @@ pub fn execute(args: [][]u8) !void {...@@ -29,7 +29,7 @@ pub fn execute(args: [][]u8) !void {
29 };29 };
3030
31 // get modfile and dep31 // get modfile and dep
32 const m = try u.ModFile.from_dir(gpa, homedir);32 const m = try zigmod.ModFile.from_dir(gpa, homedir);
33 var dep: zigmod.Dep = undefined;33 var dep: zigmod.Dep = undefined;
34 for (m.devdeps) |d| {34 for (m.devdeps) |d| {
35 if (std.mem.eql(u8, d.path, pkgurl)) {35 if (std.mem.eql(u8, d.path, pkgurl)) {
src/cmd/zpm/add.zig+2-1
...@@ -3,6 +3,7 @@ const gpa = std.heap.c_allocator;...@@ -3,6 +3,7 @@ const gpa = std.heap.c_allocator;
33
4const zfetch = @import("zfetch");4const zfetch = @import("zfetch");
55
6const zigmod = @import("../../lib.zig");
6const u = @import("./../../util/index.zig");7const u = @import("./../../util/index.zig");
7const zpm = @import("./../zpm.zig");8const zpm = @import("./../zpm.zig");
89
...@@ -33,7 +34,7 @@ pub fn execute(args: [][]u8) !void {...@@ -33,7 +34,7 @@ pub fn execute(args: [][]u8) !void {
3334
34 u.assert(found.root_file != null, "package must have an entry point to be able to be added to your dependencies", .{});35 u.assert(found.root_file != null, "package must have an entry point to be able to be added to your dependencies", .{});
3536
36 const self_module = try u.ModFile.init(gpa, "zig.mod");37 const self_module = try zigmod.ModFile.init(gpa, "zig.mod");
37 for (self_module.deps) |dep| {38 for (self_module.deps) |dep| {
38 if (std.mem.eql(u8, dep.name, found.name)) {39 if (std.mem.eql(u8, dep.name, found.name)) {
39 std.log.warn("dependency with name '{s}' already exists in your dependencies", .{found.name});40 std.log.warn("dependency with name '{s}' already exists in your dependencies", .{found.name});
src/common.zig+2-2
...@@ -30,7 +30,7 @@ pub const CollectOptions = struct {...@@ -30,7 +30,7 @@ pub const CollectOptions = struct {
30};30};
3131
32pub fn collect_deps_deep(cachepath: string, mdir: std.fs.Dir, options: *CollectOptions) !u.Module {32pub fn collect_deps_deep(cachepath: string, mdir: std.fs.Dir, options: *CollectOptions) !u.Module {
33 const m = try u.ModFile.from_dir(gpa, mdir);33 const m = try zigmod.ModFile.from_dir(gpa, mdir);
34 try options.init();34 try options.init();
35 var moduledeps = std.ArrayList(u.Module).init(gpa);35 var moduledeps = std.ArrayList(u.Module).init(gpa);
36 defer moduledeps.deinit();36 defer moduledeps.deinit();
...@@ -57,7 +57,7 @@ pub fn collect_deps_deep(cachepath: string, mdir: std.fs.Dir, options: *CollectO...@@ -57,7 +57,7 @@ pub fn collect_deps_deep(cachepath: string, mdir: std.fs.Dir, options: *CollectO
57}57}
5858
59pub fn collect_deps(cachepath: string, mdir: std.fs.Dir, options: *CollectOptions) anyerror!u.Module {59pub fn collect_deps(cachepath: string, mdir: std.fs.Dir, options: *CollectOptions) anyerror!u.Module {
60 const m = try u.ModFile.from_dir(gpa, mdir);60 const m = try zigmod.ModFile.from_dir(gpa, mdir);
61 var moduledeps = std.ArrayList(u.Module).init(gpa);61 var moduledeps = std.ArrayList(u.Module).init(gpa);
62 defer moduledeps.deinit();62 defer moduledeps.deinit();
63 if (m.files.len > 0) {63 if (m.files.len > 0) {
src/lib.zig+1
...@@ -25,3 +25,4 @@ pub fn deinit() void {...@@ -25,3 +25,4 @@ pub fn deinit() void {
2525
26pub const DepType = @import("./util/dep_type.zig").DepType;26pub const DepType = @import("./util/dep_type.zig").DepType;
27pub const Dep = @import("./util/dep.zig").Dep;27pub const Dep = @import("./util/dep.zig").Dep;
28pub const ModFile = @import("./util/modfile.zig").ModFile;
src/util/index.zig-1
...@@ -1,3 +1,2 @@...@@ -1,3 +1,2 @@
1usingnamespace @import("./funcs.zig");1usingnamespace @import("./funcs.zig");
2usingnamespace @import("./modfile.zig");
3usingnamespace @import("./module.zig");2usingnamespace @import("./module.zig");