OLD | NEW |
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 dependency ordered list of native libraries. | 7 """Writes dependency ordered list of native libraries. |
8 | 8 |
9 The list excludes any Android system libraries, as those are not bundled with | 9 The list excludes any Android system libraries, as those are not bundled with |
10 the APK. | 10 the APK. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 | 96 |
97 def main(): | 97 def main(): |
98 parser = optparse.OptionParser() | 98 parser = optparse.OptionParser() |
99 build_utils.AddDepfileOption(parser) | 99 build_utils.AddDepfileOption(parser) |
100 | 100 |
101 parser.add_option('--input-libraries', | 101 parser.add_option('--input-libraries', |
102 help='A list of top-level input libraries.') | 102 help='A list of top-level input libraries.') |
103 parser.add_option('--libraries-dir', | 103 parser.add_option('--libraries-dir', |
104 help='The directory which contains shared libraries.') | 104 help='The directory which contains shared libraries.') |
| 105 parser.add_option('--unpackaged-libraries', |
| 106 help='List of additional libraries to load that are not in the APK.') |
105 parser.add_option('--readelf', help='Path to the readelf binary.') | 107 parser.add_option('--readelf', help='Path to the readelf binary.') |
106 parser.add_option('--output', help='Path to the generated .json file.') | 108 parser.add_option('--output', help='Path to the generated .json file.') |
107 parser.add_option('--stamp', help='Path to touch on success.') | 109 parser.add_option('--stamp', help='Path to touch on success.') |
108 | 110 |
109 options, _ = parser.parse_args(build_utils.ExpandFileArgs(sys.argv[1:])) | 111 options, _ = parser.parse_args(build_utils.ExpandFileArgs(sys.argv[1:])) |
110 | 112 |
111 SetReadelfPath(options.readelf) | 113 SetReadelfPath(options.readelf) |
112 SetLibraryDirs(options.libraries_dir.split(',')) | 114 SetLibraryDirs(options.libraries_dir.split(',')) |
113 | 115 |
114 libraries = build_utils.ParseGnList(options.input_libraries) | 116 libraries = build_utils.ParseGnList(options.input_libraries) |
115 if len(libraries): | 117 if len(libraries): |
116 libraries = GetSortedTransitiveDependenciesForBinaries(libraries) | 118 libraries = GetSortedTransitiveDependenciesForBinaries(libraries) |
| 119 if options.unpackaged_libraries: |
| 120 unpackaged_libraries = build_utils.ParseGnList(options.unpackaged_libraries) |
| 121 else: |
| 122 unpackaged_libraries = [] |
117 | 123 |
118 # Convert to "base" library names: e.g. libfoo.so -> foo | 124 # Convert to "base" library names: e.g. libfoo.so -> foo |
| 125 all_libraries = libraries + unpackaged_libraries |
119 java_libraries_list = ( | 126 java_libraries_list = ( |
120 '{%s}' % ','.join(['"%s"' % s[3:-3] for s in libraries])) | 127 '{%s}' % ','.join(['"%s"' % s[3:-3] for s in all_libraries])) |
121 | 128 |
122 out_json = { | 129 out_json = { |
123 'libraries': libraries, | 130 'libraries': libraries, |
124 'lib_paths': [FullLibraryPath(l) for l in libraries], | 131 'lib_paths': [FullLibraryPath(l) for l in libraries], |
125 'java_libraries_list': java_libraries_list | 132 'java_libraries_list': java_libraries_list |
126 } | 133 } |
127 build_utils.WriteJson( | 134 build_utils.WriteJson( |
128 out_json, | 135 out_json, |
129 options.output, | 136 options.output, |
130 only_if_changed=True) | 137 only_if_changed=True) |
131 | 138 |
132 if options.stamp: | 139 if options.stamp: |
133 build_utils.Touch(options.stamp) | 140 build_utils.Touch(options.stamp) |
134 | 141 |
135 if options.depfile: | 142 if options.depfile: |
136 build_utils.WriteDepfile(options.depfile, options.output, libraries) | 143 build_utils.WriteDepfile(options.depfile, options.output, libraries) |
137 | 144 |
138 | 145 |
139 if __name__ == '__main__': | 146 if __name__ == '__main__': |
140 sys.exit(main()) | 147 sys.exit(main()) |
141 | 148 |
142 | 149 |
OLD | NEW |