Changeset 85071 in webkit


Ignore:
Timestamp:
Apr 27, 2011 11:58:07 AM (13 years ago)
Author:
tony@chromium.org
Message:

2011-04-27 Tony Chang <tony@chromium.org>

Reviewed by Ojan Vafai.

[chromium] add a build target to make a zip file with the inspector debug files
https://bugs.webkit.org/show_bug.cgi?id=56656

  • WebKit.gyp: Add target
  • scripts/concatenate_css_files.py: Pass in a string of html rather

than a filename

  • scripts/concatenate_js_files.py: Same as above
  • scripts/generate_devtools_html.py: Refactor main into a helper function
  • scripts/generate_devtools_zip.py: Added.
Location:
trunk/Source/WebKit/chromium
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r85030 r85071  
     12011-04-27  Tony Chang  <tony@chromium.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        [chromium] add a build target to make a zip file with the inspector debug files
     6        https://bugs.webkit.org/show_bug.cgi?id=56656
     7
     8        * WebKit.gyp: Add target
     9        * scripts/concatenate_css_files.py: Pass in a string of html rather
     10            than a filename
     11        * scripts/concatenate_js_files.py: Same as above
     12        * scripts/generate_devtools_html.py: Refactor main into a helper function
     13        * scripts/generate_devtools_zip.py: Added.
     14
    1152011-04-27  Mihai Parparita  <mihaip@chromium.org>
    216
  • trunk/Source/WebKit/chromium/WebKit.gyp

    r85001 r85071  
    812812        },
    813813        {
     814            'target_name': 'generate_devtools_zip',
     815            'type': 'none',
     816            'dependencies': [
     817                '../../WebCore/WebCore.gyp/WebCore.gyp:inspector_protocol_sources',
     818            ],
     819            'actions': [{
     820                'action_name': 'generate_devtools_zip',
     821                'script_name': 'scripts/generate_devtools_zip.py',
     822                'inspector_html': '../../WebCore/inspector/front-end/inspector.html',
     823                'inputs': [
     824                    '<@(_script_name)',
     825                    'scripts/generate_devtools_html.py',
     826                    '<@(_inspector_html)',
     827                    '<@(devtools_files)',
     828                    '<@(webinspector_files)',
     829                    '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js',
     830                    '<@(webinspector_image_files)',
     831                    '<@(devtools_image_files)',
     832                ],
     833                'search_path': [
     834                    '../../WebCore/inspector/front-end',
     835                    'src/js',
     836                    '<(SHARED_INTERMEDIATE_DIR)/webcore',
     837                ],
     838                'image_search_path': [
     839                    '../../WebCore/inspector/front-end/Images',
     840                    'src/js/Images',
     841                ],
     842                'outputs': ['<(PRODUCT_DIR)/devtools_frontend.zip'],
     843                'action': ['python', '<@(_script_name)', '<@(_inspector_html)',
     844                                     '--devtools-files', '<@(devtools_files)',
     845                                     '--search-path', '<@(_search_path)',
     846                                     '--image-search-path', '<@(_image_search_path)',
     847                                     '--output', '<@(_outputs)'],
     848            }],
     849        },
     850        {
    814851            'target_name': 'webkit_unit_tests',
    815852            'type': 'executable',
  • trunk/Source/WebKit/chromium/scripts/concatenate_css_files.py

    r72112 r85071  
    3333# using <link> tags in a given 'order.html' file.
    3434
     35from __future__ import with_statement
     36
    3537from HTMLParser import HTMLParser
    3638from cStringIO import StringIO
     
    4143class OrderedCSSFilesExtractor(HTMLParser):
    4244
    43     def __init__(self, order_html_name):
     45    def __init__(self, order_html):
    4446        HTMLParser.__init__(self)
    4547        self.ordered_css_files = []
    46         order_html = open(order_html_name, 'r')
    47         self.feed(order_html.read())
     48        self.feed(order_html)
    4849
    4950    def handle_starttag(self, tag, attrs):
     
    8384    output_file_name = argv.pop()
    8485    input_order_file_name = argv[1]
    85     extractor = OrderedCSSFilesExtractor(input_order_file_name)
     86    with open(input_order_file_name, 'r') as order_html:
     87        extractor = OrderedCSSFilesExtractor(order_html.read())
    8688    # Unconditionally append devTools.css. It will contain concatenated files.
    8789    extractor.ordered_css_files.append('devTools.css')
  • trunk/Source/WebKit/chromium/scripts/concatenate_js_files.py

    r72285 r85071  
    3333# using <script> tags in a given 'order.html' file.
    3434
     35from __future__ import with_statement
     36
    3537from HTMLParser import HTMLParser
    3638from cStringIO import StringIO
     
    4345class OrderedJSFilesExtractor(HTMLParser):
    4446
    45     def __init__(self, order_html_name):
     47    def __init__(self, order_html):
    4648        HTMLParser.__init__(self)
    4749        self.ordered_js_files = []
    48         order_html = open(order_html_name, 'r')
    49         self.feed(order_html.read())
     50        self.feed(order_html)
    5051
    5152    def handle_starttag(self, tag, attrs):
     
    8485    output_file_name = argv.pop()
    8586    input_order_file_name = argv[1]
    86     extractor = OrderedJSFilesExtractor(input_order_file_name)
     87    with open(input_order_file_name, 'r') as order_html:
     88        extractor = OrderedJSFilesExtractor(order_html.read())
    8789    extractor.ordered_js_files.append('DevTools.js')
    8890    extractor.ordered_js_files.append('Tests.js')
  • trunk/Source/WebKit/chromium/scripts/generate_devtools_html.py

    r81614 r85071  
    3434
    3535
    36 def GenerateIncludeTag(resource_path):
     36def generate_include_tag(resource_path):
    3737    (dir_name, file_name) = os.path.split(resource_path)
    3838    if (file_name.endswith('.js')):
     
    4242    else:
    4343        assert resource_path
     44
     45
     46def write_devtools_html(inspector_file, devtools_file, debug, debug_files):
     47    for line in inspector_file:
     48        if not debug and '<script ' in line:
     49            continue
     50        if not debug and '<link ' in line:
     51            continue
     52        if '</head>' in line:
     53            if debug:
     54                for resource in debug_files:
     55                    devtools_file.write(generate_include_tag(resource))
     56            else:
     57                devtools_file.write(generate_include_tag("devTools.css"))
     58                devtools_file.write(generate_include_tag("DevTools.js"))
     59        devtools_file.write(line)
    4460
    4561
     
    6076    devtools_html = open(devtools_html_name, 'w')
    6177
    62     for line in inspector_html:
    63         if not debug and '<script ' in line:
    64             continue
    65         if not debug and '<link ' in line:
    66             continue
    67         if '</head>' in line:
    68             if debug:
    69                 for resource in argv[4:]:
    70                     devtools_html.write(GenerateIncludeTag(resource))
    71             else:
    72                 devtools_html.write(GenerateIncludeTag("devTools.css"))
    73                 devtools_html.write(GenerateIncludeTag("DevTools.js"))
    74         devtools_html.write(line)
     78    write_devtools_html(inspector_html, devtools_html, debug, argv[4:])
    7579
    7680    devtools_html.close()
Note: See TracChangeset for help on using the changeset viewer.