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

Side by Side Diff: build/android/gyp/create_native_libraries_header.py

Issue 59533009: Check library version and handle library load errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix BrowserStartupControllerTest Created 7 years 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
« no previous file with comments | « build/android/findbugs_filter/findbugs_exclude.xml ('k') | build/java_apk.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 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 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Writes .h file for NativeLibraries.template 7 """Writes .h files for NativeLibraries.template
8 8
9 This header should contain the list of native libraries to load in the form: 9 The native library list header should contain the list of native libraries to
10 load in the form:
10 = { "lib1", "lib2" } 11 = { "lib1", "lib2" }
12 The version header should contain a version name string of the form
13 = "version_name"
11 """ 14 """
12 15
13 import json 16 import json
14 import optparse 17 import optparse
15 import os 18 import os
16 import sys 19 import sys
17 20
18 from util import build_utils 21 from util import build_utils
19 22
20 23
21 def main(argv): 24 def main(argv):
22 parser = optparse.OptionParser() 25 parser = optparse.OptionParser()
23 26
24 parser.add_option('--output', help='Path to generated .java file') 27 parser.add_option('--native-library-list',
28 help='Path to generated .java file containing library list')
29 parser.add_option('--version-output',
30 help='Path to generated .java file containing version name')
25 parser.add_option('--ordered-libraries', 31 parser.add_option('--ordered-libraries',
26 help='Path to json file containing list of ordered libraries') 32 help='Path to json file containing list of ordered libraries')
27 parser.add_option('--stamp', help='Path to touch on success') 33 parser.add_option('--version-name',
34 help='expected version name of native library')
28 35
29 # args should be the list of libraries in dependency order. 36 # args should be the list of libraries in dependency order.
30 options, _ = parser.parse_args() 37 options, _ = parser.parse_args()
31 38
32 build_utils.MakeDirectory(os.path.dirname(options.output)) 39 build_utils.MakeDirectory(os.path.dirname(options.native_library_list))
33 40
34 with open(options.ordered_libraries, 'r') as libfile: 41 with open(options.ordered_libraries, 'r') as libfile:
35 libraries = json.load(libfile) 42 libraries = json.load(libfile)
36 # Generates string of the form '= { "base", "net", 43 # Generates string of the form '= { "base", "net",
37 # "content_shell_content_view" }' from a list of the form ["libbase.so", 44 # "content_shell_content_view" }' from a list of the form ["libbase.so",
38 # libnet.so", "libcontent_shell_content_view.so"] 45 # libnet.so", "libcontent_shell_content_view.so"]
39 libraries = ['"' + lib[3:-3] + '"' for lib in libraries] 46 libraries = ['"' + lib[3:-3] + '"' for lib in libraries]
40 array = '= { ' + ', '.join(libraries) + '}'; 47 array = '= { ' + ', '.join(libraries) + '}';
41 48
42 with open(options.output, 'w') as header: 49 with open(options.native_library_list, 'w') as header:
43 header.write(array) 50 header.write(array)
44 51
45 if options.stamp: 52 with open(options.version_output, 'w') as header:
46 build_utils.Touch(options.stamp) 53 header.write('= "%s"' % options.version_name)
47
48 54
49 if __name__ == '__main__': 55 if __name__ == '__main__':
50 sys.exit(main(sys.argv)) 56 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/findbugs_filter/findbugs_exclude.xml ('k') | build/java_apk.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698