[GTK] generate-inspector-gresource-manifest.py should receive the list of files from...
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Sep 2014 09:21:16 +0000 (09:21 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Sep 2014 09:21:16 +0000 (09:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136943

Reviewed by Philippe Normand.

Source/WebKit2:

* PlatformGTK.cmake: Fix the inspector file list and pass it to
the generate-inspector-gresource-manifest.py script.

Tools:

Update the script to receive the list of files from the command
line instead of scanning the given directories.

* gtk/generate-inspector-gresource-manifest.py:
(get_filenames): Convert filenames to use relative paths.
(find_all_files_in_directory): Deleted.
(find_all_files_in_directory.select_file): Deleted.

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

Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Tools/ChangeLog
Tools/gtk/generate-inspector-gresource-manifest.py

index 4449052..c13d0f0 100644 (file)
@@ -1,3 +1,13 @@
+2014-09-19  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] generate-inspector-gresource-manifest.py should receive the list of files from the makefile
+        https://bugs.webkit.org/show_bug.cgi?id=136943
+
+        Reviewed by Philippe Normand.
+
+        * PlatformGTK.cmake: Fix the inspector file list and pass it to
+        the generate-inspector-gresource-manifest.py script.
+
 2014-09-18  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Dot not allow to create delete-on-destroy GMainLoopSources
index 72da7bb..5fa04cd 100644 (file)
@@ -372,12 +372,13 @@ set(WebKit2WebExtension_INSTALLED_HEADERS
 )
 
 file(GLOB InspectorFiles
-    ${CMAKE_SOURCE_DIR}/Source/Localizations/en.lproj/localizedStrings.js
+    ${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/External/CodeMirror/*
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.css
+    ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.js
     ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Models/*.js
     ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Protocol/*.js
     ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.css
@@ -496,7 +497,7 @@ 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 --output=${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}
+    COMMAND ${TOOLS_DIR}/gtk/generate-inspector-gresource-manifest.py --output=${DERIVED_SOURCES_WEBKIT2GTK_DIR}/InspectorGResourceBundle.xml ${InspectorFiles}
     VERBATIM
 )
 
index 0d0c359..18de5d9 100644 (file)
@@ -1,3 +1,18 @@
+2014-09-19  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] generate-inspector-gresource-manifest.py should receive the list of files from the makefile
+        https://bugs.webkit.org/show_bug.cgi?id=136943
+
+        Reviewed by Philippe Normand.
+
+        Update the script to receive the list of files from the command
+        line instead of scanning the given directories.
+
+        * gtk/generate-inspector-gresource-manifest.py:
+        (get_filenames): Convert filenames to use relative paths.
+        (find_all_files_in_directory): Deleted.
+        (find_all_files_in_directory.select_file): Deleted.
+
 2014-09-18  Tanay C  <tanay.c@samsung.com>
 
         [EFL][WK2] Minibrowser : Support Zoom on Control key + scroll
index c035e68..68af377 100755 (executable)
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 import argparse
-import glob
 import os
 import sys
 
-ALLOWED_EXTENSIONS = ['.html', '.js', '.css', '.png', '.svg']
 COMPRESSIBLE_EXTENSIONS = ['.html', '.js', '.css', '.svg']
+BASE_DIR = 'WebInspectorUI/'
 
 
-def find_all_files_in_directory(directory):
-    directory = os.path.abspath(directory) + os.path.sep
-    to_return = []
+def get_filenames(args):
+    filenames = []
 
-    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
+    for filename in args:
+        base_dir_index = filename.rfind(BASE_DIR)
+        if base_dir_index != -1:
+            filenames.append(filename[base_dir_index + len(BASE_DIR):])
+    return filenames
 
 
 def is_compressible(filename):
@@ -48,25 +41,26 @@ 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')
 
-    arguments, extra_args = parser.parse_known_args(sys.argv)
+    args = parser.parse_args(sys.argv[1:])
 
-    arguments.output.write(\
+    args.output.write(\
     """<?xml version=1.0 encoding=UTF-8?>
     <gresources>
         <gresource prefix="/org/webkitgtk/inspector">
 """)
 
-    for directory in extra_args[1:]:
-        for filename in find_all_files_in_directory(directory):
-            line = '            <file'
-            if is_compressible(filename):
-                line += ' compressed="true"'
-            line += '>%s</file>\n' % filename
+    for filename in get_filenames(args.filenames):
+        line = '            <file'
+        if is_compressible(filename):
+            line += ' compressed="true"'
+        line += '>%s</file>\n' % filename
 
-            arguments.output.write(line)
+        args.output.write(line)
 
-    arguments.output.write(\
+    args.output.write(\
     """    </gresource>
 </gresources>
 """)