Chromium Code Reviews| Index: third_party/closure_compiler/js_library.py |
| diff --git a/third_party/closure_compiler/js_library.py b/third_party/closure_compiler/js_library.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8a24d900b582cbcd1736804ee03fad728110b2f7 |
| --- /dev/null |
| +++ b/third_party/closure_compiler/js_library.py |
| @@ -0,0 +1,32 @@ |
| +# Copyright 2017 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. |
| +"""Generates a file describing the js_library to be used by js_binary action. |
| + |
| +This script takes in a list of sources and dependencies as described by a |
| +js_library action. It creates a file listing the sources and dependencies |
| +that can later be used by a js_binary action to compile the javascript. |
| +""" |
| + |
| +from argparse import ArgumentParser |
| +import sys |
| + |
| +def main(): |
| + parser = ArgumentParser() |
| + parser.add_argument('-s', '--sources', nargs='*', default = [], |
| + help='List of js source files') |
| + parser.add_argument('-o', '--output', help='Write list to output') |
| + parser.add_argument('-d', '--deps', nargs='*', default = [], |
| + help='List of js_library dependencies') |
| + args = parser.parse_args() |
| + |
| + with open(args.output, 'w') as out: |
| + out.write('sources:\n') |
|
Dan Beam
2017/04/18 02:05:50
could this be:
out.write('sources:\n%s\ndeps:%s'
damargulis
2017/04/19 00:42:13
Done.
|
| + for s in args.sources: |
| + out.write(s + '\n') |
| + out.write('deps:\n') |
| + for d in args.deps: |
| + out.write(d + '\n') |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |
|
Dan Beam
2017/04/18 02:05:50
i don't see a reason to do this sys.exit() nor to
damargulis
2017/04/19 00:42:13
Done.
|