| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 direct_deps_config_paths = build_utils.ParseGnList(options.deps_configs) | 367 direct_deps_config_paths = build_utils.ParseGnList(options.deps_configs) |
| 368 direct_deps_config_paths = _FilterDepsPaths(direct_deps_config_paths, | 368 direct_deps_config_paths = _FilterDepsPaths(direct_deps_config_paths, |
| 369 options.type) | 369 options.type) |
| 370 | 370 |
| 371 deps = Deps(direct_deps_config_paths) | 371 deps = Deps(direct_deps_config_paths) |
| 372 all_inputs = deps.AllConfigPaths() | 372 all_inputs = deps.AllConfigPaths() |
| 373 | 373 |
| 374 direct_library_deps = deps.Direct('java_library') | 374 direct_library_deps = deps.Direct('java_library') |
| 375 all_library_deps = deps.All('java_library') | 375 all_library_deps = deps.All('java_library') |
| 376 | 376 |
| 377 direct_resources_deps = deps.Direct('android_resources') |
| 377 all_resources_deps = deps.All('android_resources') | 378 all_resources_deps = deps.All('android_resources') |
| 378 # Resources should be ordered with the highest-level dependency first so that | 379 # Resources should be ordered with the highest-level dependency first so that |
| 379 # overrides are done correctly. | 380 # overrides are done correctly. |
| 380 all_resources_deps.reverse() | 381 all_resources_deps.reverse() |
| 381 | 382 |
| 382 # Initialize some common config. | 383 # Initialize some common config. |
| 383 # Any value that needs to be queryable by dependents must go within deps_info. | 384 # Any value that needs to be queryable by dependents must go within deps_info. |
| 384 config = { | 385 config = { |
| 385 'deps_info': { | 386 'deps_info': { |
| 386 'name': os.path.basename(options.build_config), | 387 'name': os.path.basename(options.build_config), |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 # refer to the resources in any of its dependents. | 472 # refer to the resources in any of its dependents. |
| 472 config['javac']['srcjars'] = [ | 473 config['javac']['srcjars'] = [ |
| 473 c['srcjar'] for c in all_resources_deps if 'srcjar' in c] | 474 c['srcjar'] for c in all_resources_deps if 'srcjar' in c] |
| 474 | 475 |
| 475 # Used to strip out R.class for android_prebuilt()s. | 476 # Used to strip out R.class for android_prebuilt()s. |
| 476 if options.type == 'java_library': | 477 if options.type == 'java_library': |
| 477 config['javac']['resource_packages'] = [ | 478 config['javac']['resource_packages'] = [ |
| 478 c['package_name'] for c in all_resources_deps if 'package_name' in c] | 479 c['package_name'] for c in all_resources_deps if 'package_name' in c] |
| 479 | 480 |
| 480 if options.type == 'android_apk': | 481 if options.type == 'android_apk': |
| 481 # Apks will get their resources srcjar explicitly passed to the java step. | 482 # Apks will get their resources srcjar explicitly passed to the java step |
| 482 config['javac']['srcjars'] = [] | 483 config['javac']['srcjars'] = [] |
| 484 # Gradle may need to generate resources for some apks. |
| 485 gradle['srcjars'] = [ |
| 486 c['srcjar'] for c in direct_resources_deps if 'srcjar' in c] |
| 483 | 487 |
| 484 if options.type == 'android_assets': | 488 if options.type == 'android_assets': |
| 485 all_asset_sources = [] | 489 all_asset_sources = [] |
| 486 if options.asset_renaming_sources: | 490 if options.asset_renaming_sources: |
| 487 all_asset_sources.extend( | 491 all_asset_sources.extend( |
| 488 build_utils.ParseGnList(options.asset_renaming_sources)) | 492 build_utils.ParseGnList(options.asset_renaming_sources)) |
| 489 if options.asset_sources: | 493 if options.asset_sources: |
| 490 all_asset_sources.extend(build_utils.ParseGnList(options.asset_sources)) | 494 all_asset_sources.extend(build_utils.ParseGnList(options.asset_sources)) |
| 491 | 495 |
| 492 deps_info['assets'] = { | 496 deps_info['assets'] = { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 deps_info['java_resources_jar'] = options.java_resources_jar_path | 709 deps_info['java_resources_jar'] = options.java_resources_jar_path |
| 706 | 710 |
| 707 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 711 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
| 708 | 712 |
| 709 if options.depfile: | 713 if options.depfile: |
| 710 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) | 714 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) |
| 711 | 715 |
| 712 | 716 |
| 713 if __name__ == '__main__': | 717 if __name__ == '__main__': |
| 714 sys.exit(main(sys.argv[1:])) | 718 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |