diff --git a/src/cmd/aquila/install.zig b/src/cmd/aquila/install.zig index b4f7687a7a070bc8171285a593169d3dc9d63da7..cd733b28416b0974c858f39c7c01b395d29affdf 100644 --- a/src/cmd/aquila/install.zig +++ b/src/cmd/aquila/install.zig @@ -4,6 +4,7 @@ const gpa = std.heap.c_allocator; const knownfolders = @import("known-folders"); +const zigmod = @import("../../lib.zig"); const u = @import("./../../util/index.zig"); const common = @import("./../../common.zig"); @@ -29,7 +30,7 @@ pub fn execute(args: [][]u8) !void { // get modfile and dep const m = try u.ModFile.from_dir(gpa, homedir); - var dep: u.Dep = undefined; + var dep: zigmod.Dep = undefined; for (m.devdeps) |d| { if (std.mem.eql(u8, d.path, pkgurl)) { dep = d; diff --git a/src/common.zig b/src/common.zig index 49a8ed35b744f9131990ebbbf01642d75181b4ce..75c7af1e6892846fcb73d31b4ad386ab0d0bd12c 100644 --- a/src/common.zig +++ b/src/common.zig @@ -94,7 +94,7 @@ pub fn collect_pkgs(mod: u.Module, list: *std.ArrayList(u.Module)) anyerror!void } } -pub fn get_modpath(cachepath: string, d: u.Dep, options: *CollectOptions) !string { +pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) !string { const p = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path() }); const pv = try std.fs.path.join(gpa, &.{ cachepath, try d.clean_path_v() }); @@ -198,7 +198,7 @@ pub fn get_modpath(cachepath: string, d: u.Dep, options: *CollectOptions) !strin } } -pub fn get_module_from_dep(d: *u.Dep, cachepath: string, options: *CollectOptions) anyerror!?u.Module { +pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: string, options: *CollectOptions) anyerror!?u.Module { if (options.lock) |lock| { for (lock) |item| { if (std.mem.eql(u8, item[0], try d.clean_path())) { @@ -326,7 +326,7 @@ pub fn add_files_package(pkg_name: string, mdir: std.fs.Dir, dirs: []const strin \\ ); - var d: u.Dep = .{ + var d: zigmod.Dep = .{ .type = .local, .path = "files", .id = "", @@ -367,7 +367,7 @@ pub fn parse_lockfile(dir: std.fs.Dir) ![]const [4]string { }, 2 => { var iter = std.mem.split(u8, line, " "); - const asdep = u.Dep{ + const asdep = zigmod.Dep{ .type = std.meta.stringToEnum(zigmod.DepType, iter.next().?).?, .path = iter.next().?, .version = iter.next().?, diff --git a/src/lib.zig b/src/lib.zig index 8e69617ac1490494d89e9e869138b10e2dcfbf51..437c6b0bb85cd129551969e53351dca82217d85d 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -24,3 +24,4 @@ pub fn deinit() void { } pub const DepType = @import("./util/dep_type.zig").DepType; +pub const Dep = @import("./util/dep.zig").Dep; diff --git a/src/util/dep.zig b/src/util/dep.zig index 55f6cef8859649f9f772446c48866c0bfd4e21e7..5a73900f6970d7a993e562920fab8737ca02975c 100644 --- a/src/util/dep.zig +++ b/src/util/dep.zig @@ -26,7 +26,7 @@ pub const Dep = struct { only_os: []const string = &.{}, except_os: []const string = &.{}, yaml: ?yaml.Mapping, - deps: []u.Dep, + deps: []zigmod.Dep, pub fn clean_path(self: Dep) !string { if (self.type == .local) { diff --git a/src/util/index.zig b/src/util/index.zig index 70437f722d607353288dd6b3f43a22b9d7425723..34ca244e2431d5726207b6f4b446cc4d56162723 100644 --- a/src/util/index.zig +++ b/src/util/index.zig @@ -1,4 +1,3 @@ usingnamespace @import("./funcs.zig"); -usingnamespace @import("./dep.zig"); usingnamespace @import("./modfile.zig"); usingnamespace @import("./module.zig"); diff --git a/src/util/modfile.zig b/src/util/modfile.zig index 7cacf4022770fe3af53a87c75ceccb9e933dfc33..7862a31a9ac99b3faa5ca910166e6d44ab025cc9 100644 --- a/src/util/modfile.zig +++ b/src/util/modfile.zig @@ -21,9 +21,9 @@ pub const ModFile = struct { c_include_dirs: []const string, c_source_flags: []const string, c_source_files: []const string, - deps: []u.Dep, + deps: []zigmod.Dep, yaml: yaml.Mapping, - devdeps: []u.Dep, + devdeps: []zigmod.Dep, root_files: []const string, files: []const string, @@ -67,8 +67,8 @@ pub const ModFile = struct { }; } - fn dep_list_by_name(alloc: *std.mem.Allocator, mapping: yaml.Mapping, prop: string) anyerror![]u.Dep { - var dep_list = std.ArrayList(u.Dep).init(alloc); + fn dep_list_by_name(alloc: *std.mem.Allocator, mapping: yaml.Mapping, prop: string) anyerror![]zigmod.Dep { + var dep_list = std.ArrayList(zigmod.Dep).init(alloc); if (mapping.get(prop)) |dep_seq| { if (dep_seq == .sequence) { for (dep_seq.sequence) |item| { @@ -107,7 +107,7 @@ pub const ModFile = struct { } } - try dep_list.append(u.Dep{ + try dep_list.append(zigmod.Dep{ .type = dep_type, .path = path, .id = item.mapping.get_string("id"), diff --git a/src/util/module.zig b/src/util/module.zig index 8a48892bfaade01aa4a44cefca5d5875fd1f4926..a1571a36225f7119cf23c88440188e9cc36fa20b 100644 --- a/src/util/module.zig +++ b/src/util/module.zig @@ -3,6 +3,7 @@ const string = []const u8; const gpa = std.heap.c_allocator; const builtin = @import("builtin"); +const zigmod = @import("../lib.zig"); const u = @import("index.zig"); const yaml = @import("./yaml.zig"); const common = @import("./../common.zig"); @@ -23,9 +24,9 @@ pub const Module = struct { yaml: ?yaml.Mapping, deps: []Module, clean_path: string, - dep: ?u.Dep, + dep: ?zigmod.Dep, - pub fn from(dep: u.Dep, dir: string, options: *common.CollectOptions) !Module { + pub fn from(dep: zigmod.Dep, dir: string, options: *common.CollectOptions) !Module { var moddeps = std.ArrayList(Module).init(gpa); defer moddeps.deinit(); for (dep.deps) |*d| {