Title: [168712] releases/WebKitGTK/webkit-2.4
Revision
168712
Author
g...@gnome.org
Date
2014-05-13 12:29:57 -0700 (Tue, 13 May 2014)

Log Message

Merge 165060 - [GTK] Simplify the GObject DOM bindings API break check into one step
https://bugs.webkit.org/show_bug.cgi?id=129571

Reviewed by Carlos Garcia Campos.

.:

* Source/PlatformGTK.cmake: We don't need to run the API break check before gtkdoc generation.
Add the check to 'make check.'

Source/WebCore:

* bindings/gobject/GNUmakefile.am: We no longer generate the webkitdom.symbols file in the
DerivedSources directory. All the logic is handled internally in the script now.
* bindings/scripts/gobject-run-api-break-test: Removed.

Tools:

* GNUmakefile.am: Add the API break check to 'make check.'
* gtk/check-for-webkitdom-api-breaks: Added. A combination of the two removed scripts.
* gtk/check-gdom-symbols: Removed.
* gtk/webkitdom.py: Added.
(header_name_list_from_gtkdoc_config_file): Gets the names of all headers from the gtkdoc config file.
(get_all_webkitdom_symbol_files): Find the symbol files from the names.


Conflicts:
	ChangeLog
	Source/WebCore/ChangeLog
	Tools/ChangeLog

Modified Paths

Added Paths

Removed Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/PlatformGTK.cmake (168711 => 168712)


--- releases/WebKitGTK/webkit-2.4/Source/PlatformGTK.cmake	2014-05-13 19:29:34 UTC (rev 168711)
+++ releases/WebKitGTK/webkit-2.4/Source/PlatformGTK.cmake	2014-05-13 19:29:57 UTC (rev 168712)
@@ -4,7 +4,6 @@
 add_custom_target(gir ALL DEPENDS ${GObjectIntrospectionTargets})
 
 set(DocumentationDependencies
-    generate-gdom-symbols-file
     "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitenvironment.xml"
 )
 
@@ -51,7 +50,8 @@
 endif ()
 
 add_custom_target(check
-    COMMAND "${TOOLS_DIR}/Scripts/run-gtk-tests"
+    COMMAND ${TOOLS_DIR}/Scripts/run-gtk-tests
+    COMMAND ${TOOLS_DIR}/gtk/check-for-webkitdom-api-breaks
 )
 
 if (ENABLE_WEBKIT AND ENABLE_WEBKIT2)

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/GNUmakefile.am (168711 => 168712)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/GNUmakefile.am	2014-05-13 19:29:34 UTC (rev 168711)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/GNUmakefile.am	2014-05-13 19:29:57 UTC (rev 168712)
@@ -682,7 +682,6 @@
 	Source/WebCore/bindings/scripts/StaticString.pm \
 	Source/WebCore/bindings/scripts/generate-bindings.pl \
 	Source/WebCore/bindings/scripts/gobject-generate-headers.pl \
-	Source/WebCore/bindings/scripts/gobject-run-api-break-test \
 	Source/WebCore/bindings/scripts/preprocessor.pm \
 	Source/WebCore/bindings/scripts/preprocess-idls.pl \
 	Source/WebCore/ChangeLog \

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/PlatformGTK.cmake (168711 => 168712)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/PlatformGTK.cmake	2014-05-13 19:29:34 UTC (rev 168711)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/PlatformGTK.cmake	2014-05-13 19:29:57 UTC (rev 168712)
@@ -734,16 +734,5 @@
                   bindings/gobject/WebKitDOMObject.h
             DESTINATION "${WEBKITGTK_HEADER_INSTALL_DIR}/webkitdom"
     )
-
-    add_custom_command(
-        OUTPUT ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.symbols
-        DEPENDS ${GObjectDOMBindingsSymbolsFiles} ${CMAKE_SOURCE_DIR}/Tools/gtk/check-gdom-symbols
-        COMMAND ln -n -s -f ${WEBCORE_DIR}/bindings/gobject/WebKitDOM*.symbols ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}
-        COMMAND ${CMAKE_SOURCE_DIR}/Tools/gtk/check-gdom-symbols
-    )
-
-    add_custom_target(generate-gdom-symbols-file
-        DEPENDS GObjectDOMBindings ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.symbols
-    )
 endif ()
 

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/bindings/gobject/GNUmakefile.am (168711 => 168712)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/bindings/gobject/GNUmakefile.am	2014-05-13 19:29:34 UTC (rev 168711)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/bindings/gobject/GNUmakefile.am	2014-05-13 19:29:57 UTC (rev 168712)
@@ -483,7 +483,6 @@
 DerivedSources/webkitdom/webkitdomdefines.h: $(WebCore)/bindings/scripts/gobject-generate-headers.pl $(WebCore)/bindings/gobject/GNUmakefile.am
 	$(AM_V_GEN)echo $(gdom_class_list) | $(PERL) $< defines > $@
 
