You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/08/31 15:34:06 UTC

[7/8] git commit: Pass Binding::Perl object to bind_all

Pass Binding::Perl object to bind_all


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

Branch: refs/heads/documentation
Commit: a3062c1ca4307fc2629a79ea0ffd938b92debcd0
Parents: 898e6c1
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Aug 31 14:42:05 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun Aug 31 15:32:22 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a3062c1c/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 046fc0d..e7ca4e1 100644
--- a/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
+++ b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
@@ -221,6 +221,14 @@ sub _compile_clownfish {
     }
     $hierarchy->build;
 
+    my $binding = Clownfish::CFC::Binding::Perl->new(
+        hierarchy  => $hierarchy,
+        lib_dir    => $LIB_DIR,
+        boot_class => $self->module_name,
+        header     => $self->clownfish_params('autogen_header'),
+        footer     => '',
+    );
+
     # Process all Binding classes in buildlib.
     my $pm_filepaths = $self->rscan_dir( $BUILDLIB_DIR, qr/\.pm$/ );
     for my $pm_filepath (@$pm_filepaths) {
@@ -229,17 +237,9 @@ sub _compile_clownfish {
         my $package_name = $pm_filepath;
         $package_name =~ s/buildlib\/(.*)\.pm$/$1/;
         $package_name =~ s/\//::/g;
-        $package_name->bind_all($hierarchy);
+        $package_name->bind_all($hierarchy, $binding);
     }
 
-    my $binding = Clownfish::CFC::Binding::Perl->new(
-        hierarchy  => $hierarchy,
-        lib_dir    => $LIB_DIR,
-        boot_class => $self->module_name,
-        header     => $self->clownfish_params('autogen_header'),
-        footer     => '',
-    );
-
     return ( $hierarchy, $binding );
 }
 
@@ -601,7 +601,8 @@ Clownfish::CFC::Perl::Build defines the following build actions.
 Build the whole project. The C<code> action searches the C<buildlib>
 directory for .pm files whose path contains the string C<Binding>. For each
 module found, the class method C<bind_all> will be called with a
-L<Clownfish::CFC::Model::Hierarchy> object as argument. This method
+L<Clownfish::CFC::Model::Hierarchy> object and a
+L<Clownfish::CFC::Binding::Perl> object as arguments. This method
 should register all the L<Clownfish::CFC::Binding::Perl::Class> objects
 for which bindings should be generated.
 
@@ -610,7 +611,7 @@ For example, the file C<buildlib/My/Module/Binding.pm> could look like:
     package My::Module::Binding;
 
     sub bind_all {
-        my ($class, $hierarchy) = @_;
+        my ($class, $hierarchy, $perl_binding) = @_;
 
         my $binding = Clownfish::CFC::Binding::Perl::Class->new(
             parcel     => 'MyModule',