| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 'java_binary': ['build_config', 'jar_path'], | 337 'java_binary': ['build_config', 'jar_path'], |
| 338 'java_library': ['build_config', 'jar_path'], | 338 'java_library': ['build_config', 'jar_path'], |
| 339 'java_prebuilt': ['build_config', 'jar_path'], | 339 'java_prebuilt': ['build_config', 'jar_path'], |
| 340 'android_assets': ['build_config'], | 340 'android_assets': ['build_config'], |
| 341 'android_resources': ['build_config', 'resources_zip'], | 341 'android_resources': ['build_config', 'resources_zip'], |
| 342 'android_apk': ['build_config', 'jar_path', 'dex_path', 'resources_zip'], | 342 'android_apk': ['build_config', 'jar_path', 'dex_path', 'resources_zip'], |
| 343 'deps_dex': ['build_config', 'dex_path'], | 343 'deps_dex': ['build_config', 'dex_path'], |
| 344 'dist_jar': ['build_config'], | 344 'dist_jar': ['build_config'], |
| 345 'resource_rewriter': ['build_config'], | 345 'resource_rewriter': ['build_config'], |
| 346 'group': ['build_config'], | 346 'group': ['build_config'], |
| 347 'junit_binary': ['build_config'], | |
| 348 } | 347 } |
| 349 required_options = required_options_map.get(options.type) | 348 required_options = required_options_map.get(options.type) |
| 350 if not required_options: | 349 if not required_options: |
| 351 raise Exception('Unknown type: <%s>' % options.type) | 350 raise Exception('Unknown type: <%s>' % options.type) |
| 352 | 351 |
| 353 build_utils.CheckOptions(options, parser, required_options) | 352 build_utils.CheckOptions(options, parser, required_options) |
| 354 | 353 |
| 355 # Java prebuilts are the same as libraries except for in gradle files. | 354 # Java prebuilts are the same as libraries except for in gradle files. |
| 356 is_java_prebuilt = options.type == 'java_prebuilt' | 355 is_java_prebuilt = options.type == 'java_prebuilt' |
| 357 if is_java_prebuilt: | 356 if is_java_prebuilt: |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 else: | 533 else: |
| 535 owned_resource_zips.add(c['resources_zip']) | 534 owned_resource_zips.add(c['resources_zip']) |
| 536 | 535 |
| 537 for c in all_library_deps: | 536 for c in all_library_deps: |
| 538 if c['supports_android']: | 537 if c['supports_android']: |
| 539 owned_resource_dirs.difference_update(c['owned_resources_dirs']) | 538 owned_resource_dirs.difference_update(c['owned_resources_dirs']) |
| 540 owned_resource_zips.difference_update(c['owned_resources_zips']) | 539 owned_resource_zips.difference_update(c['owned_resources_zips']) |
| 541 deps_info['owned_resources_dirs'] = list(owned_resource_dirs) | 540 deps_info['owned_resources_dirs'] = list(owned_resource_dirs) |
| 542 deps_info['owned_resources_zips'] = list(owned_resource_zips) | 541 deps_info['owned_resources_zips'] = list(owned_resource_zips) |
| 543 | 542 |
| 544 if options.type in ( | 543 if options.type in ('android_resources','android_apk', 'resource_rewriter'): |
| 545 'android_resources', 'android_apk', 'junit_binary', 'resource_rewriter'): | |
| 546 config['resources'] = {} | 544 config['resources'] = {} |
| 547 config['resources']['dependency_zips'] = [ | 545 config['resources']['dependency_zips'] = [ |
| 548 c['resources_zip'] for c in all_resources_deps] | 546 c['resources_zip'] for c in all_resources_deps] |
| 549 config['resources']['extra_package_names'] = [] | 547 config['resources']['extra_package_names'] = [] |
| 550 config['resources']['extra_r_text_files'] = [] | 548 config['resources']['extra_r_text_files'] = [] |
| 551 | 549 |
| 552 if options.type == 'android_apk' or options.type == 'resource_rewriter': | 550 if options.type == 'android_apk' or options.type == 'resource_rewriter': |
| 553 config['resources']['extra_package_names'] = [ | 551 config['resources']['extra_package_names'] = [ |
| 554 c['package_name'] for c in all_resources_deps if 'package_name' in c] | 552 c['package_name'] for c in all_resources_deps if 'package_name' in c] |
| 555 config['resources']['extra_r_text_files'] = [ | 553 config['resources']['extra_r_text_files'] = [ |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 deps_info['java_resources_jar'] = options.java_resources_jar_path | 709 deps_info['java_resources_jar'] = options.java_resources_jar_path |
| 712 | 710 |
| 713 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 711 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
| 714 | 712 |
| 715 if options.depfile: | 713 if options.depfile: |
| 716 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) | 714 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) |
| 717 | 715 |
| 718 | 716 |
| 719 if __name__ == '__main__': | 717 if __name__ == '__main__': |
| 720 sys.exit(main(sys.argv[1:])) | 718 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |