Repository: lucy-clownfish
Updated Branches:
  refs/heads/master fdab168f2 -> 92da85972


Use hierarchy log file for Perl build

Make the Perl build write the hierarchy log file and use its timestamp
instead of the autogen directory's mtime. This prepares the Perl build
to use the Makefile generated by charmonizer.


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

Branch: refs/heads/master
Commit: f01e606705a4134f5d4d70aa5a618a6dc300e0c9
Parents: fdab168
Author: Nick Wellnhofer <[email protected]>
Authored: Mon May 30 14:13:12 2016 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Mon May 30 14:13:12 2016 +0200

----------------------------------------------------------------------
 compiler/perl/lib/Clownfish/CFC.xs            |  6 +++++
 compiler/perl/lib/Clownfish/CFC/Perl/Build.pm | 26 +++++++++-------------
 2 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f01e6067/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.xs 
b/compiler/perl/lib/Clownfish/CFC.xs
index a3e39db..a4e58e9 100644
--- a/compiler/perl/lib/Clownfish/CFC.xs
+++ b/compiler/perl/lib/Clownfish/CFC.xs
@@ -748,6 +748,12 @@ CODE:
 OUTPUT: RETVAL
 
 void
+write_log(self)
+    CFCHierarchy *self;
+PPCODE:
+    CFCHierarchy_write_log(self);
+
+void
 _set_or_get(self, ...)
     CFCHierarchy *self;
 ALIAS:

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f01e6067/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 1aa1f4e..d0b1d07 100644
--- a/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
+++ b/compiler/perl/lib/Clownfish/CFC/Perl/Build.pm
@@ -286,13 +286,13 @@ sub ACTION_clownfish {
 
     my $buildlib_pm_filepaths = $self->rscan_dir( $BUILDLIB_DIR, qr/\.pm$/ );
     my $cfh_filepaths = $self->_cfh_filepaths;
+    my $log_filepath = catfile( $AUTOGEN_DIR, 'hierarchy.json' );
 
-    # XXX joes thinks this is dubious
     # Don't bother parsing Clownfish files if everything's up to date.
     return
         if $self->up_to_date(
         [ @$cfh_filepaths, @$buildlib_pm_filepaths ],
-        [ $xs_filepath,    $AUTOGEN_DIR, ]
+        [ $xs_filepath,    $log_filepath, ]
         );
 
     # Write out all autogenerated files.
@@ -305,8 +305,8 @@ sub ACTION_clownfish {
         footer    => '',
     );
     print "Writing Clownfish autogenerated files...\n";
-    my $modified = $core_binding->write_all_modified;
-    if ($modified) {
+    my $cfh_modified = $core_binding->write_all_modified;
+    if ($cfh_modified) {
         unlink('typemap');
         print "Writing typemap...\n";
         $self->add_to_cleanup('typemap');
@@ -314,12 +314,11 @@ sub ACTION_clownfish {
     }
 
     # Rewrite XS if either any .cfh files or relevant .pm files were modified.
-    $modified ||=
-        $self->up_to_date( \@$buildlib_pm_filepaths, $xs_filepath )
-        ? 0
-        : 1;
+    my $buildlib_modified = ! $self->up_to_date(
+        \@$buildlib_pm_filepaths, [ $xs_filepath, $log_filepath ]
+    );
 
-    if ($modified) {
+    if ( $cfh_modified || $buildlib_modified ) {
         $self->add_to_cleanup($xs_filepath);
         $perl_binding->write_callbacks;
         $perl_binding->write_boot;
@@ -341,13 +340,8 @@ sub ACTION_clownfish {
     {
         utime( time, time, $xs_filepath );    # touch
     }
-    if (!$self->up_to_date(
-            [ @$cfh_filepaths, @$buildlib_pm_filepaths ], $AUTOGEN_DIR
-        )
-        )
-    {
-        utime( time, time, $AUTOGEN_DIR );    # touch
-    }
+
+    $hierarchy->write_log;
 }
 
 # Write ppport.h, which supplies some XS routines not found in older Perls and

Reply via email to