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 30 matching lines...) Expand all Loading... |
41 # native_lib_target - The target_name of the target which generates the final | 41 # native_lib_target - The target_name of the target which generates the final |
42 # shared library to be included in this apk. A stripped copy of the | 42 # shared library to be included in this apk. A stripped copy of the |
43 # library will be included in the apk. | 43 # library will be included in the apk. |
44 # resource_dir - The directory for resources. | 44 # resource_dir - The directory for resources. |
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 # java_strings_grd - The name of the grd file from which to generate localized | 47 # java_strings_grd - The name of the grd file from which to generate localized |
48 # strings.xml files, if any. | 48 # strings.xml files, if any. |
49 # library_manifest_paths'- Paths to additional AndroidManifest.xml files from | 49 # library_manifest_paths'- Paths to additional AndroidManifest.xml files from |
50 # libraries. | 50 # libraries. |
51 # use_content_linker - Enable the content dynamic linker that allows sharing th
e | 51 # use_chromium_linker - Enable the content dynamic linker that allows sharing t
he |
52 # RELRO section of the native libraries between the different processes. | 52 # RELRO section of the native libraries between the different processes. |
53 # enable_content_linker_tests - Enable the content dynamic linker test support | 53 # enable_chromium_linker_tests - Enable the content dynamic linker test support |
54 # code. This allows a test APK to inject a Linker.TestRunner instance at | 54 # code. This allows a test APK to inject a Linker.TestRunner instance at |
55 # runtime. Should only be used by the content_linker_test_apk target!! | 55 # runtime. Should only be used by the chromium_linker_test_apk target!! |
56 # never_lint - Set to 1 to not run lint on this target. | 56 # never_lint - Set to 1 to not run lint on this target. |
57 { | 57 { |
58 'variables': { | 58 'variables': { |
59 'additional_input_paths': [], | 59 'additional_input_paths': [], |
60 'input_jars_paths': [], | 60 'input_jars_paths': [], |
61 'library_dexed_jars_paths': [], | 61 'library_dexed_jars_paths': [], |
62 'additional_src_dirs': [], | 62 'additional_src_dirs': [], |
63 'generated_src_dirs': [], | 63 'generated_src_dirs': [], |
64 'app_manifest_version_name%': '<(android_app_version_name)', | 64 'app_manifest_version_name%': '<(android_app_version_name)', |
65 'app_manifest_version_code%': '<(android_app_version_code)', | 65 'app_manifest_version_code%': '<(android_app_version_code)', |
66 'proguard_enabled%': 'false', | 66 'proguard_enabled%': 'false', |
67 'proguard_flags_paths%': ['<(DEPTH)/build/android/empty_proguard.flags'], | 67 'proguard_flags_paths%': ['<(DEPTH)/build/android/empty_proguard.flags'], |
68 'jar_name': 'chromium_apk_<(_target_name).jar', | 68 'jar_name': 'chromium_apk_<(_target_name).jar', |
69 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', | 69 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', |
70 'R_package%':'', | 70 'R_package%':'', |
71 'additional_R_text_files': [], | 71 'additional_R_text_files': [], |
72 'additional_res_dirs': [], | 72 'additional_res_dirs': [], |
73 'additional_res_packages': [], | 73 'additional_res_packages': [], |
74 'is_test_apk%': 0, | 74 'is_test_apk%': 0, |
75 'java_strings_grd%': '', | 75 'java_strings_grd%': '', |
76 'library_manifest_paths' : [], | 76 'library_manifest_paths' : [], |
77 'resource_input_paths': [], | 77 'resource_input_paths': [], |
78 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', | 78 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', |
79 'asset_location%': '<(intermediate_dir)/assets', | 79 'asset_location%': '<(intermediate_dir)/assets', |
80 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', | 80 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', |
81 'compile_input_paths': [], | 81 'compile_input_paths': [], |
82 'package_input_paths': [], | 82 'package_input_paths': [], |
83 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', | 83 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', |
84 # TODO(cjhopman): build/ shouldn't refer to content/. The libraryloader and | 84 'native_libraries_template': '<(DEPTH)/base/android/java/templates/NativeLib
raries.template', |
85 # nativelibraries template should be moved out of content/ (to base/?). | |
86 # http://crbug.com/225101 | |
87 'native_libraries_template': '<(DEPTH)/content/public/android/java/templates
/NativeLibraries.template', | |
88 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', | 85 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', |
89 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', | 86 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.
java', |
90 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', | 87 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.st
amp', |
91 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', | 88 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/
', |
92 'native_libraries_template_data_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', | 89 'native_libraries_template_data_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', |
93 'native_libraries_template_version_file': '<(native_libraries_template_data_
dir)/native_libraries_version.h', | 90 'native_libraries_template_version_file': '<(native_libraries_template_data_
dir)/native_libraries_version.h', |
94 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 91 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
95 'lint_stamp': '<(intermediate_dir)/lint.stamp', | 92 'lint_stamp': '<(intermediate_dir)/lint.stamp', |
96 'lint_result': '<(intermediate_dir)/lint_result.xml', | 93 'lint_result': '<(intermediate_dir)/lint_result.xml', |
97 'lint_config': '<(intermediate_dir)/lint_config.xml', | 94 'lint_config': '<(intermediate_dir)/lint_config.xml', |
(...skipping 21 matching lines...) Expand all Loading... |
119 'source_dir': '<(java_in_dir)/src', | 116 'source_dir': '<(java_in_dir)/src', |
120 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', | 117 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', |
121 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFI
GURATION_NAME)', | 118 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFI
GURATION_NAME)', |
122 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', | 119 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', |
123 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', | 120 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', |
124 'create_standalone_apk%': 1, | 121 'create_standalone_apk%': 1, |
125 'variables': { | 122 'variables': { |
126 'variables': { | 123 'variables': { |
127 'native_lib_target%': '', | 124 'native_lib_target%': '', |
128 'native_lib_version_name%': '', | 125 'native_lib_version_name%': '', |
| 126 # TODO (aberent) remove use_content_linker once downstream Android has |
| 127 # been switched to use_chromium_linker. |
129 'use_content_linker%': 0, | 128 'use_content_linker%': 0, |
130 'enable_content_linker_tests%': 0, | 129 'use_chromium_linker%' : 0, |
| 130 'enable_chromium_linker_tests%': 0, |
131 'is_test_apk%': 0, | 131 'is_test_apk%': 0, |
132 }, | 132 }, |
133 'conditions': [ | 133 'conditions': [ |
134 ['gyp_managed_install == 1 and native_lib_target != ""', { | 134 ['gyp_managed_install == 1 and native_lib_target != ""', { |
135 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand
alone-unsigned.apk', | 135 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand
alone-unsigned.apk', |
136 }, { | 136 }, { |
137 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', | 137 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', |
138 }], | 138 }], |
139 ['gyp_managed_install == 1', { | 139 ['gyp_managed_install == 1', { |
140 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 140 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
141 }, { | 141 }, { |
142 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 142 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
143 }], | 143 }], |
144 ['is_test_apk == 0 and emma_coverage != 0', { | 144 ['is_test_apk == 0 and emma_coverage != 0', { |
145 'emma_instrument': 1, | 145 'emma_instrument': 1, |
146 },{ | 146 },{ |
147 'emma_instrument': 0, | 147 'emma_instrument': 0, |
148 }], | 148 }], |
149 ], | 149 ], |
150 }, | 150 }, |
151 'native_lib_target%': '', | 151 'native_lib_target%': '', |
152 'native_lib_version_name%': '', | 152 'native_lib_version_name%': '', |
153 'use_content_linker%': 0, | 153 'use_content_linker%': 0, |
154 'enable_content_linker_tests%': 0, | 154 'use_chromium_linker%' : 0, |
| 155 'enable_chromium_linker_tests%': 0, |
155 'emma_instrument': '<(emma_instrument)', | 156 'emma_instrument': '<(emma_instrument)', |
156 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 157 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
157 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 158 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
158 'extra_native_libs': [], | 159 'extra_native_libs': [], |
159 }, | 160 }, |
160 # Pass the jar path to the apk's "fake" jar target. This would be better as | 161 # Pass the jar path to the apk's "fake" jar target. This would be better as |
161 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 162 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
162 # cannot be lifted in a dependent to all_dependent_settings. | 163 # cannot be lifted in a dependent to all_dependent_settings. |
163 'all_dependent_settings': { | 164 'all_dependent_settings': { |
164 'variables': { | 165 'variables': { |
(...skipping 13 matching lines...) Expand all Loading... |
178 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | 179 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
179 'additional_res_packages': ['<(R_package)'], | 180 'additional_res_packages': ['<(R_package)'], |
180 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], | 181 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], |
181 }, | 182 }, |
182 }], | 183 }], |
183 ['native_lib_target != "" and component == "shared_library"', { | 184 ['native_lib_target != "" and component == "shared_library"', { |
184 'dependencies': [ | 185 'dependencies': [ |
185 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', | 186 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', |
186 ], | 187 ], |
187 }], | 188 }], |
188 ['use_content_linker == 1', { | 189 ['use_content_linker == 1 or use_chromium_linker == 1', { |
189 'dependencies': [ | 190 'dependencies': [ |
190 '<(DEPTH)/content/content.gyp:content_android_linker', | 191 '<(DEPTH)/base/base.gyp:chromium_android_linker', |
191 ], | 192 ], |
192 }], | 193 }], |
193 ['native_lib_target != ""', { | 194 ['native_lib_target != ""', { |
194 'variables': { | 195 'variables': { |
195 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], | 196 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], |
196 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], | 197 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
197 'native_libs_paths': [ | 198 'native_libs_paths': [ |
198 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)' | 199 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)' |
199 ], | 200 ], |
200 'package_input_paths': [ | 201 'package_input_paths': [ |
201 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver', | 202 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver', |
202 ], | 203 ], |
203 }, | 204 }, |
204 'copies': [ | 205 'copies': [ |
205 { | 206 { |
206 # gdbserver is always copied into the APK's native libs dir. The ant | 207 # gdbserver is always copied into the APK's native libs dir. The ant |
207 # build scripts (apkbuilder task) will only include it in a debug | 208 # build scripts (apkbuilder task) will only include it in a debug |
208 # build. | 209 # build. |
209 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)', | 210 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)', |
210 'files': [ | 211 'files': [ |
211 '<(android_gdbserver)', | 212 '<(android_gdbserver)', |
212 '<@(extra_native_libs)', | 213 '<@(extra_native_libs)', |
213 ], | 214 ], |
214 }, | 215 }, |
215 ], | 216 ], |
216 'actions': [ | 217 'actions': [ |
217 { | 218 { |
218 'variables': { | 219 'variables': { |
219 'conditions': [ | 220 'conditions': [ |
220 ['use_content_linker == 1', { | 221 ['use_content_linker == 1 or use_chromium_linker == 1', { |
221 'variables': { | 222 'variables': { |
222 'linker_input_libraries': [ | 223 'linker_input_libraries': [ |
223 '<(SHARED_LIB_DIR)/libcontent_android_linker.>(android_produ
ct_extension)', | 224 '<(SHARED_LIB_DIR)/libchromium_android_linker.>(android_prod
uct_extension)', |
224 ], | 225 ], |
225 } | 226 } |
226 }, { | 227 }, { |
227 'variables': { | 228 'variables': { |
228 'linker_input_libraries': [], | 229 'linker_input_libraries': [], |
229 }, | 230 }, |
230 }], | 231 }], |
231 ], | 232 ], |
232 'input_libraries': [ | 233 'input_libraries': [ |
233 '<@(native_libs_paths)', | 234 '<@(native_libs_paths)', |
(...skipping 20 matching lines...) Expand all Loading... |
254 '--ordered-libraries=<(ordered_libraries_file)', | 255 '--ordered-libraries=<(ordered_libraries_file)', |
255 '--version-name=<(native_lib_version_name)', | 256 '--version-name=<(native_lib_version_name)', |
256 '--native-library-list=<(native_libraries_template_data_file)', | 257 '--native-library-list=<(native_libraries_template_data_file)', |
257 '--version-output=<(native_libraries_template_version_file)', | 258 '--version-output=<(native_libraries_template_version_file)', |
258 ], | 259 ], |
259 }, | 260 }, |
260 { | 261 { |
261 'action_name': 'native_libraries_<(_target_name)', | 262 'action_name': 'native_libraries_<(_target_name)', |
262 'variables': { | 263 'variables': { |
263 'conditions': [ | 264 'conditions': [ |
264 ['use_content_linker == 1', { | 265 ['use_content_linker == 1 or use_chromium_linker == 1', { |
265 'variables': { | 266 'variables': { |
266 'linker_gcc_preprocess_defines': [ | 267 'linker_gcc_preprocess_defines': [ |
267 '--defines', 'ENABLE_CONTENT_LINKER', | 268 '--defines', 'ENABLE_CHROMIUM_LINKER', |
268 ], | 269 ], |
269 } | 270 } |
270 }, { | 271 }, { |
271 'variables': { | 272 'variables': { |
272 'linker_gcc_preprocess_defines': [], | 273 'linker_gcc_preprocess_defines': [], |
273 }, | 274 }, |
274 }], | 275 }], |
275 ['enable_content_linker_tests == 1', { | 276 ['enable_chromium_linker_tests == 1', { |
276 'variables': { | 277 'variables': { |
277 'linker_tests_gcc_preprocess_defines': [ | 278 'linker_tests_gcc_preprocess_defines': [ |
278 '--defines', 'ENABLE_CONTENT_LINKER_TESTS', | 279 '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS', |
279 ], | 280 ], |
280 } | 281 } |
281 }, { | 282 }, { |
282 'variables': { | 283 'variables': { |
283 'linker_tests_gcc_preprocess_defines': [], | 284 'linker_tests_gcc_preprocess_defines': [], |
284 }, | 285 }, |
285 }], | 286 }], |
286 ], | 287 ], |
287 'gcc_preprocess_defines': [ | 288 'gcc_preprocess_defines': [ |
288 '<@(linker_gcc_preprocess_defines)', | 289 '<@(linker_gcc_preprocess_defines)', |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 '<(DEPTH)/build/android/ant/apk-package.xml', | 771 '<(DEPTH)/build/android/ant/apk-package.xml', |
771 | 772 |
772 # Add list of inputs to the command line, so if inputs change | 773 # Add list of inputs to the command line, so if inputs change |
773 # (e.g. if a Java file is removed), the command will be re-run. | 774 # (e.g. if a Java file is removed), the command will be re-run. |
774 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 775 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
775 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 776 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
776 ] | 777 ] |
777 }, | 778 }, |
778 ], | 779 ], |
779 } | 780 } |
OLD | NEW |