Chromium Code Reviews| 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', | |
|
Yaron
2014/06/11 00:45:26
How is this used?
cjhopman
2014/06/12 20:36:45
This sets proguard_enabled to 'true' in the test a
Yaron
2014/06/12 23:23:16
Oh, this is for the dex_action?
| |
| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 { | 590 { |
| 582 'action_name': 'jar_<(_target_name)', | 591 'action_name': 'jar_<(_target_name)', |
| 583 'message': 'Creating <(_target_name) jar', | 592 'message': 'Creating <(_target_name) jar', |
| 584 'inputs': [ | 593 'inputs': [ |
| 585 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 594 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 586 '<(DEPTH)/build/android/gyp/util/md5_check.py', | 595 '<(DEPTH)/build/android/gyp/util/md5_check.py', |
| 587 '<(DEPTH)/build/android/gyp/jar.py', | 596 '<(DEPTH)/build/android/gyp/jar.py', |
| 588 '<(instr_stamp)', | 597 '<(instr_stamp)', |
| 589 ], | 598 ], |
| 590 'outputs': [ | 599 'outputs': [ |
| 600 '<(jar_path)', | |
| 591 '<(jar_stamp)', | 601 '<(jar_stamp)', |
| 592 '<(jar_path)', | 602 '<(jar_path)', |
| 593 ], | 603 ], |
| 594 'action': [ | 604 'action': [ |
| 595 'python', '<(DEPTH)/build/android/gyp/jar.py', | 605 'python', '<(DEPTH)/build/android/gyp/jar.py', |
| 596 '--classes-dir=<(classes_final_dir)', | 606 '--classes-dir=<(classes_final_dir)', |
| 597 '--jar-path=<(jar_path)', | 607 '--jar-path=<(jar_path)', |
| 598 '--excluded-classes=<(jar_excluded_classes)', | 608 '--excluded-classes=<(jar_excluded_classes)', |
| 599 '--stamp=<(jar_stamp)', | 609 '--stamp=<(jar_stamp)', |
| 600 ] | 610 ] |
| 601 }, | 611 }, |
| 602 { | 612 { |
| 603 'action_name': 'ant_obfuscate_<(_target_name)', | 613 'action_name': 'ant_obfuscate_<(_target_name)', |
| 604 'message': 'Obfuscating <(_target_name)', | 614 'message': 'Obfuscating <(_target_name)', |
| 605 'variables': { | 615 'variables': { |
| 606 'additional_obfuscate_options': [], | 616 'additional_obfuscate_options': [], |
| 617 'additional_obfuscate_input_paths': [], | |
| 607 'proguard_out_dir': '<(intermediate_dir)/proguard', | 618 'proguard_out_dir': '<(intermediate_dir)/proguard', |
| 608 'proguard_input_jar_paths': [ | 619 'proguard_input_jar_paths': [ |
| 609 '>@(input_jars_paths)', | 620 '>@(input_jars_paths)', |
| 610 '<(jar_path)', | 621 '<(jar_path)', |
| 611 ], | 622 ], |
| 612 'conditions': [ | 623 'target_conditions': [ |
| 613 ['is_test_apk == 1', { | 624 ['is_test_apk == 1', { |
| 614 'additional_obfuscate_options': [ | 625 'additional_obfuscate_options': [ |
| 626 '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_p ath)', | |
| 615 '--testapp', | 627 '--testapp', |
| 616 ], | 628 ], |
| 629 'additional_obfuscate_input_paths': [ | |
| 630 '>(tested_apk_obfuscated_jar_path).info', | |
| 631 ], | |
| 617 }], | 632 }], |
| 618 ['proguard_enabled == "true"', { | 633 ['proguard_enabled == "true"', { |
| 619 'additional_obfuscate_options': [ | 634 'additional_obfuscate_options': [ |
| 620 '--proguard-enabled', | 635 '--proguard-enabled', |
| 621 ], | 636 ], |
| 622 }], | 637 }], |
| 623 ], | 638 ], |
| 639 'obfuscate_input_jars_paths': [ | |
| 640 '>@(input_jars_paths)', | |
| 641 '<(jar_path)', | |
| 642 ], | |
| 624 }, | 643 }, |
| 625 'conditions': [ | 644 'conditions': [ |
| 626 ['is_test_apk == 1', { | 645 ['is_test_apk == 1', { |
| 627 'outputs': [ | 646 'outputs': [ |
| 628 '<(test_jar_path)', | 647 '<(test_jar_path)', |
| 629 ], | 648 ], |
| 630 }], | 649 }], |
| 631 ], | 650 ], |
| 632 'inputs': [ | 651 'inputs': [ |
| 633 '<(DEPTH)/build/android/gyp/apk_obfuscate.py', | 652 '<(DEPTH)/build/android/gyp/apk_obfuscate.py', |
| 634 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 653 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 635 '>@(proguard_flags_paths)', | 654 '>@(proguard_flags_paths)', |
| 655 '>@(obfuscate_input_jars_paths)', | |
| 656 '>@(additional_obfuscate_input_paths)', | |
| 636 '<(instr_stamp)', | 657 '<(instr_stamp)', |
| 637 ], | 658 ], |
| 638 'outputs': [ | 659 '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)', | 660 '<(obfuscate_stamp)', |
| 642 | 661 |
| 643 # In non-Release builds, these paths will all be empty files. | 662 # In non-Release builds, these paths will all be empty files. |
| 644 '<(obfuscated_jar_path)', | 663 '<(obfuscated_jar_path)', |
| 664 '<(obfuscated_jar_path).info', | |
| 645 '<(obfuscated_jar_path).dump', | 665 '<(obfuscated_jar_path).dump', |
| 646 '<(obfuscated_jar_path).seeds', | 666 '<(obfuscated_jar_path).seeds', |
| 647 '<(obfuscated_jar_path).mapping', | 667 '<(obfuscated_jar_path).mapping', |
| 648 '<(obfuscated_jar_path).usage', | 668 '<(obfuscated_jar_path).usage', |
| 649 ], | 669 ], |
| 650 'action': [ | 670 'action': [ |
| 651 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py', | 671 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py', |
| 652 | 672 |
| 653 '--configuration-name', '<(CONFIGURATION_NAME)', | 673 '--configuration-name', '<(CONFIGURATION_NAME)', |
| 654 | 674 |
| 655 '--android-sdk', '<(android_sdk)', | 675 '--android-sdk', '<(android_sdk)', |
| 656 '--android-sdk-tools', '<(android_sdk_tools)', | 676 '--android-sdk-tools', '<(android_sdk_tools)', |
| 657 '--android-sdk-jar', '<(android_sdk_jar)', | 677 '--android-sdk-jar', '<(android_sdk_jar)', |
| 658 | 678 |
| 659 '--input-jars-paths=>(proguard_input_jar_paths)', | 679 '--input-jars-paths=>(proguard_input_jar_paths)', |
| 680 '--proguard-configs=>(proguard_flags_paths)', | |
| 681 | |
| 682 | |
| 660 '--test-jar-path', '<(test_jar_path)', | 683 '--test-jar-path', '<(test_jar_path)', |
| 661 '--obfuscated-jar-path', '<(obfuscated_jar_path)', | 684 '--obfuscated-jar-path', '<(obfuscated_jar_path)', |
| 662 | 685 |
| 663 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard. jar', | 686 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard. jar', |
| 664 | 687 |
| 665 '--proguard-config-files=<(proguard_flags_paths)', | |
| 666 '--stamp', '<(obfuscate_stamp)', | 688 '--stamp', '<(obfuscate_stamp)', |
| 667 | 689 |
| 668 '<@(additional_obfuscate_options)', | 690 '>@(additional_obfuscate_options)', |
| 669 ], | 691 ], |
| 670 }, | 692 }, |
| 671 { | 693 { |
| 672 'action_name': 'dex_<(_target_name)', | 694 'action_name': 'dex_<(_target_name)', |
| 673 'variables': { | 695 'variables': { |
| 674 'output_path': '<(dex_path)', | 696 'output_path': '<(dex_path)', |
| 675 'dex_input_paths': [ | 697 'dex_input_paths': [ |
| 676 '>@(apk_dex_input_paths)', | 698 '>@(apk_dex_input_paths)', |
| 677 '<(jar_path)', | 699 '<(jar_path)', |
| 678 ], | 700 ], |
| 679 'proguard_enabled_input_path': '<(obfuscated_jar_path)', | 701 'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
| 680 }, | 702 }, |
| 681 'target_conditions': [ | 703 'target_conditions': [ |
| 682 ['emma_instrument != 0', { | 704 ['emma_instrument != 0', { |
| 683 'dex_no_locals': 1, | 705 'dex_no_locals': 1, |
| 684 'dex_input_paths': [ | 706 'dex_input_paths': [ |
| 685 '<(emma_device_jar)' | 707 '<(emma_device_jar)' |
| 686 ], | 708 ], |
| 687 }], | 709 }], |
| 688 ['is_test_apk == 1 and tested_apk_dex_path != "/"', { | 710 ['is_test_apk == 1 and tested_apk_dex_path != "/"', { |
| 689 'variables': { | 711 'variables': { |
| 690 'dex_additional_options': [ | 712 'dex_additional_options': [ |
| 691 '--excluded-paths-file', '>(tested_apk_dex_path).inputs' | 713 '--excluded-paths-file', '>(tested_apk_dex_path).inputs' |
| 692 ], | 714 ], |
| 693 }, | 715 }, |
| 694 'inputs': [ | 716 'inputs': [ |
| 695 '>(tested_apk_dex_path).inputs', | 717 '>(tested_apk_dex_path).inputs', |
| 696 ], | 718 ], |
| 697 }], | 719 }], |
| 698 ], | |
| 699 'conditions': [ | |
| 700 ['proguard_enabled == "true"', { | 720 ['proguard_enabled == "true"', { |
| 701 'inputs': [ '<(obfuscate_stamp)' ] | 721 'inputs': [ '<(obfuscate_stamp)' ] |
| 702 }, { | 722 }, { |
| 703 'inputs': [ '<(instr_stamp)' ] | 723 'inputs': [ '<(instr_stamp)' ] |
| 704 }], | 724 }], |
| 705 ], | 725 ], |
| 706 'includes': [ 'android/dex_action.gypi' ], | 726 'includes': [ 'android/dex_action.gypi' ], |
| 707 }, | 727 }, |
| 708 { | 728 { |
| 709 'action_name': 'package_resources', | 729 'action_name': 'package_resources', |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 788 '-DEMMA_INSTRUMENT=<(emma_instrument)', | 808 '-DEMMA_INSTRUMENT=<(emma_instrument)', |
| 789 '-DEMMA_DEVICE_JAR=<(emma_device_jar)', | 809 '-DEMMA_DEVICE_JAR=<(emma_device_jar)', |
| 790 | 810 |
| 791 '-Dbasedir=.', | 811 '-Dbasedir=.', |
| 792 '-buildfile', | 812 '-buildfile', |
| 793 '<(DEPTH)/build/android/ant/apk-package.xml', | 813 '<(DEPTH)/build/android/ant/apk-package.xml', |
| 794 ] | 814 ] |
| 795 }, | 815 }, |
| 796 ], | 816 ], |
| 797 } | 817 } |
| OLD | NEW |