Skip to content

Commit

Permalink
Merge pull request #3792 from niner/master
Browse files Browse the repository at this point in the history
Give a hint about missing provides in a META6.json when module isn't …
  • Loading branch information
niner committed Sep 5, 2020
2 parents 49f3d43 + b2d625b commit 85847d2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/core.c/Exception.pm6
Expand Up @@ -3192,6 +3192,7 @@ my class X::Proc::Unsuccessful is Exception {
}

class CompUnit::DependencySpecification { ... }
class CompUnit::Repository::FileSystem { ... }
my class X::CompUnit::UnsatisfiedDependency is Exception {
has CompUnit::DependencySpecification $.specification;

Expand All @@ -3207,6 +3208,10 @@ my class X::CompUnit::UnsatisfiedDependency is Exception {
and not nqp::istype(nqp::how($ns{$last}), Metamodel::PackageHOW)
}

method !is-missing-from-meta-file() {
$*REPO.isa(CompUnit::Repository::FileSystem) and $*REPO.prefix.add("META6.json").e
}

method message() {
my $name = $.specification.short-name;
is-core($name)
Expand All @@ -3216,7 +3221,12 @@ my class X::CompUnit::UnsatisfiedDependency is Exception {
~ ($.specification ~~ / $<name>=.+ '::from' $ /
?? "\n\nIf you meant to use the :from adverb, use"
~ " a single colon for it: $<name>:from<...>\n"
!! ''
!! self!is-missing-from-meta-file
?? "\n\nPlease note that a 'META6.json' file was found in '$*REPO.prefix.relative()',"
~ " of which the 'provides' section was used to determine if a dependency is available"
~ " or not. Perhaps you need to add '$!specification' in the <provides> section of"
~ " that file? Or need to specify a directory that does *not* have a 'META6.json' file?"
!! ''
)
}
}
Expand Down

0 comments on commit 85847d2

Please sign in to comment.