Title: [122739] trunk/Source/WebCore
- Revision
- 122739
- Author
- [email protected]
- Date
- 2012-07-16 11:10:58 -0700 (Mon, 16 Jul 2012)
Log Message
Web Inspector: CodeGeneratorInspector.py: fix output write logic to support incremental build
https://bugs.webkit.org/show_bug.cgi?id=90642
Patch by Peter Rybin <[email protected]> on 2012-07-16
Reviewed by Yury Semikhatsky.
A small intermediate writer is added. It handles comparing old and new source before actual writing.
* inspector/CodeGeneratorInspector.py:
(flatten_list):
(SmartOutput):
(SmartOutput.__init__):
(SmartOutput.write):
(SmartOutput.close):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (122738 => 122739)
--- trunk/Source/WebCore/ChangeLog 2012-07-16 18:04:44 UTC (rev 122738)
+++ trunk/Source/WebCore/ChangeLog 2012-07-16 18:10:58 UTC (rev 122739)
@@ -1,3 +1,19 @@
+2012-07-16 Peter Rybin <[email protected]>
+
+ Web Inspector: CodeGeneratorInspector.py: fix output write logic to support incremental build
+ https://bugs.webkit.org/show_bug.cgi?id=90642
+
+ Reviewed by Yury Semikhatsky.
+
+ A small intermediate writer is added. It handles comparing old and new source before actual writing.
+
+ * inspector/CodeGeneratorInspector.py:
+ (flatten_list):
+ (SmartOutput):
+ (SmartOutput.__init__):
+ (SmartOutput.write):
+ (SmartOutput.close):
+
2012-07-16 Dana Jansens <[email protected]>
[chromium] Incorrect assertion: Replicas will cause a RenderPass to be removed twice
Modified: trunk/Source/WebCore/inspector/CodeGeneratorInspector.py (122738 => 122739)
--- trunk/Source/WebCore/inspector/CodeGeneratorInspector.py 2012-07-16 18:04:44 UTC (rev 122738)
+++ trunk/Source/WebCore/inspector/CodeGeneratorInspector.py 2012-07-16 18:10:58 UTC (rev 122739)
@@ -2953,18 +2953,45 @@
return res
+# A writer that only updates file if it actually changed to better support incremental build.
+class SmartOutput:
+ def __init__(self, file_name):
+ self.file_name_ = file_name
+ self.output_ = ""
+
+ def write(self, text):
+ self.output_ += text
+
+ def close(self):
+ text_changed = True
+
+ try:
+ read_file = open(self.file_name_, "r")
+ old_text = read_file.read()
+ read_file.close()
+ text_changed = old_text != self.output_
+ except:
+ # Ignore, just overwrite by default
+ pass
+
+ if text_changed:
+ out_file = open(self.file_name_, "w")
+ out_file.write(self.output_)
+ out_file.close()
+
+
Generator.go()
-backend_h_file = open(output_header_dirname + "/InspectorBackendDispatcher.h", "w")
-backend_cpp_file = open(output_cpp_dirname + "/InspectorBackendDispatcher.cpp", "w")
+backend_h_file = SmartOutput(output_header_dirname + "/InspectorBackendDispatcher.h")
+backend_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorBackendDispatcher.cpp")
-frontend_h_file = open(output_header_dirname + "/InspectorFrontend.h", "w")
-frontend_cpp_file = open(output_cpp_dirname + "/InspectorFrontend.cpp", "w")
+frontend_h_file = SmartOutput(output_header_dirname + "/InspectorFrontend.h")
+frontend_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorFrontend.cpp")
-typebuilder_h_file = open(output_header_dirname + "/InspectorTypeBuilder.h", "w")
-typebuilder_cpp_file = open(output_cpp_dirname + "/InspectorTypeBuilder.cpp", "w")
+typebuilder_h_file = SmartOutput(output_header_dirname + "/InspectorTypeBuilder.h")
+typebuilder_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorTypeBuilder.cpp")
-backend_js_file = open(output_cpp_dirname + "/InspectorBackendCommands.js", "w")
+backend_js_file = SmartOutput(output_cpp_dirname + "/InspectorBackendCommands.js")
backend_h_file.write(Templates.backend_h.substitute(None,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes