Title: [105809] trunk/Source/WebCore
- Revision
- 105809
- Author
- [email protected]
- Date
- 2012-01-24 14:24:02 -0800 (Tue, 24 Jan 2012)
Log Message
CodeGeneratorJS.pm should overwrite the output .h/.cpp
only if the bytes differ
https://bugs.webkit.org/show_bug.cgi?id=76922
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 CodeGeneratorJS.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 JS*.h and JS*.cpp do not change.
* bindings/scripts/CodeGeneratorJS.pm:
(WriteData): Used UpdateFileIfChanged().
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (105808 => 105809)
--- trunk/Source/WebCore/ChangeLog 2012-01-24 22:23:32 UTC (rev 105808)
+++ trunk/Source/WebCore/ChangeLog 2012-01-24 22:24:02 UTC (rev 105809)
@@ -1,5 +1,25 @@
2012-01-24 Kentaro Hara <[email protected]>
+ CodeGeneratorJS.pm should overwrite the output .h/.cpp
+ only if the bytes differ
+ https://bugs.webkit.org/show_bug.cgi?id=76922
+
+ 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 CodeGeneratorJS.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 JS*.h and JS*.cpp do not change.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (WriteData): Used UpdateFileIfChanged().
+
+2012-01-24 Kentaro Hara <[email protected]>
+
CodeGeneratorCPP.pm should overwrite the output .h/.cpp
only if the bytes differ
https://bugs.webkit.org/show_bug.cgi?id=76926
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (105808 => 105809)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-01-24 22:23:32 UTC (rev 105808)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-01-24 22:24:02 UTC (rev 105809)
@@ -3234,14 +3234,9 @@
my $implFileName = "$outputDir/$prefix$name.cpp";
my $depsFileName = "$outputDir/$prefix$name.dep";
- # Remove old dependency file.
- unlink($depsFileName);
+ # Update a .cpp file if the contents are changed.
+ my $contents = join "", @implContentHeader;
- open(IMPL, ">$implFileName") || die "Couldn't open file $implFileName";
-
- # Write content to file.
- print IMPL @implContentHeader;
-
my @includes = ();
my %implIncludeConditions = ();
foreach my $include (keys %implIncludes) {
@@ -3259,38 +3254,36 @@
}
}
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 @implContent;
- close(IMPL);
+ $contents .= join "", @implContent;
+ $codeGenerator->UpdateFileIfChanged($implFileName, $contents);
@implContentHeader = ();
@implContent = ();
%implIncludes = ();
- open(HEADER, ">$headerFileName") || die "Couldn't open file $headerFileName";
+ # Update a .h file if the contents are changed.
+ $contents = join "", @headerContentHeader;
- # Write content to file.
- print HEADER @headerContentHeader;
-
@includes = ();
foreach my $include (keys %headerIncludes) {
$include = "\"$include\"" unless $include =~ /^["<]/; # "
push @includes, $include;
}
foreach my $include (sort @includes) {
- print HEADER "#include $include\n";
+ $contents .= "#include $include\n";
}
- print HEADER @headerContent;
+ $contents .= join "", @headerContent;
@includes = ();
foreach my $include (keys %headerTrailingIncludes) {
@@ -3298,21 +3291,19 @@
push @includes, $include;
}
foreach my $include (sort @includes) {
- print HEADER "#include $include\n";
+ $contents .= "#include $include\n";
}
+ $codeGenerator->UpdateFileIfChanged($headerFileName, $contents);
- close(HEADER);
-
@headerContentHeader = ();
@headerContent = ();
%headerIncludes = ();
%headerTrailingIncludes = ();
if (@depsContent) {
- open(DEPS, ">$depsFileName") || die "Couldn't open file $depsFileName";
- # Write dependency file.
- print DEPS @depsContent;
- close(DEPS);
+ # Update a .dep file if the contents are changed.
+ $contents = join "", @depsContent;
+ $codeGenerator->UpdateFileIfChanged($depsFileName, $contents);
@depsContent = ();
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes