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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 parser.add_option('--jar-path', help='Path to target\'s jar output.') | 246 parser.add_option('--jar-path', help='Path to target\'s jar output.') |
247 parser.add_option('--java-sources-file', help='Path to .sources file') | 247 parser.add_option('--java-sources-file', help='Path to .sources file') |
248 parser.add_option('--bundled-srcjars', | 248 parser.add_option('--bundled-srcjars', |
249 help='GYP-list of .srcjars that have been included in this java_library.') | 249 help='GYP-list of .srcjars that have been included in this java_library.') |
250 parser.add_option('--supports-android', action='store_true', | 250 parser.add_option('--supports-android', action='store_true', |
251 help='Whether this library supports running on the Android platform.') | 251 help='Whether this library supports running on the Android platform.') |
252 parser.add_option('--requires-android', action='store_true', | 252 parser.add_option('--requires-android', action='store_true', |
253 help='Whether this library requires running on the Android platform.') | 253 help='Whether this library requires running on the Android platform.') |
254 parser.add_option('--bypass-platform-checks', action='store_true', | 254 parser.add_option('--bypass-platform-checks', action='store_true', |
255 help='Bypass checks for support/require Android platform.') | 255 help='Bypass checks for support/require Android platform.') |
| 256 parser.add_option('--java-resources-jar-path', |
| 257 help='Path to JAR that contains java resources. Everything ' |
| 258 'from this JAR except meta-inf/ content and .class files ' |
| 259 'will be added to the final APK.') |
256 | 260 |
257 # android library options | 261 # android library options |
258 parser.add_option('--dex-path', help='Path to target\'s dex output.') | 262 parser.add_option('--dex-path', help='Path to target\'s dex output.') |
259 | 263 |
260 # native library options | 264 # native library options |
261 parser.add_option('--shared-libraries-runtime-deps', | 265 parser.add_option('--shared-libraries-runtime-deps', |
262 help='Path to file containing runtime deps for shared ' | 266 help='Path to file containing runtime deps for shared ' |
263 'libraries.') | 267 'libraries.') |
264 | 268 |
265 # apk options | 269 # apk options |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 ['"%s"' % s[3:-3] for s in library_paths])) | 598 ['"%s"' % s[3:-3] for s in library_paths])) |
595 | 599 |
596 all_inputs.extend(runtime_deps_files) | 600 all_inputs.extend(runtime_deps_files) |
597 config['native'] = { | 601 config['native'] = { |
598 'libraries': library_paths, | 602 'libraries': library_paths, |
599 'java_libraries_list': java_libraries_list, | 603 'java_libraries_list': java_libraries_list, |
600 } | 604 } |
601 config['assets'], config['uncompressed_assets'] = ( | 605 config['assets'], config['uncompressed_assets'] = ( |
602 _MergeAssets(deps.All('android_assets'))) | 606 _MergeAssets(deps.All('android_assets'))) |
603 | 607 |
| 608 # Collect java resources |
| 609 java_resources_jars = [d['java_resources_jar'] for d in all_library_deps |
| 610 if 'java_resources_jar' in d] |
| 611 if options.tested_apk_config: |
| 612 tested_apk_resource_jars = [d['java_resources_jar'] |
| 613 for d in tested_apk_library_deps |
| 614 if 'java_resources_jar' in d] |
| 615 java_resources_jars = [jar for jar in java_resources_jars |
| 616 if jar not in tested_apk_resource_jars] |
| 617 config['java_resources_jars'] = java_resources_jars |
| 618 |
| 619 if options.type == 'java_library' and options.java_resources_jar_path: |
| 620 deps_info['java_resources_jar'] = options.java_resources_jar_path |
| 621 |
604 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 622 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
605 | 623 |
606 if options.depfile: | 624 if options.depfile: |
607 build_utils.WriteDepfile(options.depfile, all_inputs) | 625 build_utils.WriteDepfile(options.depfile, all_inputs) |
608 | 626 |
609 | 627 |
610 if __name__ == '__main__': | 628 if __name__ == '__main__': |
611 sys.exit(main(sys.argv[1:])) | 629 sys.exit(main(sys.argv[1:])) |
OLD | NEW |