Title: [208045] trunk/Source/WebCore
Revision
208045
Author
[email protected]
Date
2016-10-28 05:36:33 -0700 (Fri, 28 Oct 2016)

Log Message

generate-bindings-all.pl should recompile supplemented IDL if its supplemental IDL are added or removed
https://bugs.webkit.org/show_bug.cgi?id=164054

Patch by Fujii Hironori <[email protected]> on 2016-10-28
Reviewed by Michael Catanzaro.

generate-bindings-all.pl determines which IDL to recompile by
comparing timestamps of generated files, source IDL and its
dependencies.  But this is not enough. If a new supplemental IDL
is added, its supplemented IDL needs to be recompiled even though
the timestamp of the supplemental IDL is older than the
generated files.

* bindings/scripts/generate-bindings-all.pl: Read supplemental
dependency file both before and after invoking preprocess-idls.pl.
Recompile IDL files if its supplemental dependencies are added or
removed.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208044 => 208045)


--- trunk/Source/WebCore/ChangeLog	2016-10-28 12:24:35 UTC (rev 208044)
+++ trunk/Source/WebCore/ChangeLog	2016-10-28 12:36:33 UTC (rev 208045)
@@ -1,3 +1,22 @@
+2016-10-28  Fujii Hironori  <[email protected]>
+
+        generate-bindings-all.pl should recompile supplemented IDL if its supplemental IDL are added or removed
+        https://bugs.webkit.org/show_bug.cgi?id=164054
+
+        Reviewed by Michael Catanzaro.
+
+        generate-bindings-all.pl determines which IDL to recompile by
+        comparing timestamps of generated files, source IDL and its
+        dependencies.  But this is not enough. If a new supplemental IDL
+        is added, its supplemented IDL needs to be recompiled even though
+        the timestamp of the supplemental IDL is older than the
+        generated files.
+
+        * bindings/scripts/generate-bindings-all.pl: Read supplemental
+        dependency file both before and after invoking preprocess-idls.pl.
+        Recompile IDL files if its supplemental dependencies are added or
+        removed.
+
 2016-10-28  Youenn Fablet  <[email protected]>
 
         PeerMediaDescription does not need to be refcounted

Modified: trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl (208044 => 208045)


--- trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl	2016-10-28 12:24:35 UTC (rev 208044)
+++ trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl	2016-10-28 12:36:33 UTC (rev 208045)
@@ -70,11 +70,13 @@
 @idlFiles = map { CygwinPathIfNeeded(s/\r?\n?$//r) } <$fh>;
 close($fh) or die;
 
-my %supplementedIdlFiles;
+my %oldSupplements;
+my %newSupplements;
 if ($supplementalDependencyFile) {
     my @output = ($supplementalDependencyFile, @ppExtraOutput);
-    my @deps = (@idlFiles, @generatorDependency);
+    my @deps = ($idlFilesList, @idlFiles, @generatorDependency);
     if (needsUpdate(\@output, \@deps)) {
+        readSupplementalDependencyFile($supplementalDependencyFile, \%oldSupplements) if -e $supplementalDependencyFile;
         my @args = (File::Spec->catfile($scriptDir, 'preprocess-idls.pl'),
                     '--defines', $defines,
                     '--idlFilesList', $idlFilesList,
@@ -83,12 +85,7 @@
         print("Preprocess IDL\n");
         executeCommand($perl, @args) == 0 or die;
     }
-    open(my $fh, '<', $supplementalDependencyFile) or die "Cannot open $supplementalDependencyFile";
-    while (<$fh>) {
-        my ($idlFile, @followingIdlFiles) = split(/\s+/);
-        $supplementedIdlFiles{$idlFile} = \@followingIdlFiles;
-    }
-    close($fh) or die;
+    readSupplementalDependencyFile($supplementalDependencyFile, \%newSupplements);
 }
 
 my @args = (File::Spec->catfile($scriptDir, 'generate-bindings.pl'),
@@ -104,7 +101,12 @@
 my %directoryCache;
 buildDirectoryCache();
 
-my @idlFilesToUpdate = grep {
+my @idlFilesToUpdate = grep &{sub {
+    if (defined($oldSupplements{$_})
+        && @{$oldSupplements{$_}} ne @{$newSupplements{$_} or []}) {
+        # Re-process the IDL file if its supplemental dependencies were added or removed
+        return 1;
+    }
     my ($filename, $dirs, $suffix) = fileparse($_, '.idl');
     my $sourceFile = File::Spec->catfile($outputDirectory, "JS$filename.cpp");
     my $headerFile = File::Spec->catfile($outputDirectory, "JS$filename.h");
@@ -113,10 +115,10 @@
     my @deps = ($_,
                 $idlAttributesFile,
                 @generatorDependency,
-                @{$supplementedIdlFiles{$_} or []},
+                @{$newSupplements{$_} or []},
                 implicitDependencies($depFile));
     needsUpdate(\@output, \@deps);
-} @idlFiles;
+}}, @idlFiles;
 my $queue = Thread::Queue->new(@idlFilesToUpdate);
 my $abort :shared = 0;
 my $terminalWidth = getTerminalWidth();
@@ -234,3 +236,15 @@
     return 80 if $^O eq 'MSWin32';
     return `stty size` =~ /\d+\s+(\d+)/ ? $1 : 80;
 }
+
+sub readSupplementalDependencyFile
+{
+    my $filename = shift;
+    my $supplements = shift;
+    open(my $fh, '<', $filename) or die "Cannot open $filename";
+    while (<$fh>) {
+        my ($idlFile, @followingIdlFiles) = split(/\s+/);
+        $supplements->{$idlFile} = [sort @followingIdlFiles];
+    }
+    close($fh) or die;
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to