Invalidate r105697, r105766, r105809 and r105805
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jan 2012 02:47:06 +0000 (02:47 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jan 2012 02:47:06 +0000 (02:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76970

Reviewed by Adam Barth.

I've been trying to stop rebuilding .h/.cpp files generated by
unchanged IDLs (bug 76836), but the approach was wrong.
This patch invalidates patches committed in r105697, r105766,
r105809 and r105805.

In r105697, r105766, r105809 and r105805, I modified CodeGenerator*.pm
so that they overwrite .h/.cpp files only when the bytes differ.
By this fix, we were able to stop rebuilding .h/.cpp files that are not
changed. However, the fix has made generate-bindings.pl run for almost
all IDLs every time. The reason is as follows:

(0) Assume that there are A.idl, B.idl and C.idl.

(1) Modify A.idl.
(2) First build.
(3) supplemental_dependency.tmp is updated.
(4) generate-bindings.pl runs for A.idl, B.idl and C.idl.
(5) A.h and A.cpp are updated. B.h, B.cpp, C.h and C.cpp are not updated.

(6) Second build.
(7) Since B.h, B.cpp, C.h and C.cpp are older than supplemental_dependency.tmp, generate-bindings.pl runs for B.idl and C.idl.
(8) B.h, B.cpp, C.h and C.cpp are not updated.

(9) Third build.
(10) Since B.h, B.cpp, C.h and C.cpp are older than supplemental_dependency.tmp, generate-bindings.pl runs for B.idl and C.idl.
(11) B.h, B.cpp, C.h and C.cpp are not updated.
...

We should fix the bug somehow, but how to fix it is not obvious.
For the time being, this patch invalidates r105697, r105766, r105809
and r105805.

No tests. No change in behavior.

* bindings/scripts/CodeGenerator.pm:
(UpdateFile):
* bindings/scripts/CodeGeneratorCPP.pm:
(WriteData):
* bindings/scripts/CodeGeneratorJS.pm:
(WriteData):
* bindings/scripts/CodeGeneratorObjC.pm:
(WriteData):
* bindings/scripts/CodeGeneratorV8.pm:
(WriteData):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105844 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

index 3cefb92..62743b6 100644 (file)
@@ -1,3 +1,55 @@
+2012-01-24  Kentaro Hara  <haraken@chromium.org>
+
+        Invalidate r105697, r105766, r105809 and r105805
+        https://bugs.webkit.org/show_bug.cgi?id=76970
+
+        Reviewed by Adam Barth.
+
+        I've been trying to stop rebuilding .h/.cpp files generated by
+        unchanged IDLs (bug 76836), but the approach was wrong.
+        This patch invalidates patches committed in r105697, r105766,
+        r105809 and r105805.
+
+        In r105697, r105766, r105809 and r105805, I modified CodeGenerator*.pm
+        so that they overwrite .h/.cpp files only when the bytes differ.
+        By this fix, we were able to stop rebuilding .h/.cpp files that are not
+        changed. However, the fix has made generate-bindings.pl run for almost
+        all IDLs every time. The reason is as follows:
+
+        (0) Assume that there are A.idl, B.idl and C.idl.
+
+        (1) Modify A.idl.
+        (2) First build.
+        (3) supplemental_dependency.tmp is updated.
+        (4) generate-bindings.pl runs for A.idl, B.idl and C.idl.
+        (5) A.h and A.cpp are updated. B.h, B.cpp, C.h and C.cpp are not updated.
+
+        (6) Second build.
+        (7) Since B.h, B.cpp, C.h and C.cpp are older than supplemental_dependency.tmp, generate-bindings.pl runs for B.idl and C.idl.
+        (8) B.h, B.cpp, C.h and C.cpp are not updated.
+
+        (9) Third build.
+        (10) Since B.h, B.cpp, C.h and C.cpp are older than supplemental_dependency.tmp, generate-bindings.pl runs for B.idl and C.idl.
+        (11) B.h, B.cpp, C.h and C.cpp are not updated.
+        ...
+
+        We should fix the bug somehow, but how to fix it is not obvious.
+        For the time being, this patch invalidates r105697, r105766, r105809
+        and r105805.
+
+        No tests. No change in behavior.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (UpdateFile):
+        * bindings/scripts/CodeGeneratorCPP.pm:
+        (WriteData):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (WriteData):
+        * bindings/scripts/CodeGeneratorObjC.pm:
+        (WriteData):
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (WriteData):
+
 2012-01-24  Eric Uhrhane  <ericu@chromium.org>
 
         Add full support for filesystem URLs.
index c399d6e..2ad98e6 100644 (file)
@@ -161,28 +161,15 @@ sub FileNamePrefix
     return $codeGenerator->FileNamePrefix();
 }
 
-sub UpdateFileIfChanged
+sub UpdateFile
 {
     my $object = shift;
     my $fileName = shift;
     my $contents = shift;
 
-    my $shouldUpdate = 0;
-
-    if (open FH, $fileName) {
-        local $/ = undef;
-        my $oldContents = <FH>;
-        $shouldUpdate = 1 if $oldContents ne $contents;
-        close FH;
-    } else {
-        $shouldUpdate = 1;
-    }
-
-    if ($shouldUpdate) {
-        open FH, "> $fileName" or die "Couldn't open $fileName: $!\n";
-        print FH $contents;
-        close FH;
-    }
+    open FH, "> $fileName" or die "Couldn't open $fileName: $!\n";
+    print FH $contents;
+    close FH;
 }
 
 sub ForAllParents
index 0005c55..c881bf9 100644 (file)
@@ -952,7 +952,7 @@ sub WriteData
     my $hasForwardDeclarations = keys(%headerForwardDeclarations);
     $contents .= "\n" if $hasForwardDeclarations;
     $contents .= join "", @headerContent;
-    $codeGenerator->UpdateFileIfChanged($headerFileName, $contents);
+    $codeGenerator->UpdateFile($headerFileName, $contents);
 
     @headerContentHeader = ();
     @headerContent = ();
@@ -968,7 +968,7 @@ sub WriteData
     }
 
     $contents .= join "", @implContent;
