Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve force-resolve behavior to accomodate zef depends ... #578

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Zef/CLI.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ package Zef::CLI {
!! (my $uri = uri($wanted) and !$uri.is-relative) ?? <uris>
!! abort("Don't understand identity: {$wanted}");
}
my $client = Zef::Client.new(:config($CONFIG), :$depends, :$test-depends, :$build-depends,);
my $client = Zef::Client.new(:config($CONFIG), :$depends, :$test-depends, :$build-depends, :force-resolve);

abort "The following were recognized as file paths but don't exist as such - {@paths.grep(!*.IO.e)}"
if [email protected](!*.IO.e);
Expand Down Expand Up @@ -711,7 +711,7 @@ package Zef::CLI {
Bool :$test-depends = True,
Bool :$build-depends = True,
) {
my $client = get-client(:config($CONFIG), :$depends, :$test-depends, :$build-depends);
my $client = get-client(:config($CONFIG), :$depends, :$test-depends, :$build-depends, :force-resolve);
.dist.identity.say for $client.list-rev-depends($identity);
exit 0;
}
Expand Down
36 changes: 28 additions & 8 deletions lib/Zef/Client.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -465,19 +465,39 @@ class Zef::Client {
message => "Failed to find dependencies: {@not-found.map(*.identity).join(', ')}",
});

$!force-resolve
?? $!logger.emit({
level => ERROR,
stage => RESOLVE,
phase => LIVE,
message => 'Failed to resolve missing dependencies, but continuing with --force-resolve',
if $!force-resolve {
$!logger.emit({
level => ERROR,
stage => RESOLVE,
phase => LIVE,
message => 'Failed to resolve missing dependencies, but continuing with --force-resolve',
});

# When using force-resolve we still want to treat the missing dependency as if it exists.
# This is intended to allow `zef depends XXX` to show dependencies for e.g. native dependencies
# where we don't have to worry about not finding their transitive dependencies.
@prereq-candidates.append(
@not-found.map({
Candidate.new(
as => $_.identity,
dist => Zef::Distribution.new(
name => $_.name,
auth => $_.auth-matcher,
ver => $_.version-matcher,
api => $_.api-matcher,
),
)
})
!! die X::Zef::UnsatisfiableDependency.new but role :: {
)
}
else {
die X::Zef::UnsatisfiableDependency.new but role :: {
method message {
X::Zef::UnsatisfiableDependency.message ~ qq| (use e.g. --exclude="{@not-found.head.name}" to skip)|;
}
};
};
}
}

@skip.append: @prereq-candidates.map(*.dist);
@specs = self.list-dependencies(@prereq-candidates);
Expand Down