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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 416 |
417 proguard_enabled = options.proguard_enabled | 417 proguard_enabled = options.proguard_enabled |
418 if options.type == 'android_apk': | 418 if options.type == 'android_apk': |
419 deps_info['proguard_enabled'] = proguard_enabled | 419 deps_info['proguard_enabled'] = proguard_enabled |
420 | 420 |
421 if proguard_enabled: | 421 if proguard_enabled: |
422 deps_info['proguard_info'] = options.proguard_info | 422 deps_info['proguard_info'] = options.proguard_info |
423 config['proguard'] = {} | 423 config['proguard'] = {} |
424 proguard_config = config['proguard'] | 424 proguard_config = config['proguard'] |
425 proguard_config['input_paths'] = [options.jar_path] + java_full_classpath | 425 proguard_config['input_paths'] = [options.jar_path] + java_full_classpath |
| 426 proguard_config['tested_apk_info'] = '' |
426 | 427 |
427 # An instrumentation test apk should exclude the dex files that are in the apk | 428 # An instrumentation test apk should exclude the dex files that are in the apk |
428 # under test. | 429 # under test. |
429 if options.type == 'android_apk' and options.tested_apk_config: | 430 if options.type == 'android_apk' and options.tested_apk_config: |
430 tested_apk_library_deps = tested_apk_deps.All('java_library') | 431 tested_apk_library_deps = tested_apk_deps.All('java_library') |
431 tested_apk_deps_dex_files = [c['dex_path'] for c in tested_apk_library_deps] | 432 tested_apk_deps_dex_files = [c['dex_path'] for c in tested_apk_library_deps] |
432 # Include in the classpath classes that are added directly to the apk under | 433 # Include in the classpath classes that are added directly to the apk under |
433 # test (those that are not a part of a java_library). | 434 # test (those that are not a part of a java_library). |
434 tested_apk_config = GetDepConfig(options.tested_apk_config) | 435 tested_apk_config = GetDepConfig(options.tested_apk_config) |
435 javac_classpath.append(tested_apk_config['jar_path']) | 436 javac_classpath.append(tested_apk_config['jar_path']) |
436 # Exclude dex files from the test apk that exist within the apk under test. | 437 # Exclude dex files from the test apk that exist within the apk under test. |
437 deps_dex_files = [ | 438 deps_dex_files = [ |
438 p for p in deps_dex_files if not p in tested_apk_deps_dex_files] | 439 p for p in deps_dex_files if not p in tested_apk_deps_dex_files] |
439 | 440 |
440 expected_tested_package = tested_apk_config['package_name'] | 441 expected_tested_package = tested_apk_config['package_name'] |
441 AndroidManifest(options.android_manifest).CheckInstrumentation( | 442 AndroidManifest(options.android_manifest).CheckInstrumentation( |
442 expected_tested_package) | 443 expected_tested_package) |
443 if tested_apk_config['proguard_enabled']: | 444 if tested_apk_config['proguard_enabled']: |
444 assert proguard_enabled, ('proguard must be enabled for instrumentation' | 445 assert proguard_enabled, ('proguard must be enabled for instrumentation' |
445 ' apks if it\'s enabled for the tested apk') | 446 ' apks if it\'s enabled for the tested apk') |
| 447 proguard_config['tested_apk_info'] = tested_apk_config['proguard_info'] |
446 | 448 |
447 # Dependencies for the final dex file of an apk or a 'deps_dex'. | 449 # Dependencies for the final dex file of an apk or a 'deps_dex'. |
448 if options.type in ['android_apk', 'deps_dex']: | 450 if options.type in ['android_apk', 'deps_dex']: |
449 config['final_dex'] = {} | 451 config['final_dex'] = {} |
450 dex_config = config['final_dex'] | 452 dex_config = config['final_dex'] |
451 dex_config['dependency_dex_files'] = deps_dex_files | 453 dex_config['dependency_dex_files'] = deps_dex_files |
452 | 454 |
453 if options.type in ('java_binary', 'java_library', 'android_apk'): | 455 if options.type in ('java_binary', 'java_library', 'android_apk'): |
454 config['javac']['classpath'] = javac_classpath | 456 config['javac']['classpath'] = javac_classpath |
455 config['java'] = { | 457 config['java'] = { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 511 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
510 | 512 |
511 if options.depfile: | 513 if options.depfile: |
512 build_utils.WriteDepfile( | 514 build_utils.WriteDepfile( |
513 options.depfile, | 515 options.depfile, |
514 deps.AllConfigPaths() + build_utils.GetPythonDependencies()) | 516 deps.AllConfigPaths() + build_utils.GetPythonDependencies()) |
515 | 517 |
516 | 518 |
517 if __name__ == '__main__': | 519 if __name__ == '__main__': |
518 sys.exit(main(sys.argv[1:])) | 520 sys.exit(main(sys.argv[1:])) |
OLD | NEW |