Modified: trunk/Source/WebCore/ChangeLog (210492 => 210493)
--- trunk/Source/WebCore/ChangeLog 2017-01-07 22:08:28 UTC (rev 210492)
+++ trunk/Source/WebCore/ChangeLog 2017-01-07 23:39:32 UTC (rev 210493)
@@ -1,3 +1,19 @@
+2017-01-07 Simon Fraser <[email protected]>
+
+ Avoid triggering rebuilds for minor changes of CSSProperties.json
+ https://bugs.webkit.org/show_bug.cgi?id=166810
+
+ Reviewed by Daniel Bates.
+
+ We expect to make lots of metadata-related changes to CSSProperties.json, and
+ these should not trigger rebuilds.
+
+ Have makeprop.pl write to temporary files first, then only replace the generated
+ files if the contents differ.
+
+ * css/makeprop.pl:
+ (replaceFileIfChanged):
+
2017-01-06 Darin Adler <[email protected]>
Remove PassRefPtr use from "inspector", "platform/sql", and "platform/text"
Modified: trunk/Source/WebCore/css/makeprop.pl (210492 => 210493)
--- trunk/Source/WebCore/css/makeprop.pl 2017-01-07 22:08:28 UTC (rev 210492)
+++ trunk/Source/WebCore/css/makeprop.pl 2017-01-07 23:39:32 UTC (rev 210493)
@@ -27,6 +27,8 @@
use warnings;
use English;
+use File::Compare;
+use File::Copy;
use File::Spec;
use Getopt::Long;
use JSON::PP;
@@ -175,7 +177,19 @@
@names = sort sortByDescendingPriorityAndName @names;
-open GPERF, ">CSSPropertyNames.gperf" || die "Could not open CSSPropertyNames.gperf for writing";
+sub replaceFileIfChanged($$)
+{
+ my ($tempFile, $file) = @_;
+
+ if (compare($tempFile, $file) != 0) {
+ copy($tempFile, $file) or die "Failed to copy $tempFile to $file: $!";
+ }
+ unlink($tempFile);
+}
+
+my $gperfTempFile = "CSSPropertyNames.gperf.tmp";
+
+open GPERF, ">$gperfTempFile" || die "Could not open $gperfTempFile for writing";
print GPERF << "EOF";
%{
/* This file is automatically generated from $inputFile by makeprop, do not edit */
@@ -332,7 +346,11 @@
close GPERF;
-open HEADER, ">CSSPropertyNames.h" || die "Could not open CSSPropertyNames.h for writing";
+replaceFileIfChanged($gperfTempFile, "CSSPropertyNames.gperf");
+
+my $properyNamesHeaderTempFile = "CSSPropertyNames.h.tmp";
+
+open HEADER, ">$properyNamesHeaderTempFile" || die "Could not open $properyNamesHeaderTempFile for writing";
print HEADER << "EOF";
/* This file is automatically generated from $inputFile by makeprop, do not edit */
@@ -405,6 +423,8 @@
close HEADER;
+replaceFileIfChanged($properyNamesHeaderTempFile, "CSSPropertyNames.h");
+
#
# StyleBuilder.cpp generator.
#
@@ -894,7 +914,9 @@
return $setterContent;
}
-open STYLEBUILDER, ">StyleBuilder.cpp" || die "Could not open StyleBuilder.cpp for writing";
+my $styleBuilderTempFile = "StyleBuilder.cpp.tmp";
+
+open STYLEBUILDER, ">$styleBuilderTempFile" || die "Could not open $styleBuilderTempFile for writing";
print STYLEBUILDER << "EOF";
/* This file is automatically generated from $inputFile by makeprop, do not edit */
@@ -968,8 +990,13 @@
close STYLEBUILDER;
+replaceFileIfChanged($styleBuilderTempFile, "StyleBuilder.cpp");
+
# Generate StylePropertyShorthandsFunctions.
-open SHORTHANDS_H, ">StylePropertyShorthandFunctions.h" || die "Could not open StylePropertyShorthandFunctions.h for writing";
+
+my $stylePropertyShorthandFunctionsHeaderTempFile = "StylePropertyShorthandFunctions.h.tmp";
+
+open SHORTHANDS_H, ">$stylePropertyShorthandFunctionsHeaderTempFile" || die "Could not open $stylePropertyShorthandFunctionsHeaderTempFile for writing";
print SHORTHANDS_H << "EOF";
/* This file is automatically generated from $inputFile by makeprop, do not edit */
@@ -995,7 +1022,13 @@
close SHORTHANDS_H;
-open SHORTHANDS_CPP, ">StylePropertyShorthandFunctions.cpp" || die "Could not open StylePropertyShorthandFunctions.cpp for writing";
+replaceFileIfChanged($stylePropertyShorthandFunctionsHeaderTempFile, "StylePropertyShorthandFunctions.h");
+
+# Generate StylePropertyShorthandsFunctions.
+
+my $stylePropertyShorthandFunctionsTempFile = "StylePropertyShorthandFunctions.cpp.tmp";
+
+open SHORTHANDS_CPP, ">$stylePropertyShorthandFunctionsTempFile" || die "Could not open $stylePropertyShorthandFunctionsTempFile for writing";
print SHORTHANDS_CPP << "EOF";
/* This file is automatically generated from $inputFile by makeprop, do not edit */
@@ -1108,6 +1141,8 @@
close SHORTHANDS_CPP;
+replaceFileIfChanged($stylePropertyShorthandFunctionsTempFile, "StylePropertyShorthandFunctions.cpp");
+
if (not $gperf) {
$gperf = $ENV{GPERF} ? $ENV{GPERF} : "gperf";
}