Chromium Code Reviews| Index: tools/gypv8sh.py |
| diff --git a/tools/gypv8sh.py b/tools/gypv8sh.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..755ea9b374080f61cd3f0593584d1f086e1e2731 |
| --- /dev/null |
| +++ b/tools/gypv8sh.py |
| @@ -0,0 +1,59 @@ |
| +#!/usr/bin/python |
|
Paweł Hajdan Jr.
2011/06/10 07:38:29
Please make sure someone working more frequently w
|
| +# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| +# |
| +# This script prints out include dependencies in chrome. Since it ignores |
| +# defines, it gives just a rough estimation of file size. |
| +# |
| +# Usage: |
| +# python tools/gypv8sh.py chrome/browser/ui/webui/javascript2webui.js |
| +# python tools/gypv8sh.py -t # print test_harnesses |
| +# python tools/gypv8sh.py -i # print inputs |
| +# python tools/gypv8sh.py -o # print outputs |
| +import json |
| +import sys |
| +import tempfile |
| +import os |
| +import subprocess |
| +import getopt |
| + |
| +rules = [ |
| + [ |
| + 'WebUIBrowserTest', |
| + 'test/data/webui/sample_downloads.js', |
| + 'browser/ui/webui/web_ui_browsertest-inl.h', |
| + ], |
| + ] |
| + |
| +opts, args = getopt.getopt(sys.argv[1:], 'tio', ['test_fixture', 'in','out']); |
| +if len(opts): |
| + indices = {} |
| + for o, a in opts: |
| + if o in ('-t','--test_fixture'): |
| + indices[0] = 1; |
| + elif o in ('-i', '--in'): |
| + indices[1] = 1; |
| + elif o in ('-o', '--out'): |
| + indices[2] = 1; |
| + |
| + for rule in rules: |
| + for index in sorted(indices.keys()): |
| + print rule[index], |
| +else: |
| + v8_shell = os.path.join( |
| + os.path.dirname(os.path.dirname(sys.argv[0])),'out/Debug/v8_shell') |
| + with tempfile.NamedTemporaryFile() as tmpfile: |
| + jsfilename = args[0] |
| + with open(jsfilename) as jsfile: |
| + jsfile.readline() |
| + for line in jsfile: |
| + tmpfile.write(line) |
| + tmpfile.flush() |
| + for rule in rules: |
| + arguments = [jsfilename] |
| + arguments.extend(rule[:-1]) |
| + arguments = "arguments=" + json.dumps(arguments) |
| + cmd = [v8_shell, '-e', arguments, tmpfile.name] |
| + subprocess.check_call(cmd, stdout=open(rule[2],'w+')) |