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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 help='Whether this library requires running on the Android platform.') | 284 help='Whether this library requires running on the Android platform.') |
285 parser.add_option('--bypass-platform-checks', action='store_true', | 285 parser.add_option('--bypass-platform-checks', action='store_true', |
286 help='Bypass checks for support/require Android platform.') | 286 help='Bypass checks for support/require Android platform.') |
287 parser.add_option('--extra-classpath-jars', | 287 parser.add_option('--extra-classpath-jars', |
288 help='GYP-list of .jar files to include on the classpath when compiling, ' | 288 help='GYP-list of .jar files to include on the classpath when compiling, ' |
289 'but not to include in the final binary.') | 289 'but not to include in the final binary.') |
290 parser.add_option('--gradle-treat-as-prebuilt', action='store_true', | 290 parser.add_option('--gradle-treat-as-prebuilt', action='store_true', |
291 help='Whether this library should be treated as a prebuilt library by ' | 291 help='Whether this library should be treated as a prebuilt library by ' |
292 'generate_gradle.py.') | 292 'generate_gradle.py.') |
293 parser.add_option('--main-class', help='Java class for java_binary targets.') | 293 parser.add_option('--main-class', help='Java class for java_binary targets.') |
| 294 parser.add_option('--java-resources-jar-path', |
| 295 help='Path to JAR that contains java resources. Everything ' |
| 296 'from this JAR except meta-inf/ content and .class files ' |
| 297 'will be added to the final APK.') |
294 | 298 |
295 # android library options | 299 # android library options |
296 parser.add_option('--dex-path', help='Path to target\'s dex output.') | 300 parser.add_option('--dex-path', help='Path to target\'s dex output.') |
297 | 301 |
298 # native library options | 302 # native library options |
299 parser.add_option('--shared-libraries-runtime-deps', | 303 parser.add_option('--shared-libraries-runtime-deps', |
300 help='Path to file containing runtime deps for shared ' | 304 help='Path to file containing runtime deps for shared ' |
301 'libraries.') | 305 'libraries.') |
302 parser.add_option('--secondary-abi-shared-libraries-runtime-deps', | 306 parser.add_option('--secondary-abi-shared-libraries-runtime-deps', |
303 help='Path to file containing runtime deps for secondary ' | 307 help='Path to file containing runtime deps for secondary ' |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 'java_libraries_list': java_libraries_list, | 674 'java_libraries_list': java_libraries_list, |
671 'secondary_abi_java_libraries_list': secondary_abi_java_libraries_list, | 675 'secondary_abi_java_libraries_list': secondary_abi_java_libraries_list, |
672 } | 676 } |
673 config['assets'], config['uncompressed_assets'] = ( | 677 config['assets'], config['uncompressed_assets'] = ( |
674 _MergeAssets(deps.All('android_assets'))) | 678 _MergeAssets(deps.All('android_assets'))) |
675 config['compressed_locales_java_list'] = ( | 679 config['compressed_locales_java_list'] = ( |
676 _CreateLocalePaksAssetJavaList(config['assets'])) | 680 _CreateLocalePaksAssetJavaList(config['assets'])) |
677 config['uncompressed_locales_java_list'] = ( | 681 config['uncompressed_locales_java_list'] = ( |
678 _CreateLocalePaksAssetJavaList(config['uncompressed_assets'])) | 682 _CreateLocalePaksAssetJavaList(config['uncompressed_assets'])) |
679 | 683 |
| 684 # Collect java resources |
| 685 java_resources_jars = [d['java_resources_jar'] for d in all_library_deps |
| 686 if 'java_resources_jar' in d] |
| 687 if options.tested_apk_config: |
| 688 tested_apk_resource_jars = [d['java_resources_jar'] |
| 689 for d in tested_apk_library_deps |
| 690 if 'java_resources_jar' in d] |
| 691 java_resources_jars = [jar for jar in java_resources_jars |
| 692 if jar not in tested_apk_resource_jars] |
| 693 config['java_resources_jars'] = java_resources_jars |
| 694 |
| 695 if options.type == 'java_library' and options.java_resources_jar_path: |
| 696 deps_info['java_resources_jar'] = options.java_resources_jar_path |
| 697 |
680 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 698 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
681 | 699 |
682 if options.depfile: | 700 if options.depfile: |
683 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) | 701 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) |
684 | 702 |
685 | 703 |
686 if __name__ == '__main__': | 704 if __name__ == '__main__': |
687 sys.exit(main(sys.argv[1:])) | 705 sys.exit(main(sys.argv[1:])) |
OLD | NEW |