Repository: lucy-clownfish
Updated Branches:
  refs/heads/master bb48393df -> 8b83e41b8


Make it possible to run _compile_clownfish twice

ACTION_compile_custom_xs will need some information about parcels. So
it has to build the hierarchy if ACTION_clownfish hasn't been run yet.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/0c09e83b
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/0c09e83b
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/0c09e83b

Branch: refs/heads/master
Commit: 0c09e83b2fdfdd10084f48bbe6b2e79509d29e26
Parents: bb48393
Author: Nick Wellnhofer <[email protected]>
Authored: Mon Jun 20 13:23:48 2016 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Mon Jun 20 13:23:48 2016 +0200

----------------------------------------------------------------------
 compiler/perl/lib/Clownfish/CFC/Perl/Build.pm | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0c09e83b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm 
b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
index ba83277..6095dc1 100644
--- a/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
+++ b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
@@ -217,6 +217,8 @@ sub ACTION_copy_clownfish_includes {
     }
 }
 
+my %hierarchy_cache;
+
 sub _compile_clownfish {
     my $self = shift;
 
@@ -224,6 +226,9 @@ sub _compile_clownfish {
     require Clownfish::CFC::Binding::Perl;
     require Clownfish::CFC::Binding::Perl::Class;
 
+    return @hierarchy_cache{ qw( hierarchy binding ) }
+        if %hierarchy_cache;
+
     # Compile Clownfish.
     my $hierarchy = Clownfish::CFC::Model::Hierarchy->new(
         dest => $AUTOGEN_DIR,
@@ -256,6 +261,8 @@ sub _compile_clownfish {
         footer     => '',
     );
 
+    @hierarchy_cache{ qw( hierarchy binding ) } = ( $hierarchy, $binding );
+
     return ( $hierarchy, $binding );
 }
 

Reply via email to