-
-
Save niner/92729569c472681316327abe9cea3d33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/CompUnit/Repository/FileSystem.pm6 b/src/core/CompUnit/Repository/FileSystem.pm6 | |
index 5e17734af..ce7748463 100644 | |
--- a/src/core/CompUnit/Repository/FileSystem.pm6 | |
+++ b/src/core/CompUnit/Repository/FileSystem.pm6 | |
@@ -3,6 +3,7 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C | |
has %!seen; # cache distribution lookup for self!matching-dist(...) | |
has $!precomp; | |
has $!id; | |
+ has $!distribution; | |
has $!precomp-stores; | |
has $!precomp-store; | |
@@ -211,31 +212,42 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C | |
method !distribution { | |
# Path contains a META6.json file, so only use paths/modules explicitly declared therein ( -I ./ ) | |
- my $dist = $!prefix.add('META6.json').f | |
- ?? Distribution::Path.new($!prefix) | |
- !! do { | |
- # Path does not contain a META6.json file so grep for files to be used to map to arbitrary module names later ( -I ./lib ) | |
- # This is considered a developmental mode of library inclusion -- technically a Distribution, but probably a poorly formed one. | |
- my &ls := { Rakudo::Internals.DIR-RECURSE($_).map({ .IO.relative(self!files-prefix).subst(:g, '\\', '/') }) }; | |
- Distribution::Hash.new(:prefix(self!files-prefix), %( | |
- name => ~$!prefix, # must make up a name when using -Ilib / use lib 'lib' | |
- ver => '*', | |
- api => '*', | |
- auth => '', | |
- files => (my %files = %( # files is a non-spec internal field used by CompUnit::Repository::Installation included to make cross CUR install easier | |
- &ls(self!files-prefix.child('bin').absolute).map({ $_ => $_ }).Slip, | |
- &ls(self!files-prefix.child('resources').absolute).map({ | |
- $_ ~~ m/^resources\/libraries\/(.*)/ | |
- ?? ('resources/libraries/' ~ ($0.IO.dirname eq '.'??''!!$0.IO.dirname~"/") ~ $0.IO.basename.subst(/^lib/, '').subst(/\..*/, '') => $_) | |
- !! ($_ => $_) | |
- }).Slip, | |
- )), | |
- resources => %files.keys.grep(*.starts-with('resources/')).map(*.substr(10)).List, # already grepped resources/ for %files, so reuse that information | |
- provides => &ls($!prefix.absolute).grep(*.ends-with(any(@extensions))).map({ $_.subst(:g, /\//, "::").subst(:g, /\:\:+/, '::').subst(/^.*?'::'/, '').subst(/\..*/, '') => $_ }).hash, | |
- )); | |
- }; | |
- | |
- return CompUnit::Repository::Distribution.new($dist); | |
+ $!distribution //= do { | |
+ my $dist = $!prefix.add('META6.json').f | |
+ ?? Distribution::Path.new($!prefix) | |
+ !! do { | |
+ # Path does not contain a META6.json file so grep for files to be used to map to arbitrary module names later ( -I ./lib ) | |
+ # This is considered a developmental mode of library inclusion -- technically a Distribution, but probably a poorly formed one. | |
+ my &ls := { Rakudo::Internals.DIR-RECURSE($_).map({ .IO.relative(self!files-prefix).subst(:g, '\\', '/') }) }; | |
+ Distribution::Hash.new(:prefix(self!files-prefix), %( | |
+ name => ~$!prefix, # must make up a name when using -Ilib / use lib 'lib' | |
+ ver => '*', | |
+ api => '*', | |
+ auth => '', | |
+ files => (my %files = %( # files is a non-spec internal field used by CompUnit::Repository::Installation included to make cross CUR install easier | |
+ &ls(self!files-prefix.child('bin').absolute).map({ $_ => $_ }).Slip, | |
+ &ls(self!files-prefix.child('resources').absolute).map({ | |
+ $_ ~~ m/^resources\/libraries\/(.*)/ | |
+ ?? ('resources/libraries/' ~ ($0.IO.dirname eq '.'??''!!$0.IO.dirname~"/") ~ $0.IO.basename.subst(/^lib/, '').subst(/\..*/, '') => $_) | |
+ !! ($_ => $_) | |
+ }).Slip, | |
+ )), | |
+ resources => %files.keys.grep(*.starts-with('resources/')).map(*.substr(10)).List, # already grepped resources/ for %files, so reuse that information | |
+ provides => &ls($!prefix.absolute) | |
+ .grep(*.ends-with(any(@extensions))) | |
+ .map({ | |
+ $_.subst(:g, /\//, "::") | |
+ .subst(:g, /\:\:+/, '::') | |
+ .subst(/^.*?'::'/, '') | |
+ .subst(/\..*/, '') | |
+ => $_ | |
+ }) | |
+ .hash, | |
+ )); | |
+ }; | |
+ | |
+ CompUnit::Repository::Distribution.new($dist); | |
+ } | |
} | |
method resource($dist-id, $key) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment