OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This file is meant to be included into a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
6 # to build Android APKs in a consistent manner. | 6 # to build Android APKs in a consistent manner. |
7 # | 7 # |
8 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
9 # { | 9 # { |
10 # 'target_name': 'my_package_apk', | 10 # 'target_name': 'my_package_apk', |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 # R_package - A custom Java package to generate the resource file R.java in. | 45 # R_package - A custom Java package to generate the resource file R.java in. |
46 # By default, the package given in AndroidManifest.xml will be used. | 46 # By default, the package given in AndroidManifest.xml will be used. |
47 # use_chromium_linker - Enable the content dynamic linker that allows sharing t
he | 47 # use_chromium_linker - Enable the content dynamic linker that allows sharing t
he |
48 # RELRO section of the native libraries between the different processes. | 48 # RELRO section of the native libraries between the different processes. |
49 # enable_chromium_linker_tests - Enable the content dynamic linker test support | 49 # enable_chromium_linker_tests - Enable the content dynamic linker test support |
50 # code. This allows a test APK to inject a Linker.TestRunner instance at | 50 # code. This allows a test APK to inject a Linker.TestRunner instance at |
51 # runtime. Should only be used by the chromium_linker_test_apk target!! | 51 # runtime. Should only be used by the chromium_linker_test_apk target!! |
52 # never_lint - Set to 1 to not run lint on this target. | 52 # never_lint - Set to 1 to not run lint on this target. |
53 { | 53 { |
54 'variables': { | 54 'variables': { |
| 55 'tested_apk_obfuscated_jar_path%': '/', |
55 'tested_apk_dex_path%': '/', | 56 'tested_apk_dex_path%': '/', |
56 'additional_input_paths': [], | 57 'additional_input_paths': [], |
57 'input_jars_paths': [], | 58 'input_jars_paths': [], |
58 'library_dexed_jars_paths': [], | 59 'library_dexed_jars_paths': [], |
59 'additional_src_dirs': [], | 60 'additional_src_dirs': [], |
60 'generated_src_dirs': [], | 61 'generated_src_dirs': [], |
61 'app_manifest_version_name%': '<(android_app_version_name)', | 62 'app_manifest_version_name%': '<(android_app_version_name)', |
62 'app_manifest_version_code%': '<(android_app_version_code)', | 63 'app_manifest_version_code%': '<(android_app_version_code)', |
63 # aapt generates this proguard.txt. | 64 # aapt generates this proguard.txt. |
64 'generated_proguard_file': '<(intermediate_dir)/proguard.txt', | 65 'generated_proguard_file': '<(intermediate_dir)/proguard.txt', |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 'emma_instrument%': '<(emma_instrument)', | 152 'emma_instrument%': '<(emma_instrument)', |
152 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 153 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
153 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 154 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
154 'extra_native_libs': [], | 155 'extra_native_libs': [], |
155 'apk_dex_input_paths': [ '>@(library_dexed_jars_paths)' ], | 156 'apk_dex_input_paths': [ '>@(library_dexed_jars_paths)' ], |
156 }, | 157 }, |
157 # Pass the jar path to the apk's "fake" jar target. This would be better as | 158 # Pass the jar path to the apk's "fake" jar target. This would be better as |
158 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 159 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
159 # cannot be lifted in a dependent to all_dependent_settings. | 160 # cannot be lifted in a dependent to all_dependent_settings. |
160 'all_dependent_settings': { | 161 'all_dependent_settings': { |
| 162 'conditions': [ |
| 163 ['proguard_enabled == "true"', { |
| 164 'variables': { |
| 165 'proguard_enabled': 'true', |
| 166 } |
| 167 }], |
| 168 ], |
161 'variables': { | 169 'variables': { |
162 'apk_output_jar_path': '<(jar_path)', | 170 'apk_output_jar_path': '<(jar_path)', |
| 171 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)', |
163 'tested_apk_dex_path': '<(dex_path)', | 172 'tested_apk_dex_path': '<(dex_path)', |
164 }, | 173 }, |
165 }, | 174 }, |
166 'conditions': [ | 175 'conditions': [ |
167 ['resource_dir!=""', { | 176 ['resource_dir!=""', { |
168 'variables': { | 177 'variables': { |
169 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] | 178 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] |
170 }, | 179 }, |
171 }], | 180 }], |
172 ['R_package != ""', { | 181 ['R_package != ""', { |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 '--jar-path=<(jar_path)', | 606 '--jar-path=<(jar_path)', |
598 '--excluded-classes=<(jar_excluded_classes)', | 607 '--excluded-classes=<(jar_excluded_classes)', |
599 '--stamp=<(jar_stamp)', | 608 '--stamp=<(jar_stamp)', |
600 ] | 609 ] |
601 }, | 610 }, |
602 { | 611 { |
603 'action_name': 'obfuscate_<(_target_name)', | 612 'action_name': 'obfuscate_<(_target_name)', |
604 'message': 'Obfuscating <(_target_name)', | 613 'message': 'Obfuscating <(_target_name)', |
605 'variables': { | 614 'variables': { |
606 'additional_obfuscate_options': [], | 615 'additional_obfuscate_options': [], |
| 616 'additional_obfuscate_input_paths': [], |
607 'proguard_out_dir': '<(intermediate_dir)/proguard', | 617 'proguard_out_dir': '<(intermediate_dir)/proguard', |
608 'proguard_input_jar_paths': [ | 618 'proguard_input_jar_paths': [ |
609 '>@(input_jars_paths)', | 619 '>@(input_jars_paths)', |
610 '<(jar_path)', | 620 '<(jar_path)', |
611 ], | 621 ], |
612 'conditions': [ | 622 'target_conditions': [ |
613 ['is_test_apk == 1', { | 623 ['is_test_apk == 1', { |
614 'additional_obfuscate_options': [ | 624 'additional_obfuscate_options': [ |
615 '--testapp', | 625 '--testapp', |
616 ], | 626 ], |
617 }], | 627 }], |
| 628 ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', { |
| 629 'additional_obfuscate_options': [ |
| 630 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_p
ath)', |
| 631 ], |
| 632 'additional_obfuscate_input_paths': [ |
| 633 '>(tested_apk_obfuscated_jar_path).info', |
| 634 ], |
| 635 }], |
618 ['proguard_enabled == "true"', { | 636 ['proguard_enabled == "true"', { |
619 'additional_obfuscate_options': [ | 637 'additional_obfuscate_options': [ |
620 '--proguard-enabled', | 638 '--proguard-enabled', |
621 ], | 639 ], |
622 }], | 640 }], |
623 ], | 641 ], |
| 642 'obfuscate_input_jars_paths': [ |
| 643 '>@(input_jars_paths)', |
| 644 '<(jar_path)', |
| 645 ], |
624 }, | 646 }, |
625 'conditions': [ | 647 'conditions': [ |
626 ['is_test_apk == 1', { | 648 ['is_test_apk == 1', { |
627 'outputs': [ | 649 'outputs': [ |
628 '<(test_jar_path)', | 650 '<(test_jar_path)', |
629 ], | 651 ], |
630 }], | 652 }], |
631 ], | 653 ], |
632 'inputs': [ | 654 'inputs': [ |
633 '<(DEPTH)/build/android/gyp/apk_obfuscate.py', | 655 '<(DEPTH)/build/android/gyp/apk_obfuscate.py', |
634 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 656 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
635 '>@(proguard_flags_paths)', | 657 '>@(proguard_flags_paths)', |
636 '>@(proguard_input_jar_paths)', | 658 '>@(obfuscate_input_jars_paths)', |
| 659 '>@(additional_obfuscate_input_paths)', |
| 660 '<(instr_stamp)', |
637 ], | 661 ], |
638 'outputs': [ | 662 'outputs': [ |
639 # This lists obfuscate_stamp instead of obfuscated_jar_path because | |
640 # ant only writes the latter if the md5 of the inputs changes. | |
641 '<(obfuscate_stamp)', | 663 '<(obfuscate_stamp)', |
642 | 664 |
643 # In non-Release builds, these paths will all be empty files. | 665 # In non-Release builds, these paths will all be empty files. |
644 '<(obfuscated_jar_path)', | 666 '<(obfuscated_jar_path)', |
| 667 '<(obfuscated_jar_path).info', |
645 '<(obfuscated_jar_path).dump', | 668 '<(obfuscated_jar_path).dump', |
646 '<(obfuscated_jar_path).seeds', | 669 '<(obfuscated_jar_path).seeds', |
647 '<(obfuscated_jar_path).mapping', | 670 '<(obfuscated_jar_path).mapping', |
648 '<(obfuscated_jar_path).usage', | 671 '<(obfuscated_jar_path).usage', |
649 ], | 672 ], |
650 'action': [ | 673 'action': [ |
651 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py', | 674 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py', |
652 | 675 |
653 '--configuration-name', '<(CONFIGURATION_NAME)', | 676 '--configuration-name', '<(CONFIGURATION_NAME)', |
654 | 677 |
655 '--android-sdk', '<(android_sdk)', | 678 '--android-sdk', '<(android_sdk)', |
656 '--android-sdk-tools', '<(android_sdk_tools)', | 679 '--android-sdk-tools', '<(android_sdk_tools)', |
657 '--android-sdk-jar', '<(android_sdk_jar)', | 680 '--android-sdk-jar', '<(android_sdk_jar)', |
658 | 681 |
659 '--input-jars-paths=>(proguard_input_jar_paths)', | 682 '--input-jars-paths=>(proguard_input_jar_paths)', |
| 683 '--proguard-configs=>(proguard_flags_paths)', |
| 684 |
| 685 |
660 '--test-jar-path', '<(test_jar_path)', | 686 '--test-jar-path', '<(test_jar_path)', |
661 '--obfuscated-jar-path', '<(obfuscated_jar_path)', | 687 '--obfuscated-jar-path', '<(obfuscated_jar_path)', |
662 | 688 |
663 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.
jar', | 689 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.
jar', |
664 | 690 |
665 '--proguard-config-files=<(proguard_flags_paths)', | |
666 '--stamp', '<(obfuscate_stamp)', | 691 '--stamp', '<(obfuscate_stamp)', |
667 | 692 |
668 '<@(additional_obfuscate_options)', | 693 '>@(additional_obfuscate_options)', |
669 ], | 694 ], |
670 }, | 695 }, |
671 { | 696 { |
672 'action_name': 'dex_<(_target_name)', | 697 'action_name': 'dex_<(_target_name)', |
673 'variables': { | 698 'variables': { |
674 'output_path': '<(dex_path)', | 699 'output_path': '<(dex_path)', |
675 'dex_input_paths': [ | 700 'dex_input_paths': [ |
676 '>@(apk_dex_input_paths)', | 701 '>@(apk_dex_input_paths)', |
677 '<(jar_path)', | 702 '<(jar_path)', |
678 ], | 703 ], |
679 'proguard_enabled_input_path': '<(obfuscated_jar_path)', | 704 'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
680 }, | 705 }, |
681 'target_conditions': [ | 706 'target_conditions': [ |
682 ['emma_instrument != 0', { | 707 ['emma_instrument != 0', { |
683 'dex_no_locals': 1, | 708 'dex_no_locals': 1, |
684 'dex_input_paths': [ | 709 'dex_input_paths': [ |
685 '<(emma_device_jar)' | 710 '<(emma_device_jar)' |
686 ], | 711 ], |
687 }], | 712 }], |
688 ['is_test_apk == 1 and tested_apk_dex_path != "/"', { | 713 ['is_test_apk == 1 and tested_apk_dex_path != "/"', { |
689 'variables': { | 714 'variables': { |
690 'dex_additional_options': [ | 715 'dex_additional_options': [ |
691 '--excluded-paths-file', '>(tested_apk_dex_path).inputs' | 716 '--excluded-paths-file', '>(tested_apk_dex_path).inputs' |
692 ], | 717 ], |
693 }, | 718 }, |
694 'inputs': [ | 719 'inputs': [ |
695 '>(tested_apk_dex_path).inputs', | 720 '>(tested_apk_dex_path).inputs', |
696 ], | 721 ], |
697 }], | 722 }], |
698 ], | |
699 'conditions': [ | |
700 ['proguard_enabled == "true"', { | 723 ['proguard_enabled == "true"', { |
701 'inputs': [ '<(obfuscate_stamp)' ] | 724 'inputs': [ '<(obfuscate_stamp)' ] |
702 }, { | 725 }, { |
703 'inputs': [ '<(instr_stamp)' ] | 726 'inputs': [ '<(instr_stamp)' ] |
704 }], | 727 }], |
705 ], | 728 ], |
706 'includes': [ 'android/dex_action.gypi' ], | 729 'includes': [ 'android/dex_action.gypi' ], |
707 }, | 730 }, |
708 { | 731 { |
709 'action_name': 'package_resources', | 732 'action_name': 'package_resources', |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 '-DEMMA_INSTRUMENT=<(emma_instrument)', | 811 '-DEMMA_INSTRUMENT=<(emma_instrument)', |
789 '-DEMMA_DEVICE_JAR=<(emma_device_jar)', | 812 '-DEMMA_DEVICE_JAR=<(emma_device_jar)', |
790 | 813 |
791 '-Dbasedir=.', | 814 '-Dbasedir=.', |
792 '-buildfile', | 815 '-buildfile', |
793 '<(DEPTH)/build/android/ant/apk-package.xml', | 816 '<(DEPTH)/build/android/ant/apk-package.xml', |
794 ] | 817 ] |
795 }, | 818 }, |
796 ], | 819 ], |
797 } | 820 } |
OLD | NEW |