OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 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 a build_config file. | 7 """Writes a build_config file. |
8 | 8 |
9 The build_config file for a target is a json file containing information about | 9 The build_config file for a target is a json file containing information about |
10 how to build that target based on the target's dependencies. This includes | 10 how to build that target based on the target's dependencies. This includes |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 for path in runtime_deps_files: | 202 for path in runtime_deps_files: |
203 with open(path) as f: | 203 with open(path) as f: |
204 for line in f: | 204 for line in f: |
205 line = line.rstrip() | 205 line = line.rstrip() |
206 if not line.endswith('.so'): | 206 if not line.endswith('.so'): |
207 continue | 207 continue |
208 ret.append(os.path.normpath(line)) | 208 ret.append(os.path.normpath(line)) |
209 ret.reverse() | 209 ret.reverse() |
210 return ret | 210 return ret |
211 | 211 |
| 212 def _CreateJavaLibrariesList(library_paths): |
| 213 """ Create a java literal array with the "base" library names: |
| 214 e.g. libfoo.so -> foo |
| 215 """ |
| 216 return ('{%s}' % ','.join(['"%s"' % s[3:-3] for s in library_paths])) |
212 | 217 |
213 def main(argv): | 218 def main(argv): |
214 parser = optparse.OptionParser() | 219 parser = optparse.OptionParser() |
215 build_utils.AddDepfileOption(parser) | 220 build_utils.AddDepfileOption(parser) |
216 parser.add_option('--build-config', help='Path to build_config output.') | 221 parser.add_option('--build-config', help='Path to build_config output.') |
217 parser.add_option( | 222 parser.add_option( |
218 '--type', | 223 '--type', |
219 help='Type of this target (e.g. android_library).') | 224 help='Type of this target (e.g. android_library).') |
220 parser.add_option( | 225 parser.add_option( |
221 '--deps-configs', | 226 '--deps-configs', |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 help='GYP-list of .jar files to include on the classpath when compiling, ' | 262 help='GYP-list of .jar files to include on the classpath when compiling, ' |
258 'but not to include in the final binary.') | 263 'but not to include in the final binary.') |
259 | 264 |
260 # android library options | 265 # android library options |
261 parser.add_option('--dex-path', help='Path to target\'s dex output.') | 266 parser.add_option('--dex-path', help='Path to target\'s dex output.') |
262 | 267 |
263 # native library options | 268 # native library options |
264 parser.add_option('--shared-libraries-runtime-deps', | 269 parser.add_option('--shared-libraries-runtime-deps', |
265 help='Path to file containing runtime deps for shared ' | 270 help='Path to file containing runtime deps for shared ' |
266 'libraries.') | 271 'libraries.') |
| 272 parser.add_option('--secondary-abi-shared-libraries-runtime-deps', |
| 273 help='Path to file containing runtime deps for secondary ' |
| 274 'abi shared libraries.') |
267 | 275 |
268 # apk options | 276 # apk options |
269 parser.add_option('--apk-path', help='Path to the target\'s apk output.') | 277 parser.add_option('--apk-path', help='Path to the target\'s apk output.') |
270 parser.add_option('--incremental-apk-path', | 278 parser.add_option('--incremental-apk-path', |
271 help="Path to the target's incremental apk output.") | 279 help="Path to the target's incremental apk output.") |
272 parser.add_option('--incremental-install-script-path', | 280 parser.add_option('--incremental-install-script-path', |
273 help="Path to the target's generated incremental install " | 281 help="Path to the target's generated incremental install " |
274 "script.") | 282 "script.") |
275 | 283 |
276 parser.add_option('--tested-apk-config', | 284 parser.add_option('--tested-apk-config', |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 if not options.tested_apk_config and manifest.GetInstrumentation(): | 630 if not options.tested_apk_config and manifest.GetInstrumentation(): |
623 # This must then have instrumentation only for itself. | 631 # This must then have instrumentation only for itself. |
624 manifest.CheckInstrumentation(manifest.GetPackageName()) | 632 manifest.CheckInstrumentation(manifest.GetPackageName()) |
625 | 633 |
626 library_paths = [] | 634 library_paths = [] |
627 java_libraries_list = None | 635 java_libraries_list = None |
628 runtime_deps_files = build_utils.ParseGnList( | 636 runtime_deps_files = build_utils.ParseGnList( |
629 options.shared_libraries_runtime_deps or '[]') | 637 options.shared_libraries_runtime_deps or '[]') |
630 if runtime_deps_files: | 638 if runtime_deps_files: |
631 library_paths = _ExtractSharedLibsFromRuntimeDeps(runtime_deps_files) | 639 library_paths = _ExtractSharedLibsFromRuntimeDeps(runtime_deps_files) |
632 # Create a java literal array with the "base" library names: | 640 java_libraries_list = _CreateJavaLibrariesList(library_paths) |
633 # e.g. libfoo.so -> foo | 641 |
634 java_libraries_list = ('{%s}' % ','.join( | 642 secondary_abi_library_paths = [] |
635 ['"%s"' % s[3:-3] for s in library_paths])) | 643 secondary_abi_java_libraries_list = None |
| 644 secondary_abi_runtime_deps_files = build_utils.ParseGnList( |
| 645 options.secondary_abi_shared_libraries_runtime_deps or '[]') |
| 646 if secondary_abi_runtime_deps_files: |
| 647 secondary_abi_library_paths = _ExtractSharedLibsFromRuntimeDeps( |
| 648 secondary_abi_runtime_deps_files) |
| 649 secondary_abi_java_libraries_list = _CreateJavaLibrariesList( |
| 650 secondary_abi_library_paths) |
636 | 651 |
637 all_inputs.extend(runtime_deps_files) | 652 all_inputs.extend(runtime_deps_files) |
638 config['native'] = { | 653 config['native'] = { |
639 'libraries': library_paths, | 654 'libraries': library_paths, |
| 655 'secondary_abi_libraries': secondary_abi_library_paths, |
640 'java_libraries_list': java_libraries_list, | 656 'java_libraries_list': java_libraries_list, |
| 657 'secondary_abi_java_libraries_list': secondary_abi_java_libraries_list, |
641 } | 658 } |
642 config['assets'], config['uncompressed_assets'] = ( | 659 config['assets'], config['uncompressed_assets'] = ( |
643 _MergeAssets(deps.All('android_assets'))) | 660 _MergeAssets(deps.All('android_assets'))) |
644 | 661 |
645 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 662 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
646 | 663 |
647 if options.depfile: | 664 if options.depfile: |
648 build_utils.WriteDepfile(options.depfile, all_inputs) | 665 build_utils.WriteDepfile(options.depfile, all_inputs) |
649 | 666 |
650 | 667 |
651 if __name__ == '__main__': | 668 if __name__ == '__main__': |
652 sys.exit(main(sys.argv[1:])) | 669 sys.exit(main(sys.argv[1:])) |
OLD | NEW |