-    $codeGenerator->UpdateFileIfChanged($implFileName, $contents);
+    $codeGenerator->UpdateFile($implFileName, $contents);
 
     @implContentHeader = ();
     @implContent = ();
index 2039b7b..823b4f6 100644 (file)
@@ -3265,7 +3265,7 @@ sub WriteData
     }
 
     $contents .= join "", @implContent;
-    $codeGenerator->UpdateFileIfChanged($implFileName, $contents);
+    $codeGenerator->UpdateFile($implFileName, $contents);
 
     @implContentHeader = ();
     @implContent = ();
@@ -3293,7 +3293,7 @@ sub WriteData
     foreach my $include (sort @includes) {
         $contents .= "#include $include\n";
     }
-    $codeGenerator->UpdateFileIfChanged($headerFileName, $contents);
+    $codeGenerator->UpdateFile($headerFileName, $contents);
 
     @headerContentHeader = ();
     @headerContent = ();
@@ -3303,7 +3303,7 @@ sub WriteData
     if (@depsContent) {
         # Update a .dep file if the contents are changed.
         $contents = join "", @depsContent;
-        $codeGenerator->UpdateFileIfChanged($depsFileName, $contents);
+        $codeGenerator->UpdateFile($depsFileName, $contents);
 
         @depsContent = ();
     }
index 113f8b3..add81d2 100644 (file)
@@ -1779,7 +1779,7 @@ sub WriteData
     my $hasForwardDeclarations = keys(%headerForwardDeclarations) + keys(%headerForwardDeclarationsForProtocols);
     $contents .= "\n" if $hasForwardDeclarations;
     $contents .= join "", @headerContent;
-    $codeGenerator->UpdateFileIfChanged($headerFileName, $contents);
+    $codeGenerator->UpdateFile($headerFileName, $contents);
 
     @headerContentHeader = ();
     @headerContent = ();
@@ -1794,7 +1794,7 @@ sub WriteData
         $hasForwardDeclarations = keys(%privateHeaderForwardDeclarations) + keys(%privateHeaderForwardDeclarationsForProtocols);
         $contents .= "\n" if $hasForwardDeclarations;
         $contents .= join "", @privateHeaderContent;
-        $codeGenerator->UpdateFileIfChanged($privateHeaderFileName, $contents);
+        $codeGenerator->UpdateFile($privateHeaderFileName, $contents);
 
         @privateHeaderContentHeader = ();
         @privateHeaderContent = ();
@@ -1807,7 +1807,7 @@ sub WriteData
         $contents = join "", @implContentHeader;
         map { $contents .= "#import \"$_\"\n" } sort keys(%implIncludes);
         $contents .= join "", @implContent;
-        $codeGenerator->UpdateFileIfChanged($implFileName, $contents);
+        $codeGenerator->UpdateFile($implFileName, $contents);
 
         @implContentHeader = ();
         @implContent = ();
@@ -1816,7 +1816,7 @@ sub WriteData
 
     if (@internalHeaderContent > 0) {
         $contents = join "", @internalHeaderContent;
-        $codeGenerator->UpdateFileIfChanged($internalHeaderFileName, $contents);
+        $codeGenerator->UpdateFile($internalHeaderFileName, $contents);
 
         @internalHeaderContent = ();
     }
@@ -1824,7 +1824,7 @@ sub WriteData
     # Write dependency file.
     if (@depsContent) {
         $contents = join "", @depsContent;
-        $codeGenerator->UpdateFileIfChanged($depsFileName, $contents);
+        $codeGenerator->UpdateFile($depsFileName, $contents);
 
         @depsContent = ();
     }
index 43150ca..8e04cfc 100644 (file)
@@ -3835,7 +3835,7 @@ sub WriteData
 
     $contents .= "\n";
     $contents .= join "", @implContentDecls, @implContent;
-    $codeGenerator->UpdateFileIfChanged($implFileName, $contents);
+    $codeGenerator->UpdateFile($implFileName, $contents);
 
     %implIncludes = ();
     @implFixedHeader = ();
@@ -3844,7 +3844,7 @@ sub WriteData
 
     # Update a .h file if the contents are changed.
     $contents = join "", @headerContent;
-    $codeGenerator->UpdateFileIfChanged($headerFileName, $contents);
+    $codeGenerator->UpdateFile($headerFileName, $contents);
 
     @headerContent = ();
 }