Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: build/android/create_native_libraries_java.py

Issue 12939021: Make the build control what library(/ies) to load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@antpy
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
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('--template', help='Path to the .java template file')
19 parser.add_option('--output', help='Path to generated .java file')
20 parser.add_option('--ordered-libraries',
21 help='Path to json file containing list of ordered libraries')
22 parser.add_option('--stamp', help='Path to touch on success')
bulach 2013/03/26 19:02:15 see below, I think we can simplify and make this a
23
24 # args should be the list of libraries in dependency order.
25 options, _ = parser.parse_args()
26
27 build_utils.MakeDirectory(os.path.dirname(options.output))
28
29 with open(options.ordered_libraries, 'r') as libfile:
30 libraries = json.load(libfile)
31 # Generates string of the form '= { "base", "net",
32 # "content_shell_content_view" }' from a list of the form ["libbase.so",
33 # libnet.so", "libcontent_shell_content_view.so"]
34 libraries = ['"' + lib[3:-3] + '"' for lib in libraries]
35 array = '= { ' + ', '.join(libraries) + '}';
36
37 with open(options.template, 'r') as template:
38 with open(options.output, 'w') as output:
39 for line in template.readlines():
40 # The template contains a line of the form:
41 # static String[] libraries /*****/;
42 output.write(line.replace('/*****/', array))
43
44 if options.stamp:
45 build_utils.Touch(options.stamp)
46
47
48 if __name__ == '__main__':
49 sys.exit(main(sys.argv))
50
51
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698