[GTK][WPE] Build inspector resources using copy-user-interface-resources.pl script
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Nov 2017 07:23:38 +0000 (07:23 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Nov 2017 07:23:38 +0000 (07:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179317

Reviewed by Michael Catanzaro.

Source/WebKit:

This is the script used by Apple and it has several advantages:

  - It allows to combine and minify most of the js and css files, which improves performance and binary size.
  - It removes the debug resources and assertions in production builds.
  - It allows to remove the test resources in production builds.

The patch also moves the common cmake code to generate the resources to a new file InspectorGResources.cmake included
by GTK+ and WPE platform cmake files.

* InspectorGResources.cmake: Added.
* PlatformGTK.cmake:
* PlatformWPE.cmake:

Tools:

Move generate-inspector-gresource-manifest.py to glib dir to be shared by GTK+ and WPE ports and update it to
receive an input directory instead of a list of patterns.
File::Copy::Recursive is required by copy-user-interface-resources.pl, so make sure it's installed.

* glib/generate-inspector-gresource-manifest.py: Renamed from Tools/gtk/generate-inspector-gresource-manifest.py.
(get_filenames):
(get_filenames.should_ignore_resource):
* gtk/install-dependencies:
* wpe/generate-inspector-gresource-manifest.py: Removed.
* wpe/install-dependencies:

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

Source/WebKit/ChangeLog
Source/WebKit/InspectorGResources.cmake [new file with mode: 0644]
Source/WebKit/PlatformGTK.cmake
Source/WebKit/PlatformWPE.cmake
Tools/ChangeLog
Tools/glib/generate-inspector-gresource-manifest.py [moved from Tools/gtk/generate-inspector-gresource-manifest.py with 59% similarity]
Tools/gtk/install-dependencies
Tools/wpe/generate-inspector-gresource-manifest.py [deleted file]
Tools/wpe/install-dependencies

index dd410f2..8248707 100644 (file)
@@ -1,3 +1,23 @@
+2017-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK][WPE] Build inspector resources using copy-user-interface-resources.pl script
+        https://bugs.webkit.org/show_bug.cgi?id=179317
+
+        Reviewed by Michael Catanzaro.
+
+        This is the script used by Apple and it has several advantages:
+
+          - It allows to combine and minify most of the js and css files, which improves performance and binary size.
+          - It removes the debug resources and assertions in production builds.
+          - It allows to remove the test resources in production builds.
+
+        The patch also moves the common cmake code to generate the resources to a new file InspectorGResources.cmake included
+        by GTK+ and WPE platform cmake files.
+
+        * InspectorGResources.cmake: Added.
+        * PlatformGTK.cmake:
+        * PlatformWPE.cmake:
+
 2017-11-07  Jeremy Jones  <jeremyj@apple.com>
 
         Add downcast support for FullscreenClient.
diff --git a/Source/WebKit/InspectorGResources.cmake b/Source/WebKit/InspectorGResources.cmake
new file mode 100644 (file)
index 0000000..223cd71
--- /dev/null
@@ -0,0 +1,87 @@
+macro(WEBKIT_BUILD_INSPECTOR_GRESOURCES _derived_sources_dir)
+    set(InspectorFiles
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/*.html
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Base/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.css
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.css
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.css
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/ESLint/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/Esprima/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/three.js/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Models/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Protocol/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Proxies/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Test/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.css
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/Formatter/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/*.js
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/gtk/*.png
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/gtk/*.svg
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
+    )
+
+    file(GLOB InspectorFilesDependencies
+        ${InspectorFiles}
+    )
+
+    set(InspectorResourceScripts
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/combine-resources.pl
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/fix-worker-imports-for-optimized-builds.pl
+        ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/remove-console-asserts.pl
+        ${JavaScriptCore_SCRIPTS_DIR}/cssmin.py
+        ${JavaScriptCore_SCRIPTS_DIR}/jsmin.py
+    )
+
+    # DerivedSources/JavaScriptCore/inspector/InspectorBackendCommands.js is
+    # expected in DerivedSources/WebInspectorUI/UserInterface/Protocol/.
+    add_custom_command(
+        OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
+        DEPENDS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js
+        COMMAND cp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
+        VERBATIM
+    )
+
+    if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+        set(COMBINE_INSPECTOR_RESOURCES NO)
+        set(COMBINE_TEST_RESOURCES YES)
+    elseif (DEVELOPER_MODE)
+        set(COMBINE_INSPECTOR_RESOURCES YES)
+        set(COMBINE_TEST_RESOURCES YES)
+    else ()
+        set(COMBINE_INSPECTOR_RESOURCES YES)
+        set(COMBINE_TEST_RESOURCES NO)
+    endif ()
+
+    add_custom_command(
+        OUTPUT ${CMAKE_BINARY_DIR}/inspector-resources.stamp
+        DEPENDS ${InspectorFilesDependencies}
+                ${InspectorResourceScripts}
+                ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
+        COMMAND cp ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js ${FORWARDING_HEADERS_DIR}/JavaScriptCore/Scripts
+        COMMAND ${CMAKE_COMMAND} -E env "DERIVED_SOURCES_DIR=${DERIVED_SOURCES_WEBINSPECTORUI_DIR}" "SRCROOT=${CMAKE_SOURCE_DIR}/Source/WebInspectorUI" "JAVASCRIPTCORE_PRIVATE_HEADERS_DIR=${FORWARDING_HEADERS_DIR}/JavaScriptCore/Scripts" "TARGET_BUILD_DIR=${_derived_sources_dir}/InspectorResources" "UNLOCALIZED_RESOURCES_FOLDER_PATH=WebInspectorUI" "COMBINE_INSPECTOR_RESOURCES=${COMBINE_INSPECTOR_RESOURCES}" "COMBINE_TEST_RESOURCES=${COMBINE_TEST_RESOURCES}" ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl
+        COMMAND mkdir -p ${_derived_sources_dir}/InspectorResources/WebInspectorUI/Localizations/en.lproj
+        COMMAND cp ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js ${_derived_sources_dir}/InspectorResources/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
+        COMMAND touch ${CMAKE_BINARY_DIR}/inspector-resources.stamp
+        VERBATIM
+    )
+
+    add_custom_command(
+        OUTPUT ${_derived_sources_dir}/InspectorGResourceBundle.xml
+        DEPENDS ${CMAKE_BINARY_DIR}/inspector-resources.stamp
+                ${TOOLS_DIR}/glib/generate-inspector-gresource-manifest.py
+        COMMAND ${PYTHON_EXECUTABLE} ${TOOLS_DIR}/glib/generate-inspector-gresource-manifest.py --input=${_derived_sources_dir}/InspectorResources --output=${_derived_sources_dir}/InspectorGResourceBundle.xml
+        VERBATIM
+    )
+
+    add_custom_command(
+        OUTPUT ${_derived_sources_dir}/InspectorGResourceBundle.c
+        DEPENDS ${_derived_sources_dir}/InspectorGResourceBundle.xml
+        COMMAND glib-compile-resources --generate --sourcedir=${_derived_sources_dir}/InspectorResources/WebInspectorUI --target=${_derived_sources_dir}/InspectorGResourceBundle.c ${_derived_sources_dir}/InspectorGResourceBundle.xml
+        VERBATIM
+    )
+endmacro()
index 4c2ecff..4e821f5 100644 (file)
@@ -1,3 +1,5 @@
+include(InspectorGResources.cmake)
+
 set(WebKit_OUTPUT_NAME webkit2gtk-${WEBKITGTK_API_VERSION})
 set(WebKit_WebProcess_OUTPUT_NAME WebKitWebProcess)
 set(WebKit_NetworkProcess_OUTPUT_NAME WebKitNetworkProcess)
@@ -720,43 +722,6 @@ set(WebKitDOM_GTKDOC_HEADERS
     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.h
 )
 
-set(InspectorFiles
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/*.html
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Base/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.css
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.css
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.css
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/ESLint/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/Esprima/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/three.js/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Models/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Protocol/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Proxies/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Test/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.css
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/Formatter/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/gtk/*.png
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/gtk/*.svg
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
-)
-
-file(GLOB InspectorFilesDependencies
-    ${InspectorFiles}
-)
-
-# DerivedSources/JavaScriptCore/inspector/InspectorBackendCommands.js is
-# expected in DerivedSources/WebInspectorUI/UserInterface/Protocol/.
-add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
-    DEPENDS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js
-    COMMAND cp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
-)
-
 # This is necessary because of a conflict between the GTK+ API WebKitVersion.h and one generated by WebCore.
 list(INSERT WebKit_INCLUDE_DIRECTORIES 0
     "${FORWARDING_HEADERS_WEBKIT2GTK_DIR}"
@@ -876,21 +841,7 @@ add_custom_command(
     COMMAND glib-mkenums --template ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitEnumTypes.cpp.template ${WebKit2GTK_ENUM_GENERATION_HEADERS} | sed s/web_kit/webkit/ > ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitEnumTypes.cpp
     VERBATIM)
 
-add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml
-    DEPENDS ${InspectorFilesDependencies}
-            ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
-            ${TOOLS_DIR}/gtk/generate-inspector-gresource-manifest.py
-    COMMAND ${PYTHON_EXECUTABLE} ${TOOLS_DIR}/gtk/generate-inspector-gresource-manifest.py --output=${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml ${InspectorFiles} ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
-    VERBATIM
-)
-
-add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.c
-    DEPENDS ${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
-)
+WEBKIT_BUILD_INSPECTOR_GRESOURCES(${DERIVED_SOURCES_WEBKIT2GTK_DIR})
 
 set(WebKitResources
     "        <file alias=\"images/missingImage\">missingImage.png</file>\n"
index 9f2511c..3711dba 100644 (file)
@@ -1,3 +1,5 @@
+include(InspectorGResources.cmake)
+
 set(WebKit_OUTPUT_NAME WPEWebKit)
 set(WebKit_WebProcess_OUTPUT_NAME WPEWebProcess)
 set(WebKit_NetworkProcess_OUTPUT_NAME WPENetworkProcess)
@@ -446,59 +448,7 @@ list(APPEND WebKit_LIBRARIES
     ${WPE_LIBRARIES}
 )
 
-set(InspectorFiles
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/*.html
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Base/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.css
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.css
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.css
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/ESLint/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/Esprima/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/three.js/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/gtk/*.png
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/gtk/*.svg
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Models/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Protocol/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Proxies/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Test/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.css
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/Formatter/*.js
-    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/*.js
-)
-
-file(GLOB InspectorFilesDependencies
-    ${InspectorFiles}
-)
-
-# DerivedSources/JavaScriptCore/inspector/InspectorBackendCommands.js is
-# expected in DerivedSources/WebInspectorUI/UserInterface/Protocol/.
-add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
-    DEPENDS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js
-    COMMAND cp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
-)
-
-add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.xml
-    DEPENDS ${InspectorFilesDependencies}
-            ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
-            ${TOOLS_DIR}/wpe/generate-inspector-gresource-manifest.py
-    COMMAND ${TOOLS_DIR}/wpe/generate-inspector-gresource-manifest.py --output=${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.xml ${InspectorFiles} ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
-    VERBATIM
-)
-
-add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.c
-    DEPENDS ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.xml
-    COMMAND glib-compile-resources --generate --sourcedir=${CMAKE_SOURCE_DIR}/Source/WebInspectorUI --sourcedir=${DERIVED_SOURCES_WEBINSPECTORUI_DIR} --target=${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.c ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.xml
-    VERBATIM
-)
-
+WEBKIT_BUILD_INSPECTOR_GRESOURCES(${DERIVED_SOURCES_WEBINSPECTORUI_DIR})
 list(APPEND WPEWebInspectorResources_DERIVED_SOURCES
     ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/InspectorGResourceBundle.c
 )
index 29c16e1..65eca3c 100644 (file)
@@ -1,3 +1,21 @@
+2017-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK][WPE] Build inspector resources using copy-user-interface-resources.pl script
+        https://bugs.webkit.org/show_bug.cgi?id=179317
+
+        Reviewed by Michael Catanzaro.
+
+        Move generate-inspector-gresource-manifest.py to glib dir to be shared by GTK+ and WPE ports and update it to
+        receive an input directory instead of a list of patterns.
+        File::Copy::Recursive is required by copy-user-interface-resources.pl, so make sure it's installed.
+
+        * glib/generate-inspector-gresource-manifest.py: Renamed from Tools/gtk/generate-inspector-gresource-manifest.py.
+        (get_filenames):
+        (get_filenames.should_ignore_resource):
+        * gtk/install-dependencies:
+        * wpe/generate-inspector-gresource-manifest.py: Removed.
+        * wpe/install-dependencies:
+
 2017-11-07  Don Olmstead  <don.olmstead@sony.com>
 
         Fix webkitpy tests after rev 224549.
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 import argparse
-import glob
 import os
 import sys
 
+VALID_EXTENSIONS = ['.html', '.js', '.css', '.svg', '.png']
 COMPRESSIBLE_EXTENSIONS = ['.html', '.js', '.css', '.svg']
 BASE_DIR = 'WebInspectorUI/'
 
 
-def get_filenames(args):
+def get_filenames(directory):
     filenames = []
 
-    for pattern in args:
-        paths = sorted(glob.glob(pattern))
-        for filename in paths:
+    def should_ignore_resource(resource):
+        if resource.startswith('Images') and 'gtk' not in resource:
+            return True
+        if resource.startswith(os.path.join('Protocol', 'Legacy')):
+            return True
+        if os.path.splitext(resource)[1] not in VALID_EXTENSIONS:
+            return True
+
+    for root, dirs, files in os.walk(directory):
+        for file in files:
+            filename = os.path.join(root, file)
             base_dir_index = filename.rfind(BASE_DIR)
-            if base_dir_index != -1:
-                name = filename[base_dir_index + len(BASE_DIR):]
-                # The result should use forward slashes, thus make sure any os-specific
-                # separator, added by the glob.glob() call, is properly replaced
-                if os.sep != '/':
-                    name = name.replace(os.sep, '/')
+            if base_dir_index == -1:
+                continue
+
+            name = filename[base_dir_index + len(BASE_DIR):]
+            # The result should use forward slashes, thus make sure any os-specific
+            # separator, is properly replaced
+            if os.sep != '/':
+                name = name.replace(os.sep, '/')
+            if not should_ignore_resource(name):
                 filenames.append(name)
+
     return filenames
 
 
@@ -47,10 +59,10 @@ def is_compressible(filename):
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(description='Generate a GResources file for the inspector.')
+    parser.add_argument('--input', type=str,
+                        help='the input directory')
     parser.add_argument('--output', nargs='?', type=argparse.FileType('w'), default=sys.stdout,
                         help='the output file')
-    parser.add_argument('filenames', metavar='FILES', nargs='+',
-                        help='the list of files to include')
 
     args = parser.parse_args(sys.argv[1:])
 
@@ -60,12 +72,15 @@ if __name__ == "__main__":
         <gresource prefix="/org/webkitgtk/inspector">
 """)
 
-    for filename in get_filenames(args.filenames):
+    for filename in get_filenames(args.input):
         line = '            <file'
         if is_compressible(filename):
             line += ' compressed="true"'
-        if 'Images/gtk/' in filename:
-            line += ' alias="%s"' % filename.replace('gtk/', '')
+        if not filename.startswith('Localization'):
+            alias = 'UserInterface/' + filename
+            if 'Images/gtk/' in alias:
+                alias = alias.replace('gtk/', '')
+            line += ' alias="%s"' % alias
         line += '>%s</file>\n' % filename
 
         args.output.write(line)
@@ -74,4 +89,3 @@ if __name__ == "__main__":
     """    </gresource>
 </gresources>
 """)
-
index 500bcc6..9ec0078 100755 (executable)
@@ -108,6 +108,7 @@ function installDependenciesWithApt {
         libenchant-dev \
         libfaad-dev \
         libffi-dev \
+        libfile-copy-recursive-perl \
         $(aptIfElse libgcrypt20-dev libgcrypt11-dev) \
         libgirepository1.0-dev \
         libgl1-mesa-dev \
@@ -279,6 +280,7 @@ function installDependenciesWithPacman {
         mpg123 \
         opus \
         pango \
+        perl-file-copy-recursive \
         libgcrypt \
         libnotify \
         libpng \
@@ -435,6 +437,7 @@ function installDependenciesWithDnf {
         opus-devel \
         patch \
         pcre-devel \
+        perl-File-Copy-Recursive \
         perl-JSON-PP \
         perl-Switch \
         perl-Time-HiRes \
diff --git a/Tools/wpe/generate-inspector-gresource-manifest.py b/Tools/wpe/generate-inspector-gresource-manifest.py
deleted file mode 100755 (executable)
index 78f1410..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2014 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 argparse
-import glob
-import os
-import sys
-
-COMPRESSIBLE_EXTENSIONS = ['.html', '.js', '.css', '.svg']
-BASE_DIR = 'WebInspectorUI/'
-
-
-def get_filenames(args):
-    filenames = []
-
-    for pattern in args:
-        paths = glob.glob(pattern)
-        for filename in paths:
-            base_dir_index = filename.rfind(BASE_DIR)
-            if base_dir_index != -1:
-                name = filename[base_dir_index + len(BASE_DIR):]
-                # The result should use forward slashes, thus make sure any os-specific
-                # separator, added by the glob.glob() call, is properly replaced
-                if os.sep != '/':
-                    name = name.replace(os.sep, '/')
-                filenames.append(name)
-    return filenames
-
-
-def is_compressible(filename):
-    return os.path.splitext(filename)[1] in COMPRESSIBLE_EXTENSIONS
-
-
-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')
-    parser.add_argument('filenames', metavar='FILES', nargs='+',
-                        help='the list of files to include')
-
-    args = parser.parse_args(sys.argv[1:])
-
-    args.output.write(\
-    """<?xml version=1.0 encoding=UTF-8?>
-    <gresources>
-        <gresource prefix="/org/wpe/inspector">
-""")
-
-    for filename in get_filenames(args.filenames):
-        line = '            <file'
-        if is_compressible(filename):
-            line += ' compressed="true"'
-        if 'Images/gtk/' in filename:
-            line += ' alias="%s"' % filename.replace('gtk/', '')
-        line += '>%s</file>\n' % filename
-
-        args.output.write(line)
-
-    args.output.write(\
-    """    </gresource>
-</gresources>
-""")
index 3d1fde1..e6c8788 100755 (executable)
@@ -52,7 +52,7 @@ function aptIfElse {
 }
 
 function installDependenciesWithApt {
-    # These are dependencies necessary for building WPE+.
+    # These are dependencies necessary for building WPE.
     packages=" \
         autoconf \
         automake \
@@ -73,6 +73,7 @@ function installDependenciesWithApt {
         libgstreamer-plugins-base1.0-dev \
         libicu-dev \
         libjpeg-dev \
+        libfile-copy-recursive-perl \
         $(aptIfElse libpng-dev libpng12-dev) \
         libsqlite3-dev \
         libtasn1-6-dev \
@@ -132,7 +133,7 @@ function installDependenciesWithApt {
 }
 
 function installDependenciesWithPacman {
-    # These are dependencies necessary for building WebKitGTK+.
+    # These are dependencies necessary for building WPE.
     packages=" \
         autoconf \
         automake \
@@ -165,6 +166,7 @@ function installDependenciesWithPacman {
         make \
         ninja \
         patch \
+        perl-file-copy-recursive \
         pkg-config \
         ruby
         sed \
@@ -247,6 +249,7 @@ function installDependenciesWithDnf {
         libxslt-devel \
         ninja-build \
         patch \
+        perl-File-Copy-Recursive \
         perl-Time-HiRes \
         perl-version \
         ruby \