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