Title: [224566] trunk
Revision
224566
Author
carlo...@webkit.org
Date
2017-11-07 23:23:38 -0800 (Tue, 07 Nov 2017)

Log Message

[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.

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:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (224565 => 224566)


--- trunk/Source/WebKit/ChangeLog	2017-11-08 07:10:02 UTC (rev 224565)
+++ trunk/Source/WebKit/ChangeLog	2017-11-08 07:23:38 UTC (rev 224566)
@@ -1,3 +1,23 @@
+2017-11-07  Carlos Garcia Campos  <cgar...@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  <jere...@apple.com>
 
         Add downcast support for FullscreenClient.

Added: trunk/Source/WebKit/InspectorGResources.cmake (0 => 224566)


--- trunk/Source/WebKit/InspectorGResources.cmake	                        (rev 0)
+++ trunk/Source/WebKit/InspectorGResources.cmake	2017-11-08 07:23:38 UTC (rev 224566)
@@ -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
+        ${_javascript_Core_SCRIPTS_DIR}/cssmin.py
+        ${_javascript_Core_SCRIPTS_DIR}/jsmin.py
+    )
+
+    # DerivedSources/_javascript_Core/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}/_javascript_Core/Scripts
+        COMMAND ${CMAKE_COMMAND} -E env "DERIVED_SOURCES_DIR=${DERIVED_SOURCES_WEBINSPECTORUI_DIR}" "SRCROOT=${CMAKE_SOURCE_DIR}/Source/WebInspectorUI" "_javascript_CORE_PRIVATE_HEADERS_DIR=${FORWARDING_HEADERS_DIR}/_javascript_Core/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()

Modified: trunk/Source/WebKit/PlatformGTK.cmake (224565 => 224566)


--- trunk/Source/WebKit/PlatformGTK.cmake	2017-11-08 07:10:02 UTC (rev 224565)
+++ trunk/Source/WebKit/PlatformGTK.cmake	2017-11-08 07:23:38 UTC (rev 224566)
@@ -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 @@
     ${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/_javascript_Core/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,22 +841,8 @@
     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
-)
+WEBKIT_BUILD_INSPECTOR_GRESOURCES(${DERIVED_SOURCES_WEBKIT2GTK_DIR})
 
-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
-)
-
 set(WebKitResources
     "        <file alias=\"images/missingImage\">missingImage.png</file>\n"
     "        <file alias=\"images/missingImage@2x\">missingim...@2x.png</file>\n"

Modified: trunk/Source/WebKit/PlatformWPE.cmake (224565 => 224566)


--- trunk/Source/WebKit/PlatformWPE.cmake	2017-11-08 07:10:02 UTC (rev 224565)
+++ trunk/Source/WebKit/PlatformWPE.cmake	2017-11-08 07:23:38 UTC (rev 224566)
@@ -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 @@
     ${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/_javascript_Core/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
 )

Modified: trunk/Tools/ChangeLog (224565 => 224566)


--- trunk/Tools/ChangeLog	2017-11-08 07:10:02 UTC (rev 224565)
+++ trunk/Tools/ChangeLog	2017-11-08 07:23:38 UTC (rev 224566)
@@ -1,3 +1,21 @@
+2017-11-07  Carlos Garcia Campos  <cgar...@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.olmst...@sony.com>
 
         Fix webkitpy tests after rev 224549.

Copied: trunk/Tools/glib/generate-inspector-gresource-manifest.py (from rev 224565, trunk/Tools/gtk/generate-inspector-gresource-manifest.py) (0 => 224566)


--- trunk/Tools/glib/generate-inspector-gresource-manifest.py	                        (rev 0)
+++ trunk/Tools/glib/generate-inspector-gresource-manifest.py	2017-11-08 07:23:38 UTC (rev 224566)
@@ -0,0 +1,91 @@
+#!/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 argparse
+import os
+import sys
+
+VALID_EXTENSIONS = ['.html', '.js', '.css', '.svg', '.png']
+COMPRESSIBLE_EXTENSIONS = ['.html', '.js', '.css', '.svg']
+BASE_DIR = 'WebInspectorUI/'
+
+
+def get_filenames(directory):
+    filenames = []
+
+    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:
+                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
+
+
+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('--input', type=str,
+                        help='the input directory')
+    parser.add_argument('--output', nargs='?', type=argparse.FileType('w'), default=sys.stdout,
+                        help='the output file')
+
+    args = parser.parse_args(sys.argv[1:])
+
+    args.output.write(\
+    """<?xml version=1.0 encoding=UTF-8?>
+    <gresources>
+        <gresource prefix="/org/webkitgtk/inspector">
+""")
+
+    for filename in get_filenames(args.input):
+        line = '            <file'
+        if is_compressible(filename):
+            line += ' compressed="true"'
+        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)
+
+    args.output.write(\
+    """    </gresource>
+</gresources>
+""")

Deleted: trunk/Tools/gtk/generate-inspector-gresource-manifest.py (224565 => 224566)


--- trunk/Tools/gtk/generate-inspector-gresource-manifest.py	2017-11-08 07:10:02 UTC (rev 224565)
+++ trunk/Tools/gtk/generate-inspector-gresource-manifest.py	2017-11-08 07:23:38 UTC (rev 224566)
@@ -1,77 +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 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 = sorted(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/webkitgtk/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>
-""")
-

Modified: trunk/Tools/gtk/install-dependencies (224565 => 224566)


--- trunk/Tools/gtk/install-dependencies	2017-11-08 07:10:02 UTC (rev 224565)
+++ trunk/Tools/gtk/install-dependencies	2017-11-08 07:23:38 UTC (rev 224566)
@@ -108,6 +108,7 @@
         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 @@
         mpg123 \
         opus \
         pango \
+        perl-file-copy-recursive \
         libgcrypt \
         libnotify \
         libpng \
@@ -435,6 +437,7 @@
         opus-devel \
         patch \
         pcre-devel \
+        perl-File-Copy-Recursive \
         perl-JSON-PP \
         perl-Switch \
         perl-Time-HiRes \

Deleted: trunk/Tools/wpe/generate-inspector-gresource-manifest.py (224565 => 224566)


--- trunk/Tools/wpe/generate-inspector-gresource-manifest.py	2017-11-08 07:10:02 UTC (rev 224565)
+++ trunk/Tools/wpe/generate-inspector-gresource-manifest.py	2017-11-08 07:23:38 UTC (rev 224566)
@@ -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>
-""")

Modified: trunk/Tools/wpe/install-dependencies (224565 => 224566)


--- trunk/Tools/wpe/install-dependencies	2017-11-08 07:10:02 UTC (rev 224565)
+++ trunk/Tools/wpe/install-dependencies	2017-11-08 07:23:38 UTC (rev 224566)
@@ -52,7 +52,7 @@
 }
 
 function installDependenciesWithApt {
-    # These are dependencies necessary for building WPE+.
+    # These are dependencies necessary for building WPE.
     packages=" \
         autoconf \
         automake \
@@ -73,6 +73,7 @@
         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 installDependenciesWithPacman {
-    # These are dependencies necessary for building WebKitGTK+.
+    # These are dependencies necessary for building WPE.
     packages=" \
         autoconf \
         automake \
@@ -165,6 +166,7 @@
         make \
         ninja \
         patch \
+        perl-file-copy-recursive \
         pkg-config \
         ruby
         sed \
@@ -247,6 +249,7 @@
         libxslt-devel \
         ninja-build \
         patch \
+        perl-File-Copy-Recursive \
         perl-Time-HiRes \
         perl-version \
         ruby \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to