OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # | |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
joth
2013/04/01 18:46:37
add either a file or main() function comment expla
cjhopman
2013/04/01 20:11:14
Done.
| |
7 import json | |
8 import optparse | |
9 import os | |
10 import sys | |
11 | |
12 from pylib import build_utils | |
13 | |
14 | |
15 def main(argv): | |
16 parser = optparse.OptionParser() | |
17 | |
18 parser.add_option('--output', help='Path to generated .java file') | |
19 parser.add_option('--ordered-libraries', | |
20 help='Path to json file containing list of ordered libraries') | |
21 parser.add_option('--stamp', help='Path to touch on success') | |
22 | |
23 # args should be the list of libraries in dependency order. | |
24 options, _ = parser.parse_args() | |
25 | |
26 build_utils.MakeDirectory(os.path.dirname(options.output)) | |
27 | |
28 with open(options.ordered_libraries, 'r') as libfile: | |
29 libraries = json.load(libfile) | |
30 # Generates string of the form '= { "base", "net", | |
31 # "content_shell_content_view" }' from a list of the form ["libbase.so", | |
32 # libnet.so", "libcontent_shell_content_view.so"] | |
33 libraries = ['"' + lib[3:-3] + '"' for lib in libraries] | |
34 array = '= { ' + ', '.join(libraries) + '}'; | |
35 | |
36 with open(options.output, 'w') as header: | |
37 header.write(array) | |
38 | |
39 if options.stamp: | |
40 build_utils.Touch(options.stamp) | |
41 | |
42 | |
43 if __name__ == '__main__': | |
44 sys.exit(main(sys.argv)) | |
45 | |
46 | |
OLD | NEW |