-noinst_DATA += DerivedSources/webkitdom/webkitdom.symbols
 gdom_symbol_files += $(patsubst %.h,%.symbols, $(filter DerivedSources/webkitdom/WebKitDOM%.h, $(webkitgtk_gdom_built_h_api)))
 
 $(top_builddir)/DerivedSources/webkitdom/WebKitDOMObject.symbols: $(WebCore)/bindings/gobject/WebKitDOMObject.symbols
@@ -501,9 +500,6 @@
 DerivedSources/webkitdom/WebKitDOM%.symbols: DerivedSources/webkitdom/WebKitDOM%.h
 	@true
 
-DerivedSources/webkitdom/webkitdom.symbols: $(gdom_symbol_files) $(WebCore)/bindings/gobject/webkitdom.symbols $(WebCore)/bindings/scripts/gobject-run-api-break-test $(srcdir)/Tools/gtk/check-gdom-symbols
-	$(AM_V_GEN)$(srcdir)/Tools/gtk/check-gdom-symbols
-
 EXTRA_DIST += \
 	$(WebCore)/bindings/gobject/WebKitDOMCustom.symbols \
 	$(WebCore)/bindings/gobject/WebKitDOMDeprecated.symbols \

Deleted: releases/WebKitGTK/webkit-2.4/Source/WebCore/bindings/scripts/gobject-run-api-break-test (168711 => 168712)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/bindings/scripts/gobject-run-api-break-test	2014-05-13 19:29:34 UTC (rev 168711)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/bindings/scripts/gobject-run-api-break-test	2014-05-13 19:29:57 UTC (rev 168712)
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2013 Igalia S.L.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-import difflib
-import optparse
-import shutil
-import sys
-
-def check_api(options, from_file, to_file):
-    from_lines = open(from_file, 'r').readlines()
-    from_lines.sort()
-    to_lines = open(to_file, 'r').readlines()
-    to_lines.sort()
-
-    diff = difflib.unified_diff(from_lines, to_lines)
-
-    diff_out = ""
-    failed = False
-    for line in diff:
-        # Ignore initial lines since we don't use from/file filenames.
-        if line.startswith('+++') or line.startswith('---'):
-            continue
-
-        diff_out += line
-        if line[0] == '-':
-            failed = True
-
-    if diff_out:
-        if failed:
-            sys.stderr.write("API incompatibility detected in GObject DOM bindings\n")
-            sys.stderr.write(diff_out)
-            # This test can give false positives because the GObject
-            # DOM bindings API varies depending on the compilation options.
-            # So this shouldn't be made fatal until we figure out a way to handle it.
-            # See https://bugs.webkit.org/show_bug.cgi?id=121481
-            return 0
-
-        if options.reset_results:
-            sys.stdout.write("Reset results: %s\n" % from_file)
-            shutil.copyfile(to_file, from_file)
-        else:
-            sys.stdout.write("API compatible changes found in GObject DOM bindings\n")
-            sys.stdout.write("To update the symbols file, execute %s --reset-results %s DerivedSources/webkitdom/webkitdom.symbols\n" % (sys.argv[0], from_file))
-            sys.stdout.write(diff_out)
-
-    return 0
-
-
-option_parser = optparse.OptionParser(usage='usage: %prog [options] FROM_FILE TO_FILE')
-option_parser.add_option('--reset-results', action='', dest='reset_results')
-options, args = option_parser.parse_args()
-sys.exit(check_api(options, args[0], args[1]))
-

Modified: releases/WebKitGTK/webkit-2.4/Tools/GNUmakefile.am (168711 => 168712)


