diff options
-rwxr-xr-x | webkit/build/concatenate_js_files.py | 39 | ||||
-rw-r--r-- | webkit/webkit.gyp | 13 |
2 files changed, 36 insertions, 16 deletions
diff --git a/webkit/build/concatenate_js_files.py b/webkit/build/concatenate_js_files.py index bc96de3..f371c8d 100755 --- a/webkit/build/concatenate_js_files.py +++ b/webkit/build/concatenate_js_files.py @@ -26,31 +26,44 @@ class OrderedJSFilesExtractor(HTMLParser): 'src' in attrs_dict): self.ordered_js_files.append(attrs_dict['src']) +class PathExpander: + + def __init__(self, paths): + self.paths = paths; + + def expand(self, filename): + last_path = None + expanded_name = None + for path in self.paths: + fname = "%s/%s" % (path, filename) + if (os.access(fname, os.F_OK)): + if (last_path != None): + raise Exception('Ambiguous file %s: found in %s and %s' % + (filename, last_path, path)) + expanded_name = fname + last_path = path + return expanded_name + def main(argv): if len(argv) < 3: - print('usage: %s order.html input_file_1 input_file_2 ... ' + print('usage: %s order.html input_source_dir_1 input_source_dir_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() - - full_paths = {} - for full_path in argv[2:]: - file_name = os.path.basename(full_path) - if file_name.endswith('.js'): - full_paths[file_name] = full_path - extractor = OrderedJSFilesExtractor(argv[1]) + expander = PathExpander(argv[2:]) output = StringIO() for input_file_name in extractor.ordered_js_files: - if not input_file_name in full_paths: - print('A full path to %s isn\'t specified in command line. ' - 'Probably, you have an obsolete script entry in %s' % - (input_file_name, argv[1])) + full_path = expander.expand(input_file_name) + if (full_path is None): + raise Exception('File %s referenced in %s not found on any source paths, ' + 'check source tree for consistency' % + (input_file_name, input_file_name)) output.write('/* %s */\n\n' % input_file_name) - input_file = open(full_paths[input_file_name], 'r') + input_file = open(full_path, 'r') output.write(input_file.read()) output.write('\n') input_file.close() diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index 5fa7bae..8fefc9f 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -108,16 +108,23 @@ 'actions': [ { 'action_name': 'concatenate_devtools_js', + 'script_name': 'build/concatenate_js_files.py', + 'input_page': '<(PRODUCT_DIR)/resources/inspector/devtools.html', 'inputs': [ - 'build/concatenate_js_files.py', - '<(PRODUCT_DIR)/resources/inspector/devtools.html', + '<@(_script_name)', + '<@(_input_page)', '<@(webinspector_files)', '<@(devtools_files)', ], + 'search_path': [ + '../third_party/WebKit/WebCore/inspector/front-end', + '../third_party/WebKit/WebKit/chromium/src/js', + '../v8/tools', + ], 'outputs': [ '<(PRODUCT_DIR)/resources/inspector/DevTools.js', ], - 'action': ['python', '<@(_inputs)', '<@(_outputs)'], + 'action': ['python', '<@(_script_name)', '<@(_input_page)', '<@(_search_path)', '<@(_outputs)'], }, ], }, |