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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 # code. This allows a test APK to inject a Linker.TestRunner instance at | 63 # code. This allows a test APK to inject a Linker.TestRunner instance at |
64 # runtime. Should only be used by the chromium_linker_test_apk target!! | 64 # runtime. Should only be used by the chromium_linker_test_apk target!! |
65 # never_lint - Set to 1 to not run lint on this target. | 65 # never_lint - Set to 1 to not run lint on this target. |
66 # java_in_dir_suffix - To override the /src suffix on java_in_dir. | 66 # java_in_dir_suffix - To override the /src suffix on java_in_dir. |
67 # app_manifest_version_name - set the apps 'human readable' version number. | 67 # app_manifest_version_name - set the apps 'human readable' version number. |
68 # app_manifest_version_code - set the apps version number. | 68 # app_manifest_version_code - set the apps version number. |
69 { | 69 { |
70 'variables': { | 70 'variables': { |
71 'tested_apk_obfuscated_jar_path%': '/', | 71 'tested_apk_obfuscated_jar_path%': '/', |
72 'tested_apk_dex_path%': '/', | 72 'tested_apk_dex_path%': '/', |
| 73 'tested_apk_is_multidex%': 0, |
73 'additional_input_paths': [], | 74 'additional_input_paths': [], |
74 'create_density_splits%': 0, | 75 'create_density_splits%': 0, |
75 'language_splits': [], | 76 'language_splits': [], |
76 'input_jars_paths': [], | 77 'input_jars_paths': [], |
77 'library_dexed_jars_paths': [], | 78 'library_dexed_jars_paths': [], |
| 79 'main_dex_list_path': '<(intermediate_dir)/main_dex_list.txt', |
| 80 'main_dex_list_paths': ['<(main_dex_list_path)'], |
78 'additional_src_dirs': [], | 81 'additional_src_dirs': [], |
79 'generated_src_dirs': [], | 82 'generated_src_dirs': [], |
80 'app_manifest_version_name%': '<(android_app_version_name)', | 83 'app_manifest_version_name%': '<(android_app_version_name)', |
81 'app_manifest_version_code%': '<(android_app_version_code)', | 84 'app_manifest_version_code%': '<(android_app_version_code)', |
82 # aapt generates this proguard.txt. | 85 # aapt generates this proguard.txt. |
83 'generated_proguard_file': '<(intermediate_dir)/proguard.txt', | 86 'generated_proguard_file': '<(intermediate_dir)/proguard.txt', |
84 'proguard_enabled%': 'false', | 87 'proguard_enabled%': 'false', |
85 'proguard_flags_paths': ['<(generated_proguard_file)'], | 88 'proguard_flags_paths': ['<(generated_proguard_file)'], |
86 'jar_name': 'chromium_apk_<(_target_name).jar', | 89 'jar_name': 'chromium_apk_<(_target_name).jar', |
87 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', | 90 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 'strip_stamp': '<(intermediate_dir)/strip.stamp', | 127 'strip_stamp': '<(intermediate_dir)/strip.stamp', |
125 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries', | 128 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries', |
126 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp', | 129 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp', |
127 'version_stamp': '<(intermediate_dir)/version.stamp', | 130 'version_stamp': '<(intermediate_dir)/version.stamp', |
128 'javac_includes': [], | 131 'javac_includes': [], |
129 'jar_excluded_classes': [], | 132 'jar_excluded_classes': [], |
130 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', | 133 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', |
131 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 134 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
132 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 135 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
133 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', | 136 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', |
134 'dex_path': '<(intermediate_dir)/classes.dex', | 137 'enable_multidex%': 0, |
135 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', | 138 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', |
136 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', | 139 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', |
137 'split_android_manifest_path': '<(intermediate_dir)/split-manifests/<(androi
d_app_abi)/AndroidManifest.xml', | 140 'split_android_manifest_path': '<(intermediate_dir)/split-manifests/<(androi
d_app_abi)/AndroidManifest.xml', |
138 'push_stamp': '<(intermediate_dir)/push.stamp', | 141 'push_stamp': '<(intermediate_dir)/push.stamp', |
139 'link_stamp': '<(intermediate_dir)/link.stamp', | 142 'link_stamp': '<(intermediate_dir)/link.stamp', |
140 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip', | 143 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip', |
141 'shared_resources%': 0, | 144 'shared_resources%': 0, |
142 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', | 145 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
143 'final_apk_path_no_extension%': '<(PRODUCT_DIR)/apks/<(apk_name)', | 146 'final_apk_path_no_extension%': '<(PRODUCT_DIR)/apks/<(apk_name)', |
144 'final_abi_split_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name)-abi-<(android_
app_abi).apk', | 147 'final_abi_split_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name)-abi-<(android_
app_abi).apk', |
145 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', | 148 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', |
146 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', | 149 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', |
147 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_t
arget_name)/<(CONFIGURATION_NAME)', | 150 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_t
arget_name)/<(CONFIGURATION_NAME)', |
148 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', | 151 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', |
149 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', | 152 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', |
150 'create_standalone_apk%': 1, | 153 'create_standalone_apk%': 1, |
151 'res_v14_skip%': 0, | 154 'res_v14_skip%': 0, |
152 'variables': { | 155 'variables': { |
153 'variables': { | 156 'variables': { |
154 'native_lib_target%': '', | 157 'native_lib_target%': '', |
155 'native_lib_version_name%': '', | 158 'native_lib_version_name%': '', |
156 'use_chromium_linker%' : 0, | 159 'use_chromium_linker%' : 0, |
157 'use_relocation_packer%' : 0, | 160 'use_relocation_packer%' : 0, |
158 'enable_chromium_linker_tests%': 0, | 161 'enable_chromium_linker_tests%': 0, |
159 'is_test_apk%': 0, | 162 'is_test_apk%': 0, |
160 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', | 163 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', |
161 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(an
droid_app_abi)-unsigned.apk', | 164 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(an
droid_app_abi)-unsigned.apk', |
162 'create_abi_split%': 0, | 165 'create_abi_split%': 0, |
| 166 'enable_multidex%': 0, |
163 }, | 167 }, |
164 'unsigned_apk_path': '<(unsigned_apk_path)', | 168 'unsigned_apk_path': '<(unsigned_apk_path)', |
165 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', | 169 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', |
166 'create_abi_split%': '<(create_abi_split)', | 170 'create_abi_split%': '<(create_abi_split)', |
167 'conditions': [ | 171 'conditions': [ |
168 ['gyp_managed_install == 1 and native_lib_target != ""', { | 172 ['gyp_managed_install == 1 and native_lib_target != ""', { |
169 'conditions': [ | 173 'conditions': [ |
170 ['create_abi_split == 0', { | 174 ['create_abi_split == 0', { |
171 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-s
tandalone-unsigned.apk', | 175 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-s
tandalone-unsigned.apk', |
172 }, { | 176 }, { |
(...skipping 13 matching lines...) Expand all Loading... |
186 },{ | 190 },{ |
187 'emma_instrument%': 0, | 191 'emma_instrument%': 0, |
188 }], | 192 }], |
189 # When using abi splits, the abi split is modified by | 193 # When using abi splits, the abi split is modified by |
190 # gyp_managed_install rather than the main .apk | 194 # gyp_managed_install rather than the main .apk |
191 ['create_abi_split == 1', { | 195 ['create_abi_split == 1', { |
192 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)', | 196 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)', |
193 }, { | 197 }, { |
194 'managed_input_apk_path': '<(unsigned_apk_path)', | 198 'managed_input_apk_path': '<(unsigned_apk_path)', |
195 }], | 199 }], |
| 200 ['enable_multidex == 1', { |
| 201 'dex_path': '<(intermediate_dir)/classes.dex.zip', |
| 202 }, { |
| 203 'dex_path': '<(intermediate_dir)/classes.dex', |
| 204 }], |
196 ], | 205 ], |
197 }, | 206 }, |
198 'native_lib_target%': '', | 207 'native_lib_target%': '', |
199 'native_lib_version_name%': '', | 208 'native_lib_version_name%': '', |
200 'use_chromium_linker%' : 0, | 209 'use_chromium_linker%' : 0, |
201 'load_library_from_zip%' : 0, | 210 'load_library_from_zip%' : 0, |
202 'use_relocation_packer%' : 0, | 211 'use_relocation_packer%' : 0, |
203 'enable_chromium_linker_tests%': 0, | 212 'enable_chromium_linker_tests%': 0, |
204 'emma_instrument%': '<(emma_instrument)', | 213 'emma_instrument%': '<(emma_instrument)', |
205 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 214 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
206 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 215 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
207 'unsigned_apk_path': '<(unsigned_apk_path)', | 216 'unsigned_apk_path': '<(unsigned_apk_path)', |
208 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', | 217 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', |
209 'create_abi_split%': '<(create_abi_split)', | 218 'create_abi_split%': '<(create_abi_split)', |
210 'managed_input_apk_path': '<(managed_input_apk_path)', | 219 'managed_input_apk_path': '<(managed_input_apk_path)', |
211 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_
extension)', | 220 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_
extension)', |
212 'extra_native_libs': [], | 221 'extra_native_libs': [], |
213 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_ap
p_abi)/native_lib_placeholder.stamp', | 222 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_ap
p_abi)/native_lib_placeholder.stamp', |
214 'native_lib_placeholders': [], | 223 'native_lib_placeholders': [], |
215 'main_apk_name': '<(apk_name)', | 224 'main_apk_name': '<(apk_name)', |
| 225 'dex_path': '<(dex_path)', |
216 'enable_errorprone%': '0', | 226 'enable_errorprone%': '0', |
217 'errorprone_exe_path': '<(PRODUCT_DIR)/bin.java/chromium_errorprone', | 227 'errorprone_exe_path': '<(PRODUCT_DIR)/bin.java/chromium_errorprone', |
218 }, | 228 }, |
219 # Pass the jar path to the apk's "fake" jar target. This would be better as | 229 # Pass the jar path to the apk's "fake" jar target. This would be better as |
220 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 230 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
221 # cannot be lifted in a dependent to all_dependent_settings. | 231 # cannot be lifted in a dependent to all_dependent_settings. |
222 'all_dependent_settings': { | 232 'all_dependent_settings': { |
223 'conditions': [ | 233 'conditions': [ |
224 ['proguard_enabled == "true"', { | 234 ['proguard_enabled == "true"', { |
225 'variables': { | 235 'variables': { |
226 'proguard_enabled': 'true', | 236 'proguard_enabled': 'true', |
227 } | 237 } |
228 }], | 238 }], |
229 ], | 239 ], |
230 'variables': { | 240 'variables': { |
231 'apk_output_jar_path': '<(jar_path)', | 241 'apk_output_jar_path': '<(jar_path)', |
232 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)', | 242 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)', |
233 'tested_apk_dex_path': '<(dex_path)', | 243 'tested_apk_dex_path': '<(dex_path)', |
| 244 'tested_apk_is_multidex': '<(enable_multidex)', |
234 }, | 245 }, |
235 }, | 246 }, |
236 'conditions': [ | 247 'conditions': [ |
237 ['resource_dir!=""', { | 248 ['resource_dir!=""', { |
238 'variables': { | 249 'variables': { |
239 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] | 250 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] |
240 }, | 251 }, |
241 }], | 252 }], |
242 ['R_package != ""', { | 253 ['R_package != ""', { |
243 'variables': { | 254 'variables': { |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 ], | 756 ], |
746 'action': [ | 757 'action': [ |
747 'python', '<(DEPTH)/build/android/findbugs_diff.py', | 758 'python', '<(DEPTH)/build/android/findbugs_diff.py', |
748 '--auxclasspath-gyp', '>(input_jars_paths)', | 759 '--auxclasspath-gyp', '>(input_jars_paths)', |
749 '--stamp', '<(findbugs_stamp)', | 760 '--stamp', '<(findbugs_stamp)', |
750 '<@(additional_findbugs_args)', | 761 '<@(additional_findbugs_args)', |
751 '<(jar_path)', | 762 '<(jar_path)', |
752 ], | 763 ], |
753 }, | 764 }, |
754 ], | 765 ], |
755 }, | 766 }], |
756 ] | |
757 ], | 767 ], |
758 'dependencies': [ | 768 'dependencies': [ |
759 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum', | 769 '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum', |
760 ], | 770 ], |
761 'actions': [ | 771 'actions': [ |
762 { | 772 { |
763 'action_name': 'process_resources', | 773 'action_name': 'process_resources', |
764 'message': 'processing resources for <(_target_name)', | 774 'message': 'processing resources for <(_target_name)', |
765 'variables': { | 775 'variables': { |
766 # Write the inputs list to a file, so that its mtime is updated when | 776 # Write the inputs list to a file, so that its mtime is updated when |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 '--javac-includes=<(javac_includes)', | 888 '--javac-includes=<(javac_includes)', |
879 '--chromium-code=<(chromium_code)', | 889 '--chromium-code=<(chromium_code)', |
880 '--jar-path=<(javac_jar_path)', | 890 '--jar-path=<(javac_jar_path)', |
881 '--jar-excluded-classes=<(jar_excluded_classes)', | 891 '--jar-excluded-classes=<(jar_excluded_classes)', |
882 '--stamp=<(compile_stamp)', | 892 '--stamp=<(compile_stamp)', |
883 '<@(extra_args)', | 893 '<@(extra_args)', |
884 '>@(java_sources)', | 894 '>@(java_sources)', |
885 ], | 895 ], |
886 }, | 896 }, |
887 { | 897 { |
| 898 'action_name': 'main_dex_list_for_<(_target_name)', |
| 899 'variables': { |
| 900 'jar_path': '<(javac_jar_path)', |
| 901 'output_path': '<(main_dex_list_path)', |
| 902 }, |
| 903 'includes': [ 'android/main_dex_action.gypi' ], |
| 904 }, |
| 905 { |
888 'action_name': 'instr_jar_<(_target_name)', | 906 'action_name': 'instr_jar_<(_target_name)', |
889 'message': 'Instrumenting <(_target_name) jar', | 907 'message': 'Instrumenting <(_target_name) jar', |
890 'variables': { | 908 'variables': { |
891 'input_path': '<(javac_jar_path)', | 909 'input_path': '<(javac_jar_path)', |
892 'output_path': '<(jar_path)', | 910 'output_path': '<(jar_path)', |
893 'stamp_path': '<(instr_stamp)', | 911 'stamp_path': '<(instr_stamp)', |
894 'instr_type': 'jar', | 912 'instr_type': 'jar', |
895 }, | 913 }, |
896 'outputs': [ | 914 'outputs': [ |
897 '<(instr_stamp)', | 915 '<(instr_stamp)', |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.
jar', | 1016 '--proguard-jar-path', '<(android_sdk_root)/tools/proguard/lib/proguard.
jar', |
999 | 1017 |
1000 '--stamp', '<(obfuscate_stamp)', | 1018 '--stamp', '<(obfuscate_stamp)', |
1001 | 1019 |
1002 '>@(additional_obfuscate_options)', | 1020 '>@(additional_obfuscate_options)', |
1003 ], | 1021 ], |
1004 }, | 1022 }, |
1005 { | 1023 { |
1006 'action_name': 'dex_<(_target_name)', | 1024 'action_name': 'dex_<(_target_name)', |
1007 'variables': { | 1025 'variables': { |
| 1026 'dex_additional_options': [], |
1008 'dex_input_paths': [ | 1027 'dex_input_paths': [ |
1009 '>@(library_dexed_jars_paths)', | |
1010 '<(jar_path)', | 1028 '<(jar_path)', |
1011 ], | 1029 ], |
1012 'output_path': '<(dex_path)', | 1030 'output_path': '<(dex_path)', |
1013 'proguard_enabled_input_path': '<(obfuscated_jar_path)', | 1031 'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
1014 }, | 1032 }, |
| 1033 'conditions': [ |
| 1034 ['enable_multidex == 1', { |
| 1035 'variables': { |
| 1036 'dex_additional_options': [ |
| 1037 '--multi-dex', |
| 1038 '--main-dex-list-paths', '>@(main_dex_list_paths)', |
| 1039 ], |
| 1040 }, |
| 1041 'inputs': [ |
| 1042 '>@(main_dex_list_paths)', |
| 1043 ], |
| 1044 }] |
| 1045 ], |
1015 'target_conditions': [ | 1046 'target_conditions': [ |
| 1047 ['enable_multidex == 1 or tested_apk_is_multidex == 1', { |
| 1048 'variables': { |
| 1049 'dex_input_paths': [ |
| 1050 '>@(input_jars_paths)', |
| 1051 ], |
| 1052 }, |
| 1053 }, { |
| 1054 'variables': { |
| 1055 'dex_input_paths': [ |
| 1056 '>@(library_dexed_jars_paths)', |
| 1057 ], |
| 1058 }, |
| 1059 }], |
1016 ['emma_instrument != 0', { | 1060 ['emma_instrument != 0', { |
1017 'variables': { | 1061 'variables': { |
1018 'dex_no_locals': 1, | 1062 'dex_no_locals': 1, |
1019 'dex_input_paths': [ | 1063 'dex_input_paths': [ |
1020 '<(emma_device_jar)' | 1064 '<(emma_device_jar)' |
1021 ], | 1065 ], |
1022 }, | 1066 }, |
1023 }], | 1067 }], |
1024 ['is_test_apk == 1 and tested_apk_dex_path != "/"', { | 1068 ['is_test_apk == 1 and tested_apk_dex_path != "/"', { |
1025 'variables': { | 1069 'variables': { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 'native_libs_dir': '<(apk_package_native_libs_dir)', | 1110 'native_libs_dir': '<(apk_package_native_libs_dir)', |
1067 }, { | 1111 }, { |
1068 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res', | 1112 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res', |
1069 }], | 1113 }], |
1070 ], | 1114 ], |
1071 }, | 1115 }, |
1072 'includes': ['android/apkbuilder_action.gypi'], | 1116 'includes': ['android/apkbuilder_action.gypi'], |
1073 }, | 1117 }, |
1074 ], | 1118 ], |
1075 } | 1119 } |
OLD | NEW |