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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 config['javac'] = {} | 369 config['javac'] = {} |
370 | 370 |
371 if options.type in ('java_binary', 'java_library'): | 371 if options.type in ('java_binary', 'java_library'): |
372 # Only resources might have srcjars (normal srcjar targets are listed in | 372 # Only resources might have srcjars (normal srcjar targets are listed in |
373 # srcjar_deps). A resource's srcjar contains the R.java file for those | 373 # srcjar_deps). A resource's srcjar contains the R.java file for those |
374 # resources, and (like Android's default build system) we allow a library to | 374 # resources, and (like Android's default build system) we allow a library to |
375 # refer to the resources in any of its dependents. | 375 # refer to the resources in any of its dependents. |
376 config['javac']['srcjars'] = [ | 376 config['javac']['srcjars'] = [ |
377 c['srcjar'] for c in direct_resources_deps if 'srcjar' in c] | 377 c['srcjar'] for c in direct_resources_deps if 'srcjar' in c] |
378 | 378 |
| 379 # Used to strip out R.class for android_prebuilt()s. |
| 380 if options.type == 'java_library': |
| 381 config['javac']['resource_packages'] = [ |
| 382 c['package_name'] for c in all_resources_deps if 'package_name' in c] |
| 383 |
379 if options.type == 'android_apk': | 384 if options.type == 'android_apk': |
380 # Apks will get their resources srcjar explicitly passed to the java step. | 385 # Apks will get their resources srcjar explicitly passed to the java step. |
381 config['javac']['srcjars'] = [] | 386 config['javac']['srcjars'] = [] |
382 | 387 |
383 if options.type == 'android_assets': | 388 if options.type == 'android_assets': |
384 all_asset_sources = [] | 389 all_asset_sources = [] |
385 if options.asset_renaming_sources: | 390 if options.asset_renaming_sources: |
386 all_asset_sources.extend( | 391 all_asset_sources.extend( |
387 build_utils.ParseGypList(options.asset_renaming_sources)) | 392 build_utils.ParseGypList(options.asset_renaming_sources)) |
388 if options.asset_sources: | 393 if options.asset_sources: |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 _MergeAssets(deps.All('android_assets'))) | 530 _MergeAssets(deps.All('android_assets'))) |
526 | 531 |
527 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 532 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
528 | 533 |
529 if options.depfile: | 534 if options.depfile: |
530 build_utils.WriteDepfile(options.depfile, all_inputs) | 535 build_utils.WriteDepfile(options.depfile, all_inputs) |
531 | 536 |
532 | 537 |
533 if __name__ == '__main__': | 538 if __name__ == '__main__': |
534 sys.exit(main(sys.argv[1:])) | 539 sys.exit(main(sys.argv[1:])) |
OLD | NEW |