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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 all_inputs = deps.AllConfigPaths() | 368 all_inputs = deps.AllConfigPaths() |
369 | 369 |
370 direct_library_deps = deps.Direct('java_library') | 370 direct_library_deps = deps.Direct('java_library') |
371 all_library_deps = deps.All('java_library') | 371 all_library_deps = deps.All('java_library') |
372 | 372 |
373 all_resources_deps = deps.All('android_resources') | 373 all_resources_deps = deps.All('android_resources') |
374 # Resources should be ordered with the highest-level dependency first so that | 374 # Resources should be ordered with the highest-level dependency first so that |
375 # overrides are done correctly. | 375 # overrides are done correctly. |
376 all_resources_deps.reverse() | 376 all_resources_deps.reverse() |
377 | 377 |
378 if options.type == 'android_apk' and options.tested_apk_config: | |
379 tested_apk_deps = Deps([options.tested_apk_config]) | |
380 tested_apk_resources_deps = tested_apk_deps.All('android_resources') | |
381 all_resources_deps = [ | |
382 d for d in all_resources_deps if not d in tested_apk_resources_deps] | |
383 | |
384 # Initialize some common config. | 378 # Initialize some common config. |
385 # Any value that needs to be queryable by dependents must go within deps_info. | 379 # Any value that needs to be queryable by dependents must go within deps_info. |
386 config = { | 380 config = { |
387 'deps_info': { | 381 'deps_info': { |
388 'name': os.path.basename(options.build_config), | 382 'name': os.path.basename(options.build_config), |
389 'path': options.build_config, | 383 'path': options.build_config, |
390 'type': options.type, | 384 'type': options.type, |
391 'deps_configs': direct_deps_config_paths | 385 'deps_configs': direct_deps_config_paths |
392 }, | 386 }, |
393 # Info needed only by generate_gradle.py. | 387 # Info needed only by generate_gradle.py. |
394 'gradle': {} | 388 'gradle': {} |
395 } | 389 } |
396 deps_info = config['deps_info'] | 390 deps_info = config['deps_info'] |
397 gradle = config['gradle'] | 391 gradle = config['gradle'] |
398 | 392 |
| 393 if options.type == 'android_apk' and options.tested_apk_config: |
| 394 tested_apk_deps = Deps([options.tested_apk_config]) |
| 395 tested_apk_name = tested_apk_deps.Direct()[0]['name'] |
| 396 tested_apk_resources_deps = tested_apk_deps.All('android_resources') |
| 397 gradle['apk_under_test'] = tested_apk_name |
| 398 all_resources_deps = [ |
| 399 d for d in all_resources_deps if not d in tested_apk_resources_deps] |
| 400 |
399 # Required for generating gradle files. | 401 # Required for generating gradle files. |
400 if options.type == 'java_library': | 402 if options.type == 'java_library': |
401 deps_info['is_prebuilt'] = is_java_prebuilt | 403 deps_info['is_prebuilt'] = is_java_prebuilt |
402 deps_info['gradle_treat_as_prebuilt'] = options.gradle_treat_as_prebuilt | 404 deps_info['gradle_treat_as_prebuilt'] = options.gradle_treat_as_prebuilt |
403 | 405 |
404 if options.android_manifest: | 406 if options.android_manifest: |
405 gradle['android_manifest'] = options.android_manifest | 407 gradle['android_manifest'] = options.android_manifest |
406 if options.type in ('java_binary', 'java_library', 'android_apk'): | 408 if options.type in ('java_binary', 'java_library', 'android_apk'): |
407 if options.java_sources_file: | 409 if options.java_sources_file: |
408 gradle['java_sources_file'] = options.java_sources_file | 410 gradle['java_sources_file'] = options.java_sources_file |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 _CreateLocalePaksAssetJavaList(config['uncompressed_assets'])) | 680 _CreateLocalePaksAssetJavaList(config['uncompressed_assets'])) |
679 | 681 |
680 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 682 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
681 | 683 |
682 if options.depfile: | 684 if options.depfile: |
683 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) | 685 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) |
684 | 686 |
685 | 687 |
686 if __name__ == '__main__': | 688 if __name__ == '__main__': |
687 sys.exit(main(sys.argv[1:])) | 689 sys.exit(main(sys.argv[1:])) |
OLD | NEW |