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_verify_only%': 0, | 142 'res_v14_verify_only%': 0, |
142 'variables': { | 143 'variables': { |
143 'variables': { | 144 'variables': { |
144 'native_lib_target%': '', | 145 'native_lib_target%': '', |
145 'native_lib_version_name%': '', | 146 'native_lib_version_name%': '', |
146 'use_chromium_linker%' : 0, | 147 'use_chromium_linker%' : 0, |
147 'load_library_from_zip_file%' : 0, | |
148 'use_relocation_packer%' : 0, | 148 'use_relocation_packer%' : 0, |
149 'enable_chromium_linker_tests%': 0, | 149 'enable_chromium_linker_tests%': 0, |
150 'is_test_apk%': 0, | 150 'is_test_apk%': 0, |
151 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', | |
152 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)_abi_<(an droid_app_abi)-unsigned.apk', | |
153 'use_abi_split%': 0, | |
151 }, | 154 }, |
155 'unsigned_apk_path': '<(unsigned_apk_path)', | |
156 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', | |
157 'use_abi_split%': '<(use_abi_split)', | |
152 'conditions': [ | 158 'conditions': [ |
153 ['gyp_managed_install == 1 and native_lib_target != ""', { | 159 ['gyp_managed_install == 1 and native_lib_target != ""', { |
154 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand alone-unsigned.apk', | 160 'conditions': [ |
161 ['use_abi_split == 0', { | |
162 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-s tandalone-unsigned.apk', | |
163 }, { | |
164 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)_a bi_<(android_app_abi)-standalone-unsigned.apk', | |
165 }], | |
166 ], | |
155 }, { | 167 }, { |
156 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', | 168 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', |
157 }], | 169 }], |
158 ['gyp_managed_install == 1', { | 170 ['gyp_managed_install == 1', { |
159 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 171 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
160 }, { | 172 }, { |
161 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 173 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
162 }], | 174 }], |
163 ['is_test_apk == 0 and emma_coverage != 0', { | 175 ['is_test_apk == 0 and emma_coverage != 0', { |
164 'emma_instrument%': 1, | 176 'emma_instrument%': 1, |
165 },{ | 177 },{ |
166 'emma_instrument%': 0, | 178 'emma_instrument%': 0, |
167 }], | 179 }], |
180 # When using abi splits, the abi split is modified by | |
181 # gyp_managed_install rather than the main .apk | |
182 ['use_abi_split == 1', { | |
183 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)', | |
184 }, { | |
185 'managed_input_apk_path': '<(unsigned_apk_path)', | |
186 }], | |
168 ], | 187 ], |
169 }, | 188 }, |
170 'native_lib_target%': '', | 189 'native_lib_target%': '', |
171 'native_lib_version_name%': '', | 190 'native_lib_version_name%': '', |
172 'use_chromium_linker%' : 0, | 191 'use_chromium_linker%' : 0, |
173 'load_library_from_zip_file%' : 0, | 192 'load_library_from_zip_file%' : 0, |
Yaron
2015/05/14 15:32:44
I think it makes sense to rename this throughout.
agrieve1
2015/05/14 15:44:18
I agree we should rename, but didn't want to hold
Yaron
2015/05/14 17:02:54
Acknowledged.
| |
174 'use_relocation_packer%' : 0, | 193 'use_relocation_packer%' : 0, |
175 'enable_chromium_linker_tests%': 0, | 194 'enable_chromium_linker_tests%': 0, |
176 'emma_instrument%': '<(emma_instrument)', | 195 'emma_instrument%': '<(emma_instrument)', |
177 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 196 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
178 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 197 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
198 'unsigned_apk_path': '<(unsigned_apk_path)', | |
199 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', | |
200 'use_abi_split%': '<(use_abi_split)', | |
201 'managed_input_apk_path': '<(managed_input_apk_path)', | |
179 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_ extension)', | 202 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_ extension)', |
180 'extra_native_libs': [], | 203 'extra_native_libs': [], |
181 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_ap p_abi)/native_lib_placeholder.stamp', | 204 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_ap p_abi)/native_lib_placeholder.stamp', |
182 'native_lib_placeholders': [], | 205 'native_lib_placeholders': [], |
206 'main_apk_name': '<(apk_name)', | |
183 }, | 207 }, |
184 # Pass the jar path to the apk's "fake" jar target. This would be better as | 208 # Pass the jar path to the apk's "fake" jar target. This would be better as |
185 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 209 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
186 # cannot be lifted in a dependent to all_dependent_settings. | 210 # cannot be lifted in a dependent to all_dependent_settings. |
187 'all_dependent_settings': { | 211 'all_dependent_settings': { |
188 'conditions': [ | 212 'conditions': [ |
189 ['proguard_enabled == "true"', { | 213 ['proguard_enabled == "true"', { |
190 'variables': { | 214 'variables': { |
191 'proguard_enabled': 'true', | 215 'proguard_enabled': 'true', |
192 } | 216 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 ['create_standalone_apk == 1', { | 500 ['create_standalone_apk == 1', { |
477 'actions': [ | 501 'actions': [ |
478 { | 502 { |
479 'action_name': 'create standalone APK', | 503 'action_name': 'create standalone APK', |
480 'variables': { | 504 'variables': { |
481 'inputs': [ | 505 'inputs': [ |
482 '<(ordered_libraries_file)', | 506 '<(ordered_libraries_file)', |
483 '<(strip_additional_stamp)', | 507 '<(strip_additional_stamp)', |
484 '<(pack_arm_relocations_stamp)', | 508 '<(pack_arm_relocations_stamp)', |
485 ], | 509 ], |
486 'input_apk_path': '<(unsigned_apk_path)', | |
487 'output_apk_path': '<(unsigned_standalone_apk_path)', | 510 'output_apk_path': '<(unsigned_standalone_apk_path)', |
488 'libraries_top_dir%': '<(libraries_top_dir)', | 511 'libraries_top_dir%': '<(libraries_top_dir)', |
512 'input_apk_path': '<(managed_input_apk_path)', | |
489 }, | 513 }, |
490 'includes': [ 'android/create_standalone_apk_action.gypi' ], | 514 'includes': [ 'android/create_standalone_apk_action.gypi' ], |
491 }, | 515 }, |
492 ], | 516 ], |
493 }], | 517 }], |
494 ], | 518 ], |
495 }, { | 519 }, { |
496 # gyp_managed_install != 1 | 520 # gyp_managed_install != 1 |
497 'variables': { | 521 'variables': { |
498 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_ap p_abi)', | 522 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_ap p_abi)', |
499 'package_input_paths': [ | 523 'package_input_paths': [ |
500 '<(strip_additional_stamp)', | 524 '<(strip_additional_stamp)', |
501 '<(pack_arm_relocations_stamp)', | 525 '<(pack_arm_relocations_stamp)', |
502 ], | 526 ], |
503 }, | 527 }, |
504 }], | 528 }], |
505 ], | 529 ], |
506 }], # native_lib_target != '' | 530 }], # native_lib_target != '' |
507 ['gyp_managed_install == 0 or create_standalone_apk == 1', { | 531 ['gyp_managed_install == 0 or create_standalone_apk == 1 or use_abi_split == 1', { |
532 'dependencies': [ | |
533 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar', | |
534 ], | |
535 }], | |
536 ['use_abi_split == 1 or gyp_managed_install == 0 or create_standalone_apk == 1', { | |
508 'actions': [ | 537 'actions': [ |
509 { | 538 { |
510 'action_name': 'finalize standalone apk', | 539 'action_name': 'finalize_base', |
511 'variables': { | 540 'variables': { |
512 'input_apk_path': '<(unsigned_standalone_apk_path)', | |
513 'output_apk_path': '<(final_apk_path)', | 541 'output_apk_path': '<(final_apk_path)', |
542 'conditions': [ | |
543 ['use_abi_split == 0', { | |
544 'input_apk_path': '<(unsigned_standalone_apk_path)', | |
545 'load_library_from_zip': '<(load_library_from_zip_file)', | |
546 }, { | |
547 'input_apk_path': '<(unsigned_apk_path)', | |
548 'load_library_from_zip': 0, | |
549 }] | |
550 ], | |
514 }, | 551 }, |
515 'includes': [ 'android/finalize_apk_action.gypi'] | 552 'includes': [ 'android/finalize_apk_action.gypi'] |
516 }, | 553 }, |
517 ], | 554 ], |
518 'dependencies': [ | 555 }], |
519 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar', | 556 ['use_abi_split == 1', { |
557 'actions': [ | |
558 { | |
559 'action_name': 'generate_split_manifest_<(_target_name)', | |
560 'inputs': [ | |
561 '<(DEPTH)/build/android/gyp/util/build_utils.py', | |
562 '<(DEPTH)/build/android/gyp/generate_split_manifest.py', | |
563 '<(android_manifest_path)', | |
564 ], | |
565 'outputs': [ | |
566 '<(split_android_manifest_path)', | |
567 ], | |
568 'action': [ | |
569 'python', '<(DEPTH)/build/android/gyp/generate_split_manifest.py', | |
570 '--main-manifest', '<(android_manifest_path)', | |
571 '--out-manifest', '<(split_android_manifest_path)', | |
572 '--split', 'abi_<(android_app_abi)', | |
573 ], | |
574 }, | |
575 { | |
576 'variables': { | |
577 'apk_name': '<(main_apk_name)_abi_<(android_app_abi)', | |
578 'asset_location': '', | |
579 'android_manifest_path': '<(split_android_manifest_path)', | |
580 }, | |
581 'includes': [ 'android/package_resources_action.gypi' ], | |
582 }, | |
583 { | |
584 'variables': { | |
585 'apk_name': '<(main_apk_name)_abi_<(android_app_abi)', | |
586 'apk_path': '<(unsigned_abi_split_apk_path)', | |
587 'has_code': 0, | |
588 'native_libs_dir': '<(apk_package_native_libs_dir)', | |
589 'extra_inputs': ['<(native_lib_placeholder_stamp)'], | |
590 }, | |
591 'includes': ['android/apkbuilder_action.gypi'], | |
592 }, | |
593 ], | |
594 }], | |
595 ['use_abi_split == 1 and (gyp_managed_install == 0 or create_standalone_apk == 1)', { | |
596 'actions': [ | |
597 { | |
598 'action_name': 'finalize_split', | |
599 'variables': { | |
600 'load_library_from_zip': '<(load_library_from_zip_file)', | |
601 'output_apk_path': '<(final_abi_split_apk_path)', | |
602 'conditions': [ | |
603 ['gyp_managed_install == 1', { | |
604 'input_apk_path': '<(unsigned_standalone_apk_path)', | |
605 }, { | |
606 'input_apk_path': '<(unsigned_abi_split_apk_path)', | |
607 }], | |
608 ], | |
609 }, | |
610 'includes': [ 'android/finalize_apk_action.gypi'] | |
611 }, | |
520 ], | 612 ], |
521 }], | 613 }], |
522 ['gyp_managed_install == 1', { | 614 ['gyp_managed_install == 1', { |
523 'actions': [ | 615 'actions': [ |
524 { | 616 { |
525 'action_name': 'finalize incomplete apk', | 617 'action_name': 'finalize incomplete apk', |
526 'variables': { | 618 'variables': { |
527 'input_apk_path': '<(unsigned_apk_path)', | 619 'load_library_from_zip': 0, |
Yaron
2015/05/14 15:32:44
Can you add the comment I had or you think it's ob
agrieve1
2015/05/14 15:44:18
I think it's pretty obvious - assuming you underst
| |
620 'input_apk_path': '<(managed_input_apk_path)', | |
528 'output_apk_path': '<(incomplete_apk_path)', | 621 'output_apk_path': '<(incomplete_apk_path)', |
529 }, | 622 }, |
530 'includes': [ 'android/finalize_apk_action.gypi'] | 623 'includes': [ 'android/finalize_apk_action.gypi'] |
531 }, | 624 }, |
532 { | 625 { |
533 'action_name': 'apk_install_<(_target_name)', | 626 'action_name': 'apk_install_<(_target_name)', |
534 'message': 'Installing <(apk_name).apk', | 627 'message': 'Installing <(apk_name).apk', |
535 'inputs': [ | 628 'inputs': [ |
536 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 629 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
537 '<(DEPTH)/build/android/gyp/apk_install.py', | 630 '<(DEPTH)/build/android/gyp/apk_install.py', |
538 '<(build_device_config_path)', | 631 '<(build_device_config_path)', |
539 '<(incomplete_apk_path)', | 632 '<(incomplete_apk_path)', |
540 ], | 633 ], |
541 'outputs': [ | 634 'outputs': [ |
542 '<(apk_install_record)', | 635 '<(apk_install_record)', |
543 ], | 636 ], |
544 'action': [ | 637 'action': [ |
545 'python', '<(DEPTH)/build/android/gyp/apk_install.py', | 638 'python', '<(DEPTH)/build/android/gyp/apk_install.py', |
546 '--apk-path=<(incomplete_apk_path)', | |
547 '--build-device-configuration=<(build_device_config_path)', | 639 '--build-device-configuration=<(build_device_config_path)', |
548 '--install-record=<(apk_install_record)', | 640 '--install-record=<(apk_install_record)', |
549 '--configuration-name=<(CONFIGURATION_NAME)', | 641 '--configuration-name=<(CONFIGURATION_NAME)', |
550 ], | 642 ], |
643 'conditions': [ | |
644 ['use_abi_split == 1', { | |
645 'inputs': [ | |
646 '<(final_apk_path)', | |
647 ], | |
648 'action': [ | |
649 '--apk-path=<(final_apk_path)', | |
650 '--split-apk-path=<(incomplete_apk_path)', | |
651 ], | |
652 }, { | |
653 'action': [ | |
654 '--apk-path=<(incomplete_apk_path)', | |
655 ], | |
656 }] | |
657 ], | |
551 }, | 658 }, |
552 ], | 659 ], |
553 'dependencies': [ | |
554 '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar', | |
555 ], | |
556 }], | 660 }], |
557 ['is_test_apk == 1', { | 661 ['is_test_apk == 1', { |
558 'dependencies': [ | 662 'dependencies': [ |
559 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_comm ands', | 663 '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_comm ands', |
560 '<(DEPTH)/tools/android/android_tools.gyp:android_tools', | 664 '<(DEPTH)/tools/android/android_tools.gyp:android_tools', |
561 ] | 665 ] |
562 }], | 666 }], |
563 ['run_findbugs == 1', { | 667 ['run_findbugs == 1', { |
564 'actions': [ | 668 'actions': [ |
565 { | 669 { |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
872 '>@(dependencies_res_zip_paths)', | 976 '>@(dependencies_res_zip_paths)', |
873 ], | 977 ], |
874 }], | 978 }], |
875 ], | 979 ], |
876 }, | 980 }, |
877 'includes': [ 'android/package_resources_action.gypi' ], | 981 'includes': [ 'android/package_resources_action.gypi' ], |
878 }, | 982 }, |
879 { | 983 { |
880 'variables': { | 984 'variables': { |
881 'apk_path': '<(unsigned_apk_path)', | 985 'apk_path': '<(unsigned_apk_path)', |
882 'native_libs_dir': '<(apk_package_native_libs_dir)', | |
883 'conditions': [ | 986 'conditions': [ |
884 ['native_lib_target != ""', { | 987 ['native_lib_target != ""', { |
885 'extra_inputs': ['<(native_lib_placeholder_stamp)'], | 988 'extra_inputs': ['<(native_lib_placeholder_stamp)'], |
886 }], | 989 }], |
990 ['use_abi_split == 0', { | |
991 'native_libs_dir': '<(apk_package_native_libs_dir)', | |
992 }, { | |
993 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res', | |
994 }], | |
887 ], | 995 ], |
888 }, | 996 }, |
889 'includes': ['android/apkbuilder_action.gypi'], | 997 'includes': ['android/apkbuilder_action.gypi'], |
890 }, | 998 }, |
891 ], | 999 ], |
892 } | 1000 } |
OLD | NEW |