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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 'version_stamp': '<(intermediate_dir)/version.stamp', | 119 'version_stamp': '<(intermediate_dir)/version.stamp', |
120 'javac_includes': [], | 120 'javac_includes': [], |
121 'jar_excluded_classes': [], | 121 'jar_excluded_classes': [], |
122 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', | 122 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', |
123 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 123 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
124 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 124 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
125 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', | 125 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', |
126 'dex_path': '<(intermediate_dir)/classes.dex', | 126 'dex_path': '<(intermediate_dir)/classes.dex', |
127 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', | 127 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', |
128 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', | 128 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', |
| 129 'split_android_manifest_path': '<(intermediate_dir)/split-manifests/<(androi
d_app_abi)/AndroidManifest.xml', |
129 'push_stamp': '<(intermediate_dir)/push.stamp', | 130 'push_stamp': '<(intermediate_dir)/push.stamp', |
130 'link_stamp': '<(intermediate_dir)/link.stamp', | 131 'link_stamp': '<(intermediate_dir)/link.stamp', |
131 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip', | 132 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip', |
132 'shared_resources%': 0, | 133 'shared_resources%': 0, |
133 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', | |
134 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | 134 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
| 135 'final_abi_split_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name)-abi-<(android_
app_abi).apk', |
135 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', | 136 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', |
136 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', | 137 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', |
137 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_t
arget_name)/<(CONFIGURATION_NAME)', | 138 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_t
arget_name)/<(CONFIGURATION_NAME)', |
138 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', | 139 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', |
139 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', | 140 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', |
140 'create_standalone_apk%': 1, | 141 'create_standalone_apk%': 1, |
141 'res_v14_skip%': 0, | 142 'res_v14_skip%': 0, |
142 'res_v14_verify_only%': 0, | 143 'res_v14_verify_only%': 0, |
143 'variables': { | 144 'variables': { |
144 'variables': { | 145 'variables': { |
145 'native_lib_target%': '', | 146 'native_lib_target%': '', |
146 'native_lib_version_name%': '', | 147 'native_lib_version_name%': '', |
147 'use_chromium_linker%' : 0, | 148 'use_chromium_linker%' : 0, |
148 'load_library_from_zip_file%' : 0, | |
149 'use_relocation_packer%' : 0, | 149 'use_relocation_packer%' : 0, |
150 'enable_chromium_linker_tests%': 0, | 150 'enable_chromium_linker_tests%': 0, |
151 'is_test_apk%': 0, | 151 'is_test_apk%': 0, |
| 152 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', |
| 153 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(an
droid_app_abi)-unsigned.apk', |
| 154 'create_abi_split%': 0, |
152 }, | 155 }, |
| 156 'unsigned_apk_path': '<(unsigned_apk_path)', |
| 157 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', |
| 158 'create_abi_split%': '<(create_abi_split)', |
153 'conditions': [ | 159 'conditions': [ |
154 ['gyp_managed_install == 1 and native_lib_target != ""', { | 160 ['gyp_managed_install == 1 and native_lib_target != ""', { |
155 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand
alone-unsigned.apk', | 161 'conditions': [ |
| 162 ['create_abi_split == 0', { |
| 163 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-s
tandalone-unsigned.apk', |
| 164 }, { |
| 165 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-a
bi-<(android_app_abi)-standalone-unsigned.apk', |
| 166 }], |
| 167 ], |
156 }, { | 168 }, { |
157 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', | 169 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', |
158 }], | 170 }], |
159 ['gyp_managed_install == 1', { | 171 ['gyp_managed_install == 1', { |
160 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 172 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
161 }, { | 173 }, { |
162 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 174 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
163 }], | 175 }], |
164 ['is_test_apk == 0 and emma_coverage != 0', { | 176 ['is_test_apk == 0 and emma_coverage != 0', { |
165 'emma_instrument%': 1, | 177 'emma_instrument%': 1, |
166 },{ | 178 },{ |
167 'emma_instrument%': 0, | 179 'emma_instrument%': 0, |
168 }], | 180 }], |
| 181 # When using abi splits, the abi split is modified by |
| 182 # gyp_managed_install rather than the main .apk |
| 183 ['create_abi_split == 1', { |
| 184 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)', |
| 185 }, { |
| 186 'managed_input_apk_path': '<(unsigned_apk_path)', |
| 187 }], |
169 ], | 188 ], |
170 }, | 189 }, |
171 'native_lib_target%': '', | 190 'native_lib_target%': '', |
172 'native_lib_version_name%': '', | 191 'native_lib_version_name%': '', |
173 'use_chromium_linker%' : 0, | 192 'use_chromium_linker%' : 0, |
174 'load_library_from_zip_file%' : 0, | 193 'load_library_from_zip_file%' : 0, |
175 'use_relocation_packer%' : 0, | 194 'use_relocation_packer%' : 0, |
176 'enable_chromium_linker_tests%': 0, | 195 'enable_chromium_linker_tests%': 0, |
177 'emma_instrument%': '<(emma_instrument)', | 196 'emma_instrument%': '<(emma_instrument)', |
178 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 197 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
179 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 198 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
| 199 'unsigned_apk_path': '<(unsigned_apk_path)', |
| 200 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', |
| 201 'create_abi_split%': '<(create_abi_split)', |
| 202 'managed_input_apk_path': '<(managed_input_apk_path)', |
180 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_
extension)', | 203 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_
extension)', |
181 'extra_native_libs': [], | 204 'extra_native_libs': [], |
182 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_ap
p_abi)/native_lib_placeholder.stamp', | 205 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_ap
p_abi)/native_lib_placeholder.stamp', |
183 'native_lib_placeholders': [], | 206 'native_lib_placeholders': [], |
| 207 'main_apk_name': '<(apk_name)', |
184 }, | 208 }, |
185 # Pass the jar path to the apk's "fake" jar target. This would be better as | 209 # Pass the jar path to the apk's "fake" jar target. This would be better as |
186 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 210 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
187 # cannot be lifted in a dependent to all_dependent_settings. | 211 # cannot be lifted in a dependent to all_dependent_settings. |
188 'all_dependent_settings': { | 212 'all_dependent_settings': { |
189 'conditions': [ | 213 'conditions': [ |
190 ['proguard_enabled == "true"', { | 214 ['proguard_enabled == "true"', { |
191 'variables': { | 215 'variables': { |
192 'proguard_enabled': 'true', | 216 'proguard_enabled': 'true', |
193 } | 217 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 ['create_standalone_apk == 1', { | 501 ['create_standalone_apk == 1', { |
478 'actions': [ | 502 'actions': [ |
479 { | 503 { |
480 'action_name': 'create standalone APK', | 504 'action_name': 'create standalone APK', |
481 'variables': { | 505 'variables': { |
482 'inputs': [ | 506 'inputs': [ |
483 '<(ordered_libraries_file)', | 507 '<(ordered_libraries_file)', |
484 '<(strip_additional_stamp)', | 508 '<(strip_additional_stamp)', |
485 '<(pack_arm_relocations_stamp)', | 509 '<(pack_arm_relocations_stamp)', |
486 ], | 510 ], |
487 'input_apk_path': '<(unsigned_apk_path)', | |
488 'output_apk_path': '<(unsigned_standalone_apk_path)', | 511 'output_apk_path': '<(unsigned_standalone_apk_path)', |
489 'libraries_top_dir%': '<(libraries_top_dir)', | 512 'libraries_top_dir%': '<(libraries_top_dir)', |
| 513 'input_apk_path': '<(managed_input_apk_path)', |
490 }, | 514 }, |
491 'includes': [ 'android/create_standalone_apk_action.gypi' ], | 515 'includes': [ 'android/create_standalone_apk_action.gypi' ], |
492 }, | 516 }, |
493 ], | 517 ], |
494 }], | 518 }], |
495 ], | 519 ], |
496 }, { | 520 }, { |
497 # gyp_managed_install != 1 | 521 # gyp_managed_install != 1 |
498 'variables': { | 522 'variables': { |
499 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_ap
p_abi)', | 523 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_ap
p_abi)', |
500 'package_input_paths': [ | 524 'package_input_paths': [ |
501 '<(strip_additional_stamp)', | 525 '<(strip_additional_stamp)', |
502 '<(pack_arm_relocations_stamp)', | 526 '<(pack_arm_relocations_stamp)', |
503 ], | 527 ], |
504 }, | 528 }, |
505 }], | 529 }], |
506 ], | 530 ], |
507 }], # native_lib_target != '' | 531 }], # native_lib_target != '' |
508 ['gyp_managed_install == 0 or create_standalone_apk == 1', { | 532 ['gyp_managed_install == 0 or create_standalone_apk == 1 or create_abi_split
== 1', { |
| 533 'dependencies': [ |
| 534 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar', |
| 535 ], |
| 536 }], |
| 537 ['create_abi_split == 1 or gyp_managed_install == 0 or create_standalone_apk
== 1', { |
509 'actions': [ | 538 'actions': [ |
510 { | 539 { |
511 'action_name': 'finalize standalone apk', | 540 'action_name': 'finalize_base', |
512 'variables': { | 541 'variables': { |
513 'input_apk_path': '<(unsigned_standalone_apk_path)', | |
514 'output_apk_path': '<(final_apk_path)', | 542 'output_apk_path': '<(final_apk_path)', |
| 543 'conditions': [ |
| 544 ['create_abi_split == 0', { |
| 545 'input_apk_path': '<(unsigned_standalone_apk_path)', |
| 546 'load_library_from_zip': '<(load_library_from_zip_file)', |
| 547 }, { |
| 548 'input_apk_path': '<(unsigned_apk_path)', |
| 549 'load_library_from_zip': 0, |
| 550 }] |
| 551 ], |
515 }, | 552 }, |
516 'includes': [ 'android/finalize_apk_action.gypi'] | 553 'includes': [ 'android/finalize_apk_action.gypi'] |
517 }, | 554 }, |
518 ], | 555 ], |
519 'dependencies': [ | 556 }], |
520 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar', | 557 ['create_abi_split == 1', { |
| 558 'actions': [ |
| 559 { |
| 560 'action_name': 'generate_split_manifest_<(_target_name)', |
| 561 'inputs': [ |
| 562 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 563 '<(DEPTH)/build/android/gyp/generate_split_manifest.py', |
| 564 '<(android_manifest_path)', |
| 565 ], |
| 566 'outputs': [ |
| 567 '<(split_android_manifest_path)', |
| 568 ], |
| 569 'action': [ |
| 570 'python', '<(DEPTH)/build/android/gyp/generate_split_manifest.py', |
| 571 '--main-manifest', '<(android_manifest_path)', |
| 572 '--out-manifest', '<(split_android_manifest_path)', |
| 573 '--split', 'abi_<(android_app_abi)', |
| 574 ], |
| 575 }, |
| 576 { |
| 577 'variables': { |
| 578 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)', |
| 579 'asset_location': '', |
| 580 'android_manifest_path': '<(split_android_manifest_path)', |
| 581 }, |
| 582 'includes': [ 'android/package_resources_action.gypi' ], |
| 583 }, |
| 584 { |
| 585 'variables': { |
| 586 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)', |
| 587 'apk_path': '<(unsigned_abi_split_apk_path)', |
| 588 'has_code': 0, |
| 589 'native_libs_dir': '<(apk_package_native_libs_dir)', |
| 590 'extra_inputs': ['<(native_lib_placeholder_stamp)'], |
| 591 }, |
| 592 'includes': ['android/apkbuilder_action.gypi'], |
| 593 }, |
| 594 ], |
| 595 }], |
| 596 ['create_abi_split == 1 and (gyp_managed_install == 0 or create_standalone_a
pk == 1)', { |
| 597 'actions': [ |
| 598 { |
| 599 'action_name': 'finalize_split', |
| 600 'variables': { |
| 601 'load_library_from_zip': '<(load_library_from_zip_file)', |
| 602 'output_apk_path': '<(final_abi_split_apk_path)', |
| 603 'conditions': [ |
| 604 ['gyp_managed_install == 1', { |
| 605 'input_apk_path': '<(unsigned_standalone_apk_path)', |
| 606 }, { |
| 607 'input_apk_path': '<(unsigned_abi_split_apk_path)', |
| 608 }], |
| 609 ], |
| 610 }, |
| 611 'includes': [ 'android/finalize_apk_action.gypi'] |
| 612 }, |
521 ], | 613 ], |
522 }], | 614 }], |
523 ['gyp_managed_install == 1', { | 615 ['gyp_managed_install == 1', { |
524 'actions': [ | 616 'actions': [ |
525 { | 617 { |
526 'action_name': 'finalize incomplete apk', | 618 'action_name': 'finalize incomplete apk', |
527 'variables': { | 619 'variables': { |
528 'input_apk_path': '<(unsigned_apk_path)', | 620 'load_library_from_zip': 0, |
| 621 'input_apk_path': '<(managed_input_apk_path)', |
529 'output_apk_path': '<(incomplete_apk_path)', | 622 'output_apk_path': '<(incomplete_apk_path)', |
530 }, | 623 }, |
531 'includes': [ 'android/finalize_apk_action.gypi'] | 624 'includes': [ 'android/finalize_apk_action.gypi'] |
532 }, | 625 }, |
533 { | 626 { |
534 'action_name': 'apk_install_<(_target_name)', | 627 'action_name': 'apk_install_<(_target_name)', |
535 'message': 'Installing <(apk_name).apk', | 628 'message': 'Installing <(apk_name).apk', |
536 'inputs': [ | 629 'inputs': [ |
537 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 630 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
538 '<(DEPTH)/build/android/gyp/apk_install.py', | 631 '<(DEPTH)/build/android/gyp/apk_install.py', |
539 '<(build_device_config_path)', | 632 '<(build_device_config_path)', |
540 '<(incomplete_apk_path)', | 633 '<(incomplete_apk_path)', |
541 ], | 634 ], |
542 'outputs': [ | 635 'outputs': [ |
543 '<(apk_install_record)', | 636 '<(apk_install_record)', |
544 ], | 637 ], |
545 'action': [ | 638 'action': [ |
546 'python', '<(DEPTH)/build/android/gyp/apk_install.py', | 639 'python', '<(DEPTH)/build/android/gyp/apk_install.py', |
547 '--apk-path=<(incomplete_apk_path)', | |
548 '--build-device-configuration=<(build_device_config_path)', | 640 '--build-device-configuration=<(build_device_config_path)', |
549 '--install-record=<(apk_install_record)', | 641 '--install-record=<(apk_install_record)', |
550 '--configuration-name=<(CONFIGURATION_NAME)', | 642 '--configuration-name=<(CONFIGURATION_NAME)', |
551 ], | 643 ], |
| 644 'conditions': [ |
| 645 ['create_abi_split == 1', { |
| 646 'inputs': [ |
| 647 '<(final_apk_path)', |
| 648 ], |
| 649 'action': [ |
| 650 '--apk-path=<(final_apk_path)', |
| 651 '--split-apk-path=<(incomplete_apk_path)', |
| 652 ], |
| 653 }, { |
| 654 'action': [ |
| 655 '--apk-path=<(incomplete_apk_path)', |
| 656 ], |
| 657 }] |
| 658 ], |
552 }, | 659 }, |
553 ], | 660 ], |
554 'dependencies': [ | |
555 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar', | |
556 ], | |
557 }], | 661 }], |
558 ['is_test_apk == 1', { | 662 ['is_test_apk == 1', { |
559 'dependencies': [ | 663 'dependencies': [ |
560 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_comm
ands', | 664 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_comm
ands', |
561 '<(DEPTH)/tools/android/android_tools.gyp:android_tools', | 665 '<(DEPTH)/tools/android/android_tools.gyp:android_tools', |
562 ] | 666 ] |
563 }], | 667 }], |
564 ['run_findbugs == 1', { | 668 ['run_findbugs == 1', { |
565 'actions': [ | 669 'actions': [ |
566 { | 670 { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 '>@(dependencies_res_zip_paths)', | 979 '>@(dependencies_res_zip_paths)', |
876 ], | 980 ], |
877 }], | 981 }], |
878 ], | 982 ], |
879 }, | 983 }, |
880 'includes': [ 'android/package_resources_action.gypi' ], | 984 'includes': [ 'android/package_resources_action.gypi' ], |
881 }, | 985 }, |
882 { | 986 { |
883 'variables': { | 987 'variables': { |
884 'apk_path': '<(unsigned_apk_path)', | 988 'apk_path': '<(unsigned_apk_path)', |
885 'native_libs_dir': '<(apk_package_native_libs_dir)', | |
886 'conditions': [ | 989 'conditions': [ |
887 ['native_lib_target != ""', { | 990 ['native_lib_target != ""', { |
888 'extra_inputs': ['<(native_lib_placeholder_stamp)'], | 991 'extra_inputs': ['<(native_lib_placeholder_stamp)'], |
889 }], | 992 }], |
| 993 ['create_abi_split == 0', { |
| 994 'native_libs_dir': '<(apk_package_native_libs_dir)', |
| 995 }, { |
| 996 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res', |
| 997 }], |
890 ], | 998 ], |
891 }, | 999 }, |
892 'includes': ['android/apkbuilder_action.gypi'], | 1000 'includes': ['android/apkbuilder_action.gypi'], |
893 }, | 1001 }, |
894 ], | 1002 ], |
895 } | 1003 } |
OLD | NEW |