Title: [105766] trunk/Source/WebCore
Revision
105766
Author
[email protected]
Date
2012-01-24 11:40:27 -0800 (Tue, 24 Jan 2012)

Log Message

In CodeGeneratorV8.pm, overwrite the output .h/.cpp
only if the bytes differ
https://bugs.webkit.org/show_bug.cgi?id=76920

Reviewed by Darin Adler.

This is one of steps to stop rebuilding .h/.cpp files
generated by unchanged IDLs (bug 76836).
This patch makes a change on CodeGeneratorV8.pm so that
it overwrites the output .h/.cpp only if the bytes differ.

No tests. No change in behavior.
I manually confirmed that when I add a new attribute to Element.idl,
the time-stamps of unrelated V8*.h and V8*.cpp do not change.

* bindings/scripts/CodeGeneratorV8.pm:
(WriteData): Used UpdateFileIfChanged().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105765 => 105766)


--- trunk/Source/WebCore/ChangeLog	2012-01-24 19:39:28 UTC (rev 105765)
+++ trunk/Source/WebCore/ChangeLog	2012-01-24 19:40:27 UTC (rev 105766)
@@ -1,5 +1,25 @@
 2012-01-24  Kentaro Hara  <[email protected]>
 
+        In CodeGeneratorV8.pm, overwrite the output .h/.cpp
+        only if the bytes differ
+        https://bugs.webkit.org/show_bug.cgi?id=76920
+
+        Reviewed by Darin Adler.
+
+        This is one of steps to stop rebuilding .h/.cpp files
+        generated by unchanged IDLs (bug 76836).
+        This patch makes a change on CodeGeneratorV8.pm so that
+        it overwrites the output .h/.cpp only if the bytes differ.
+
+        No tests. No change in behavior.
+        I manually confirmed that when I add a new attribute to Element.idl,
+        the time-stamps of unrelated V8*.h and V8*.cpp do not change.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (WriteData): Used UpdateFileIfChanged().
+
+2012-01-24  Kentaro Hara  <[email protected]>
+
         [Refactoring] Remove finish() from all CodeGenerator*.pm
         https://bugs.webkit.org/show_bug.cgi?id=76918
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (105765 => 105766)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-01-24 19:39:28 UTC (rev 105765)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-01-24 19:40:27 UTC (rev 105766)
@@ -3799,12 +3799,9 @@
     my $headerFileName = "$outputHeadersDir/$prefix$name.h";
     my $implFileName = "$outputDir/$prefix$name.cpp";
 
-    open(IMPL, ">$implFileName") || die "Couldn't open file $implFileName";
+    # Update a .cpp file if the contents are changed.
+    my $contents = join "", @implContentHeader, @implFixedHeader;
 
-    # Write content to file.
-    print IMPL @implContentHeader;
-    print IMPL @implFixedHeader;
-
     my @includes = ();
     my %implIncludeConditions = ();
     foreach my $include (keys %implIncludes) {
@@ -3826,30 +3823,28 @@
         }
     }
     foreach my $include (sort @includes) {
-        print IMPL "#include $include\n";
+        $contents .= "#include $include\n";
     }
     foreach my $condition (sort keys %implIncludeConditions) {
-        print IMPL "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n";
+        $contents .= "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n";
         foreach my $include (sort @{$implIncludeConditions{$condition}}) {
-            print IMPL "#include $include\n";
+            $contents .= "#include $include\n";
         }
-        print IMPL "#endif\n";
+        $contents .= "#endif\n";
     }
 
-    print IMPL "\n";
-    print IMPL @implContentDecls;
-    print IMPL @implContent;
-    close(IMPL);
+    $contents .= "\n";
+    $contents .= join "", @implContentDecls, @implContent;
+    $codeGenerator->UpdateFileIfChanged($implFileName, $contents);
 
     %implIncludes = ();
     @implFixedHeader = ();
     @implContentDecls = ();
     @implContent = ();
 
-    # Write content to file.
-    open(HEADER, ">$headerFileName") || die "Couldn't open file $headerFileName";
-    print HEADER @headerContent;
-    close(HEADER);
+    # Update a .h file if the contents are changed.
+    $contents = join "", @headerContent;
+    $codeGenerator->UpdateFileIfChanged($headerFileName, $contents);
 
     @headerContent = ();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to