REGRESSION(r165704): [GTK] Inspector resources not correctly generated
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Apr 2014 15:38:40 +0000 (15:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Apr 2014 15:38:40 +0000 (15:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130343

Patch by Martin Robinson <mrobinson@igalia.com> on 2014-04-02
Reviewed by Gustavo Noronha Silva.

.:

* CMakeLists.txt: Add a variable which points to the directory to store WebInspectorUI
derived sources.
* Source/cmake/WebKitFS.cmake: Generate WebInspectorUI derived sources directories.

Source/JavaScriptCore:

* CMakeLists.txt: We generate the inspector JavaScript file into a directory like the one
in which it should be distributed. This allows us to more easily package it for GTK+.

Source/WebCore:

* CMakeLists.txt: Generate the web inspector JS file into the new WebInspectorUI derived sources
directory.

Source/WebKit2:

* PlatformGTK.cmake: Pass all appropriate directories to the
GResources XML generation script.

Tools:

* gtk/generate-inspector-gresource-manifest.py: Instead of hard-coding the file list, accept a list
of directories on the command line and look for all appropriate files in those directories for the
GResource archive. Also make archive paths relative to those directories.
(find_all_files_in_directory): This helper looks for all the appropriate files in a given directory.
(find_all_files_in_directory.select_file): Whether or not to add the file to the archive.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166648 268f45cc-cd09-0410-ab3c-d52691b4dbfc

CMakeLists.txt
ChangeLog
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/cmake/WebKitFS.cmake
Tools/ChangeLog
Tools/gtk/generate-inspector-gresource-manifest.py

index aa3579d..ae313e9 100644 (file)
@@ -19,6 +19,7 @@ set(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaS
 set(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
 set(DERIVED_SOURCES_WEBKIT_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit")
 set(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
+set(DERIVED_SOURCES_WEBINSPECTORUI_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebInspectorUI")
 
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Source/cmake")
 
index d6960a4..cf4647c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-04-02  Martin Robinson  <mrobinson@igalia.com>
+
+        REGRESSION(r165704): [GTK] Inspector resources not correctly generated
+        https://bugs.webkit.org/show_bug.cgi?id=130343
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * CMakeLists.txt: Add a variable which points to the directory to store WebInspectorUI
+        derived sources.
+        * Source/cmake/WebKitFS.cmake: Generate WebInspectorUI derived sources directories.
+
 2014-04-01  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
 
         [CMake] Drop port check from FindEGL.cmake.
index db3e3fa..3d9320c 100644 (file)
@@ -842,10 +842,17 @@ add_custom_command(
 
 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
 add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSBackendDispatchers.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSBackendDispatchers.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSFrontendDispatchers.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSFrontendDispatchers.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSTypeBuilders.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSTypeBuilders.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSBackendCommands.js
+    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSBackendDispatchers.cpp
+           ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSBackendDispatchers.h
+           ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSFrontendDispatchers.cpp
+           ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSFrontendDispatchers.h
+           ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSTypeBuilders.cpp
+           ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSTypeBuilders.h
+           ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorJSBackendCommands.js
     MAIN_DEPENDENCY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json
-    DEPENDS ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspector.py ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspectorStrings.py
-    COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspector.py ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json --output_h_dir "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}" --output_cpp_dir "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}" --output_js_dir "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}" --output_type JavaScript --write_always && mkdir -p ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector && cp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSBackendDispatchers.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSFrontendDispatchers.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSTypeBuilders.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector
+    DEPENDS ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspector.py
+            ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspectorStrings.py
+    COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspector.py ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json --output_h_dir "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}" --output_cpp_dir "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}" --output_js_dir "${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol" --output_type JavaScript --write_always && mkdir -p ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector && cp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSBackendDispatchers.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSFrontendDispatchers.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSTypeBuilders.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector
     VERBATIM)
 
 # JSCBuiltins
index 3aec628..546ea8f 100644 (file)
@@ -1,3 +1,13 @@
+2014-04-02  Martin Robinson  <mrobinson@igalia.com>
+
+        REGRESSION(r165704): [GTK] Inspector resources not correctly generated
+        https://bugs.webkit.org/show_bug.cgi?id=130343
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * CMakeLists.txt: We generate the inspector JavaScript file into a directory like the one
+        in which it should be distributed. This allows us to more easily package it for GTK+.
+
 2014-04-01  Timothy Hatcher  <timothy@apple.com>
 
         Remove HeapProfiler from the Web Inspector protocol.
index 22b02b5..eee4307 100644 (file)
@@ -3031,10 +3031,19 @@ add_custom_command(
 
 # All Web Inspector generated files are created with this one call to CodeGeneratorInspector.pm
 add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebBackendDispatchers.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebBackendDispatchers.h ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebFrontendDispatchers.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebFrontendDispatchers.h ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebTypeBuilders.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebTypeBuilders.h ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebBackendCommands.js
+    OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebBackendDispatchers.cpp
+           ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebBackendDispatchers.h
+           ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebFrontendDispatchers.cpp
+           ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebFrontendDispatchers.h
+           ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebTypeBuilders.cpp
+           ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebTypeBuilders.h
+           ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorWebBackendCommands.js
     MAIN_DEPENDENCY ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWeb.json
-    DEPENDS ${WebCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspector.py ${WebCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspectorStrings.py ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSTypeBuilders.h
-    COMMAND ${PYTHON_EXECUTABLE} ${WebCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspector.py ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWeb.json ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json --output_h_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --output_cpp_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --output_js_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --output_type Web --write_always
+    DEPENDS ${WebCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspector.py
+            ${WebCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspectorStrings.py
+            ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json
+            ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSTypeBuilders.h
+    COMMAND ${PYTHON_EXECUTABLE} ${WebCore_INSPECTOR_SCRIPTS_DIR}/CodeGeneratorInspector.py ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWeb.json ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json --output_h_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --output_cpp_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --output_js_dir "${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol" --output_type Web --write_always
     VERBATIM)
 
 list(APPEND WebCore_SOURCES
index 2440eba..7d3297a 100644 (file)
@@ -1,3 +1,13 @@
+2014-04-02  Martin Robinson  <mrobinson@igalia.com>
+
+        REGRESSION(r165704): [GTK] Inspector resources not correctly generated
+        https://bugs.webkit.org/show_bug.cgi?id=130343
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * CMakeLists.txt: Generate the web inspector JS file into the new WebInspectorUI derived sources
+        directory.
+
 2014-04-02  Zalan Bujtas  <zalan@apple.com>
 
         Unreviewed build fix after r166642.
index a54c96b..33ff86f 100644 (file)
@@ -1,3 +1,13 @@
+2014-04-02  Martin Robinson  <mrobinson@igalia.com>
+
+        REGRESSION(r165704): [GTK] Inspector resources not correctly generated
+        https://bugs.webkit.org/show_bug.cgi?id=130343
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * PlatformGTK.cmake: Pass all appropriate directories to the
+        GResources XML generation script.
+
 2014-04-02  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Move NEWS file to a new location
index 5dfc68b..88be899 100644 (file)
@@ -15,8 +15,8 @@ add_definitions(-DLIBDIR="${CMAKE_INSTALL_FULL_LIBDIR}")
 set(WebKit2_USE_PREFIX_HEADER ON)
 
 list(APPEND WebKit2_SOURCES
-    ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/WebKit2InspectorGResourceBundle.c
     ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.c
+    ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/WebKit2InspectorGResourceBundle.c
 
     ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitEnumTypes.cpp
     ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitMarshal.cpp
@@ -378,8 +378,8 @@ file(GLOB InspectorFiles
     ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.js
     ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/*.png
     ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/*.svg
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJSBackendCommands.js
-    ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWebBackendCommands.js
+    ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorJSBackendCommands.js
+    ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorWebBackendCommands.js
 )
 
 # This is necessary because of a conflict between the GTK+ API WebKitVersion.h and one generated by WebCore.
@@ -486,15 +486,14 @@ add_custom_command(
     OUTPUT ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml
     DEPENDS ${InspectorFiles}
             ${TOOLS_DIR}/gtk/generate-inspector-gresource-manifest.py
-    COMMAND ${TOOLS_DIR}/gtk/generate-inspector-gresource-manifest.py ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml
+    COMMAND ${TOOLS_DIR}/gtk/generate-inspector-gresource-manifest.py --output=${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}
     VERBATIM
 )
 
 add_custom_command(
     OUTPUT ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.c
     DEPENDS ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml
-            ${InspectorFiles}
-    COMMAND glib-compile-resources --generate --sourcedir=${CMAKE_SOURCE_DIR}/Source/WebInspectorUI --target=${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.c ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml
+    COMMAND glib-compile-resources --generate --sourcedir=${CMAKE_SOURCE_DIR}/Source/WebInspectorUI --sourcedir=${DERIVED_SOURCES_WEBINSPECTORUI_DIR} --target=${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.c ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml
     VERBATIM
 )
 
index 899eaef..c3dbc0d 100644 (file)
@@ -1,6 +1,10 @@
 file(MAKE_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR})
 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Source/JavaScriptCore/runtime)
 
+file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBINSPECTORUI_DIR})
+file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/Protocol)
+file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol)
+
 if (ENABLE_WEBCORE)
     file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBCORE_DIR})
 endif ()
index 8d1f77b..d8c5b0b 100644 (file)
@@ -1,3 +1,16 @@
+2014-04-02  Martin Robinson  <mrobinson@igalia.com>
+
+        REGRESSION(r165704): [GTK] Inspector resources not correctly generated
+        https://bugs.webkit.org/show_bug.cgi?id=130343
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * gtk/generate-inspector-gresource-manifest.py: Instead of hard-coding the file list, accept a list
+        of directories on the command line and look for all appropriate files in those directories for the
+        GResource archive. Also make archive paths relative to those directories.
+        (find_all_files_in_directory): This helper looks for all the appropriate files in a given directory.
+        (find_all_files_in_directory.select_file): Whether or not to add the file to the archive.
+
 2014-04-02  Eva Balazsfalvi  <evab.u-szeged@partner.samsung.com>
 
         [webkitpy] Avoid multiple "Preparing rollout for bug" log messages
index adf4f52..0ab4474 100755 (executable)
 # 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 argparse
 import glob
 import os
 import sys
 
-resources_path = common.top_level_path() + "/Source/WebInspectorUI/"
-inspector_files = \
-    glob.glob(resources_path + 'UserInterface/*.html') + \
-    glob.glob(resources_path + 'UserInterface/Base/*.js') + \
-    glob.glob(resources_path + 'UserInterface/Controllers/*.css') + \
-    glob.glob(resources_path + 'UserInterface/Controllers/*.js') + \
-    glob.glob(resources_path + 'UserInterface/Models/*.js') + \
-    glob.glob(resources_path + 'UserInterface/Protocol/*.js') + \
-    glob.glob(resources_path + 'UserInterface/Views/*.css') + \
-    glob.glob(resources_path + 'UserInterface/Views/*.js') + \
-    glob.glob(resources_path + 'UserInterface/Images/*.png') + \
-    glob.glob(resources_path + 'UserInterface/Images/*.svg') + \
-    glob.glob(resources_path + 'UserInterface/External/CodeMirror/*') + \
-    glob.glob(resources_path + 'Localizations/en.lproj/localizedStrings.js')
-
-gresources_file_content = \
-"""<?xml version=1.0 encoding=UTF-8?>
-<gresources>
-    <gresource prefix="/org/webkitgtk/inspector">
-"""
-
-for file in inspector_files:
-    gresources_file_content += "        <file>" + file.replace(resources_path, '') + "</file>\n"
-
-gresources_file_content += \
-"""    </gresource>
+ALLOWED_EXTENSIONS = ['.html', '.js', '.css', '.png', '.svg']
+
+
+def find_all_files_in_directory(directory):
+    directory = os.path.abspath(directory) + os.path.sep
+    to_return = []
+
+    def select_file(name):
+        return os.path.splitext(name)[1] in ALLOWED_EXTENSIONS
+
+    for root, dirs, files in os.walk(directory):
+        files = filter(select_file, files)
+        for file_name in files:
+            file_name = os.path.abspath(os.path.join(root, file_name))
+            to_return.append(file_name.replace(directory, ''))
+
+    return to_return
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(description='Generate a GResources file for the inspector.')
+    parser.add_argument('--output', nargs='?', type=argparse.FileType('w'), default=sys.stdout,
+                        help='the output file')
+
+    arguments, extra_args = parser.parse_known_args(sys.argv)
+
+    arguments.output.write(\
+    """<?xml version=1.0 encoding=UTF-8?>
+    <gresources>
+        <gresource prefix="/org/webkitgtk/inspector">
+""")
+
+    for directory in extra_args[1:]:
+        for file in find_all_files_in_directory(directory):
+            arguments.output.write("            <file>%s</file>\n" % file)
+
+    arguments.output.write(\
+    """    </gresource>
 </gresources>
-"""
+""")
 
-open(sys.argv[1], 'w').write(gresources_file_content)