--- releases/WebKitGTK/webkit-2.4/Tools/GNUmakefile.am	2014-05-13 19:29:34 UTC (rev 168711)
+++ releases/WebKitGTK/webkit-2.4/Tools/GNUmakefile.am	2014-05-13 19:29:57 UTC (rev 168712)
@@ -267,6 +267,7 @@
 
 check-local:
 	$(top_srcdir)/Tools/Scripts/run-gtk-tests --timeout=-1
+	$(top_srcdir)/Tools/gtk/check-for-webkitdom-api-breaks
 
 EXTRA_DIST += \
 	Tools/jhbuild/jhbuildutils.py \

Modified: releases/WebKitGTK/webkit-2.4/Tools/gtk/GNUmakefile.am (168711 => 168712)


--- releases/WebKitGTK/webkit-2.4/Tools/gtk/GNUmakefile.am	2014-05-13 19:29:34 UTC (rev 168711)
+++ releases/WebKitGTK/webkit-2.4/Tools/gtk/GNUmakefile.am	2014-05-13 19:29:57 UTC (rev 168712)
@@ -1,4 +1,5 @@
 EXTRA_DIST += \
+	Tools/gtk/check-for-webkitdom-api-breaks \
 	Tools/gtk/common.py \
 	Tools/gtk/generate-feature-defines-files \
 	Tools/gtk/generate-gtkdoc \

Added: releases/WebKitGTK/webkit-2.4/Tools/gtk/check-for-webkitdom-api-breaks (0 => 168712)


--- releases/WebKitGTK/webkit-2.4/Tools/gtk/check-for-webkitdom-api-breaks	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.4/Tools/gtk/check-for-webkitdom-api-breaks	2014-05-13 19:29:57 UTC (rev 168712)
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+# Copyright (C) 2013, 2014 Igalia S.L.
+# Copyright (C) 2013 Gustavo Noronha Silva <g...@gnome.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+import argparse
+import common
+import os
+import sys
+import webkitdom
+
+EXPECTED_API_PATH = common.top_level_path('Source', 'WebCore', 'bindings', 'gobject', 'webkitdom.symbols')
+
+def read_built_api():
+    apis = set()
+    for file_path in webkitdom.get_all_webkitdom_symbol_files():
+        with open(file_path) as file_handle:
+            apis.update(set(file_handle.readlines()))
+    return apis
+
+def read_expected_api():
+    with open(EXPECTED_API_PATH) as file_handle:
+        return set(file_handle.readlines())
+
+def write_expected_api(new_expected_api):
+    with open(EXPECTED_API_PATH, 'w') as file_handle:
+        file_handle.writelines(new_expected_api)
+
+def check_api(options, expected_api, built_api):
+    missing_api = expected_api.difference(built_api)
+    new_api = built_api.difference(expected_api)
+
+    if missing_api:
+        sys.stderr.write("Missing API (API break!) detected in GObject DOM bindings\n")
+        sys.stderr.write("    %s\n" % "    ".join(missing_api))
+        sys.stderr.flush()
+
+    if new_api:
+        sys.stdout.write("New API detected in GObject DOM bindings\n")
+        sys.stdout.write("    %s\n" % "    ".join(new_api))
+
+    if missing_api:
+        # This test can give false positives because the GObject
+        # DOM bindings API varies depending on the compilation options.
+        # So this shouldn't be made fatal until we figure out a way to handle it.
+        # See https://bugs.webkit.org/show_bug.cgi?id=121481
+        sys.stderr.write("Re-add the missing API and rerun the %s.\n" % __file__)
+        return 0
+
+    if new_api:
+        if options.reset_results:
+            sys.stdout.write("Resetting expected API\n")
+            write_expected_api(built_api)
+        else:
+            sys.stdout.write("API compatible changes found in GObject DOM bindings.\n")
+            sys.stdout.write("To update the symbols file, run %s --reset-results.\n" % __file__)
+
+    return 0
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description='Detect API breakage in the WebKitGTK+ GObject DOM bindings.')
+    parser.add_argument('--reset-results', action='',
+                        help='When specified, rest the expected results file with the built results.')
+    options = parser.parse_args()
+    sys.exit(check_api(options, read_expected_api(), read_built_api()))
Property changes on: releases/WebKitGTK/webkit-2.4/Tools/gtk/check-for-webkitdom-api-breaks
___________________________________________________________________

Added: svn:executable

Deleted: releases/WebKitGTK/webkit-2.4/Tools/gtk/check-gdom-symbols (168711 => 168712)


