Chromium Code Reviews| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 parser.error('\n'.join(build_utils.ParseGnList(options.fail))) | 331 parser.error('\n'.join(build_utils.ParseGnList(options.fail))) |
| 332 | 332 |
| 333 required_options_map = { | 333 required_options_map = { |
| 334 'java_binary': ['build_config', 'jar_path'], | 334 'java_binary': ['build_config', 'jar_path'], |
| 335 'java_library': ['build_config', 'jar_path'], | 335 'java_library': ['build_config', 'jar_path'], |
| 336 'java_prebuilt': ['build_config', 'jar_path'], | 336 'java_prebuilt': ['build_config', 'jar_path'], |
| 337 'android_assets': ['build_config'], | 337 'android_assets': ['build_config'], |
| 338 'android_resources': ['build_config', 'resources_zip'], | 338 'android_resources': ['build_config', 'resources_zip'], |
| 339 'android_apk': ['build_config', 'jar_path', 'dex_path', 'resources_zip'], | 339 'android_apk': ['build_config', 'jar_path', 'dex_path', 'resources_zip'], |
| 340 'deps_dex': ['build_config', 'dex_path'], | 340 'deps_dex': ['build_config', 'dex_path'], |
| 341 'dist_jar': ['build_config'], | |
| 341 'resource_rewriter': ['build_config'], | 342 'resource_rewriter': ['build_config'], |
| 342 'group': ['build_config'], | 343 'group': ['build_config'], |
| 343 } | 344 } |
| 344 required_options = required_options_map.get(options.type) | 345 required_options = required_options_map.get(options.type) |
| 345 if not required_options: | 346 if not required_options: |
| 346 raise Exception('Unknown type: <%s>' % options.type) | 347 raise Exception('Unknown type: <%s>' % options.type) |
| 347 | 348 |
| 348 build_utils.CheckOptions(options, parser, required_options) | 349 build_utils.CheckOptions(options, parser, required_options) |
| 349 | 350 |
| 350 # Java prebuilts are the same as libraries except for in gradle files. | 351 # Java prebuilts are the same as libraries except for in gradle files. |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 dex_config['dependency_dex_files'] = deps_dex_files | 625 dex_config['dependency_dex_files'] = deps_dex_files |
| 625 | 626 |
| 626 if options.type in ('java_binary', 'java_library', 'android_apk'): | 627 if options.type in ('java_binary', 'java_library', 'android_apk'): |
| 627 config['javac']['classpath'] = javac_classpath | 628 config['javac']['classpath'] = javac_classpath |
| 628 config['javac']['interface_classpath'] = [ | 629 config['javac']['interface_classpath'] = [ |
| 629 _AsInterfaceJar(p) for p in javac_classpath] | 630 _AsInterfaceJar(p) for p in javac_classpath] |
| 630 deps_info['java'] = { | 631 deps_info['java'] = { |
| 631 'full_classpath': java_full_classpath | 632 'full_classpath': java_full_classpath |
| 632 } | 633 } |
| 633 | 634 |
| 635 if options.type in ('android_apk', 'dist_jar'): | |
| 636 dependency_jars = [c['jar_path'] for c in all_library_deps] | |
| 637 all_interface_jars = [_AsInterfaceJar(p) for p in dependency_jars] | |
| 638 if options.type == 'android_apk': | |
| 639 all_interface_jars.append(_AsInterfaceJar(options.jar_path)) | |
| 640 | |
| 641 config['dist_jar'] = { | |
| 642 'dependency_jars': dependency_jars, | |
| 643 'all_interface_jars': all_interface_jars, | |
| 644 } | |
| 645 | |
| 634 if options.type == 'android_apk': | 646 if options.type == 'android_apk': |
| 635 dependency_jars = [c['jar_path'] for c in all_library_deps] | 647 dependency_jars = [c['jar_path'] for c in all_library_deps] |
|
mbonadei1
2017/01/12 16:04:32
For the "android_library" use case I think that we
| |
| 636 all_interface_jars = [ | |
| 637 _AsInterfaceJar(p) for p in dependency_jars + [options.jar_path]] | |
| 638 config['dist_jar'] = { | |
| 639 'dependency_jars': dependency_jars, | |
| 640 'all_interface_jars': all_interface_jars, | |
| 641 } | |
| 642 manifest = AndroidManifest(options.android_manifest) | 648 manifest = AndroidManifest(options.android_manifest) |
| 643 deps_info['package_name'] = manifest.GetPackageName() | 649 deps_info['package_name'] = manifest.GetPackageName() |
| 644 if not options.tested_apk_config and manifest.GetInstrumentation(): | 650 if not options.tested_apk_config and manifest.GetInstrumentation(): |
| 645 # This must then have instrumentation only for itself. | 651 # This must then have instrumentation only for itself. |
| 646 manifest.CheckInstrumentation(manifest.GetPackageName()) | 652 manifest.CheckInstrumentation(manifest.GetPackageName()) |
| 647 | 653 |
| 648 library_paths = [] | 654 library_paths = [] |
| 649 java_libraries_list = None | 655 java_libraries_list = None |
| 650 runtime_deps_files = build_utils.ParseGnList( | 656 runtime_deps_files = build_utils.ParseGnList( |
| 651 options.shared_libraries_runtime_deps or '[]') | 657 options.shared_libraries_runtime_deps or '[]') |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 678 _CreateLocalePaksAssetJavaList(config['uncompressed_assets'])) | 684 _CreateLocalePaksAssetJavaList(config['uncompressed_assets'])) |
| 679 | 685 |
| 680 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 686 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
| 681 | 687 |
| 682 if options.depfile: | 688 if options.depfile: |
| 683 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) | 689 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) |
| 684 | 690 |
| 685 | 691 |
| 686 if __name__ == '__main__': | 692 if __name__ == '__main__': |
| 687 sys.exit(main(sys.argv[1:])) | 693 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |