Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix CURF's resolve generating the wrong repo-id
Instead of a SHA1 like those generated when creating a precomp file
as result of a .need, we got the source file's path as repo-id.
Therefore the equality check always failed causing unnecessary recompiles.

Fixed by using the same code for generating the id in both methods.
  • Loading branch information
niner committed Jul 24, 2016
1 parent f1f750d commit 43debec
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/CompUnit/Repository/FileSystem.pm
Expand Up @@ -53,11 +53,16 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
False
}

method !comp-unit-id($name) {
nqp::sha1($name ~ $*REPO.id);
}

method resolve(CompUnit::DependencySpecification $spec) returns CompUnit {
my ($base, $file) = self!matching-file($spec);

return CompUnit.new(
:short-name($spec.short-name),
:repo-id($file.Str),
:repo-id(self!comp-unit-id($spec.short-name)),
:repo(self)
) if $base;
return self.next-repo.resolve($spec) if self.next-repo;
Expand All @@ -77,7 +82,7 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
return %!loaded{$name} if %!loaded{$name}:exists;
return %seen{$base} if %seen{$base}:exists;

my $id = nqp::sha1($name ~ $*REPO.id);
my $id = self!comp-unit-id($name);
my $*RESOURCES = Distribution::Resources.new(:repo(self), :dist-id(''));
my $handle = $precomp.try-load(
CompUnit::PrecompilationDependency::File.new(
Expand Down

0 comments on commit 43debec

Please sign in to comment.