--- releases/WebKitGTK/webkit-2.4/Tools/gtk/check-gdom-symbols	2014-05-13 19:29:34 UTC (rev 168711)
+++ releases/WebKitGTK/webkit-2.4/Tools/gtk/check-gdom-symbols	2014-05-13 19:29:57 UTC (rev 168712)
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2013 Gustavo Noronha Silva <g...@gnome.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-import common
-import glob
-import os
-import subprocess
-import sys
-import tempfile
-
-def should_update_symbols_file(new, old):
-    if not os.path.exists(old):
-        return False
-
-    new = open(new).read()
-    old = open(old).read()
-
-    if len(new) != len(old):
-        return False
-
-    for i, byte in enumerate(new):
-        if byte != old[i]:
-            return False
-
-    return True
-
-if __name__ == '__main__':
-    with tempfile.NamedTemporaryFile() as tmp:
-        for file_path in glob.glob(os.path.join(common.build_path('DerivedSources'), 'webkitdom', '*.h')):
-            if not os.path.basename(file_path).startswith('WebKit') or file_path.endswith('Private.h'):
-                continue
-
-            file_path = file_path.replace('.h', '.symbols')
-            with open(file_path) as file_handle:
-                tmp.write(file_handle.read())
-        tmp.flush()
-
-        gdom_source_path = common.top_level_path('Source', 'WebCore', 'bindings')
-        api_break_test_path = os.path.join(gdom_source_path, 'scripts', 'gobject-run-api-break-test')
-        subprocess.call([sys.executable, api_break_test_path, os.path.join(gdom_source_path, 'gobject',  'webkitdom.symbols'), tmp.name])
-
-        generated_gdom_symbols_path = os.path.join(common.build_path('DerivedSources'), 'webkitdom', 'webkitdom.symbols')
-        if not should_update_symbols_file(tmp.name, generated_gdom_symbols_path):
-            source = open(tmp.name, 'r')
-            destination = open(generated_gdom_symbols_path, 'w')
-            destination.write(source.read())
-            destination.close()
-            source.close()

Added: releases/WebKitGTK/webkit-2.4/Tools/gtk/webkitdom.py (0 => 168712)


--- releases/WebKitGTK/webkit-2.4/Tools/gtk/webkitdom.py	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.4/Tools/gtk/webkitdom.py	2014-05-13 19:29:57 UTC (rev 168712)
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# Copyright (C) 2013 Igalia S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301  USA
+
+import common
+import os
+import sys
+
+from ConfigParser import SafeConfigParser
+
+
+def header_name_list_from_gtkdoc_config_file():
+    config_file = common.build_path('gtkdoc-webkitdom.cfg')
+    if not os.path.isfile(config_file):
+        sys.stderr.write("Could not find config file at %s\n" % config_file)
+        return sys.exit(1)
+
+    config = SafeConfigParser()
+    config.read(config_file)
+    module_name = config.sections()[0]
+    return [os.path.basename(f) for f in str(config.get(module_name, 'headers')).replace(';', ' ').split()]
+
+
+def get_all_webkitdom_symbol_files():
+    static_symbol_files_path = common.top_level_path('Source', 'WebCore', 'bindings', 'gobject')
+    generated_symbol_files_path = common.build_path('DerivedSources', 'webkitdom')
+
+    symbol_files = []
+    for header_name in header_name_list_from_gtkdoc_config_file():
+        # webkitdomdefines.h doesn't have a corresponding symbols file and webkitdom.symbols is a
+        # file containing the expected symbols results.
+        if header_name in ("webkitdom.h", "webkitdomdefines.h"):
+            continue
+
+        symbol_file = header_name.replace(".h", ".symbols")
+        path = os.path.join(static_symbol_files_path, symbol_file)
+        if os.path.exists(path):
+            symbol_files.append(path)
+            continue
+        path = os.path.join(generated_symbol_files_path, symbol_file)
+        if os.path.exists(path):
+            symbol_files.append(path)
+            continue
+        sys.stderr.write("Could not find symbol file for header: %s\n" % header_name)
+        sys.exit(1)
+
+    return symbol_files
Property changes on: releases/WebKitGTK/webkit-2.4/Tools/gtk/webkitdom.py
___________________________________________________________________

Added: svn:executable

_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to