| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 428 |
| 429 proguard_enabled = options.proguard_enabled | 429 proguard_enabled = options.proguard_enabled |
| 430 if options.type == 'android_apk': | 430 if options.type == 'android_apk': |
| 431 deps_info['proguard_enabled'] = proguard_enabled | 431 deps_info['proguard_enabled'] = proguard_enabled |
| 432 | 432 |
| 433 if proguard_enabled: | 433 if proguard_enabled: |
| 434 deps_info['proguard_info'] = options.proguard_info | 434 deps_info['proguard_info'] = options.proguard_info |
| 435 config['proguard'] = {} | 435 config['proguard'] = {} |
| 436 proguard_config = config['proguard'] | 436 proguard_config = config['proguard'] |
| 437 proguard_config['input_paths'] = [options.jar_path] + java_full_classpath | 437 proguard_config['input_paths'] = [options.jar_path] + java_full_classpath |
| 438 proguard_config['tested_apk_info'] = '' | |
| 439 | 438 |
| 440 # An instrumentation test apk should exclude the dex files that are in the apk | 439 # An instrumentation test apk should exclude the dex files that are in the apk |
| 441 # under test. | 440 # under test. |
| 442 if options.type == 'android_apk' and options.tested_apk_config: | 441 if options.type == 'android_apk' and options.tested_apk_config: |
| 443 tested_apk_library_deps = tested_apk_deps.All('java_library') | 442 tested_apk_library_deps = tested_apk_deps.All('java_library') |
| 444 tested_apk_deps_dex_files = [c['dex_path'] for c in tested_apk_library_deps] | 443 tested_apk_deps_dex_files = [c['dex_path'] for c in tested_apk_library_deps] |
| 445 # Include in the classpath classes that are added directly to the apk under | 444 # Include in the classpath classes that are added directly to the apk under |
| 446 # test (those that are not a part of a java_library). | 445 # test (those that are not a part of a java_library). |
| 447 tested_apk_config = GetDepConfig(options.tested_apk_config) | 446 tested_apk_config = GetDepConfig(options.tested_apk_config) |
| 448 javac_classpath.append(tested_apk_config['jar_path']) | 447 javac_classpath.append(tested_apk_config['jar_path']) |
| 449 # Exclude dex files from the test apk that exist within the apk under test. | 448 # Exclude dex files from the test apk that exist within the apk under test. |
| 450 deps_dex_files = [ | 449 deps_dex_files = [ |
| 451 p for p in deps_dex_files if not p in tested_apk_deps_dex_files] | 450 p for p in deps_dex_files if not p in tested_apk_deps_dex_files] |
| 452 | 451 |
| 453 expected_tested_package = tested_apk_config['package_name'] | 452 expected_tested_package = tested_apk_config['package_name'] |
| 454 AndroidManifest(options.android_manifest).CheckInstrumentation( | 453 AndroidManifest(options.android_manifest).CheckInstrumentation( |
| 455 expected_tested_package) | 454 expected_tested_package) |
| 456 if tested_apk_config['proguard_enabled']: | 455 if tested_apk_config['proguard_enabled']: |
| 457 assert proguard_enabled, ('proguard must be enabled for instrumentation' | 456 assert proguard_enabled, ('proguard must be enabled for instrumentation' |
| 458 ' apks if it\'s enabled for the tested apk') | 457 ' apks if it\'s enabled for the tested apk') |
| 459 proguard_config['tested_apk_info'] = tested_apk_config['proguard_info'] | |
| 460 | 458 |
| 461 # Dependencies for the final dex file of an apk or a 'deps_dex'. | 459 # Dependencies for the final dex file of an apk or a 'deps_dex'. |
| 462 if options.type in ['android_apk', 'deps_dex']: | 460 if options.type in ['android_apk', 'deps_dex']: |
| 463 config['final_dex'] = {} | 461 config['final_dex'] = {} |
| 464 dex_config = config['final_dex'] | 462 dex_config = config['final_dex'] |
| 465 dex_config['dependency_dex_files'] = deps_dex_files | 463 dex_config['dependency_dex_files'] = deps_dex_files |
| 466 | 464 |
| 467 if options.type in ('java_binary', 'java_library', 'android_apk'): | 465 if options.type in ('java_binary', 'java_library', 'android_apk'): |
| 468 config['javac']['classpath'] = javac_classpath | 466 config['javac']['classpath'] = javac_classpath |
| 469 config['java'] = { | 467 config['java'] = { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 521 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
| 524 | 522 |
| 525 if options.depfile: | 523 if options.depfile: |
| 526 build_utils.WriteDepfile( | 524 build_utils.WriteDepfile( |
| 527 options.depfile, | 525 options.depfile, |
| 528 deps.AllConfigPaths() + build_utils.GetPythonDependencies()) | 526 deps.AllConfigPaths() + build_utils.GetPythonDependencies()) |
| 529 | 527 |
| 530 | 528 |
| 531 if __name__ == '__main__': | 529 if __name__ == '__main__': |
| 532 sys.exit(main(sys.argv[1:])) | 530 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |