Skip to content

Commit

Permalink
Add CompUnit.api attribute and add usage where applicable
Browse files Browse the repository at this point in the history
It appears to have been missed before.
  • Loading branch information
lizmat committed Apr 17, 2022
1 parent 64328d4 commit f4fe38b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/core.c/CompUnit.pm6
Expand Up @@ -5,6 +5,7 @@ class CompUnit {
has Str:D $.short-name is built(:bind) is required;
has Version $.version is built(:bind);
has Str $.auth is built(:bind);
has Version $.api is built(:bind);

# The CompUnit::Repository that loaded this CompUnit.
has CompUnit::Repository:D $.repo is built(:bind) is required;
Expand Down Expand Up @@ -32,6 +33,7 @@ class CompUnit {
nqp::list_s($!from,$!short-name,$!repo-id,$!precompiled.Str);
nqp::push_s($parts,$!version.Str) if $!version;
nqp::push_s($parts,$!auth) if $!auth;
nqp::push_s($parts,$!api.Str) if $!api;
nqp::push_s($parts,$!distribution
?? CompUnit::Repository::Distribution.new(
$!distribution,
Expand Down
15 changes: 9 additions & 6 deletions src/core.c/CompUnit/Repository/Installation.pm6
Expand Up @@ -547,16 +547,17 @@ sub MAIN(:$name, :$auth, :$ver, *@, *%) {
}

method resolve(CompUnit::DependencySpecification:D $spec --> CompUnit:D) {
with self!matching-dist($spec) {
my %meta := .meta;
if self!matching-dist($spec) -> $distribution {
my %meta := $distribution.meta;
CompUnit.new(
:handle(CompUnit::Handle),
:short-name($spec.short-name),
:version(%meta<ver>),
:auth(%meta<auth> // Str),
:auth(%meta<auth>),
:api(%meta<api>),
:repo(self),
:repo-id(%meta<source>),
:distribution($_),
:$distribution,
)
}
elsif self.next-repo -> $next-repo {
Expand Down Expand Up @@ -635,7 +636,8 @@ sub MAIN(:$name, :$auth, :$ver, *@, *%) {
:$handle,
:short-name($spec.short-name),
:version(%meta<ver>),
:auth(%meta<auth> // Str),
:auth(%meta<auth>),
:api(%meta<api>),
:repo(self),
:$repo-id,
:precompiled,
Expand All @@ -651,7 +653,8 @@ sub MAIN(:$name, :$auth, :$ver, *@, *%) {
:$handle,
:short-name($spec.short-name),
:version(%meta<ver>),
:auth(%meta<auth> // Str),
:auth(%meta<auth>),
:api(%meta<api>),
:repo(self),
:$repo-id,
:$distribution,
Expand Down

0 comments on commit f4fe38b

Please sign in to comment.