Skip to content

Commit

Permalink
fix cachepath to be right when Deps define their own Deps
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Apr 26, 2023
1 parent 046eb90 commit ed5fdbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/common.zig
Expand Up @@ -243,7 +243,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: string, options: *CollectO
var dd = collect_deps(cachepath, moddir, d.type, options) catch |e| switch (e) {
error.ManifestNotFound => {
if (d.main.len > 0 or d.c_include_dirs.len > 0 or d.c_source_files.len > 0 or d.keep) {
var mod_from = try zigmod.Module.from(options.alloc, d.*, modpath, options);
var mod_from = try zigmod.Module.from(options.alloc, d.*, cachepath, options);
if (d.type != .local) mod_from.clean_path = extras.trimPrefix(modpath, cachepath)[1..];
if (mod_from.is_for_this()) return mod_from;
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/util/module.zig
Expand Up @@ -29,12 +29,12 @@ pub const Module = struct {
min_zig_version: ?std.SemanticVersion,
vcpkg: bool,

pub fn from(alloc: std.mem.Allocator, dep: zigmod.Dep, modpath: string, options: *common.CollectOptions) !Module {
pub fn from(alloc: std.mem.Allocator, dep: zigmod.Dep, cachepath: string, options: *common.CollectOptions) !Module {
var moddeps = std.ArrayList(Module).init(alloc);
errdefer moddeps.deinit();

for (dep.deps) |*d| {
if (try common.get_module_from_dep(d, modpath, options)) |founddep| {
if (try common.get_module_from_dep(d, cachepath, options)) |founddep| {
try moddeps.append(founddep);
}
}
Expand Down

0 comments on commit ed5fdbd

Please sign in to comment.