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 # 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 # load_library_from_zip_file - When using the dynamic linker, load the library | 49 # load_library_from_zip_file - When using the dynamic linker, load the library |
50 # directly out of the zip file. | 50 # directly out of the zip file. |
| 51 # use_relocation_packer - Enable relocation packing. Relies on the chromium |
| 52 # linker, so use_chromium_linker must also be enabled. |
51 # enable_chromium_linker_tests - Enable the content dynamic linker test support | 53 # enable_chromium_linker_tests - Enable the content dynamic linker test support |
52 # 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 |
53 # runtime. Should only be used by the chromium_linker_test_apk target!! | 55 # runtime. Should only be used by the chromium_linker_test_apk target!! |
54 # 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. |
55 { | 57 { |
56 'variables': { | 58 'variables': { |
57 'tested_apk_obfuscated_jar_path%': '/', | 59 'tested_apk_obfuscated_jar_path%': '/', |
58 'tested_apk_dex_path%': '/', | 60 'tested_apk_dex_path%': '/', |
59 'additional_input_paths': [], | 61 'additional_input_paths': [], |
60 'input_jars_paths': [], | 62 'input_jars_paths': [], |
(...skipping 27 matching lines...) Expand all Loading... |
88 'native_libraries_template_data_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', | 90 'native_libraries_template_data_file': '<(native_libraries_template_data_dir
)/native_libraries_array.h', |
89 'native_libraries_template_version_file': '<(native_libraries_template_data_
dir)/native_libraries_version.h', | 91 'native_libraries_template_version_file': '<(native_libraries_template_data_
dir)/native_libraries_version.h', |
90 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 92 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
91 'lint_stamp': '<(intermediate_dir)/lint.stamp', | 93 'lint_stamp': '<(intermediate_dir)/lint.stamp', |
92 'lint_result': '<(intermediate_dir)/lint_result.xml', | 94 'lint_result': '<(intermediate_dir)/lint_result.xml', |
93 'lint_config': '<(intermediate_dir)/lint_config.xml', | 95 'lint_config': '<(intermediate_dir)/lint_config.xml', |
94 'never_lint%': 0, | 96 'never_lint%': 0, |
95 'instr_stamp': '<(intermediate_dir)/instr.stamp', | 97 'instr_stamp': '<(intermediate_dir)/instr.stamp', |
96 'jar_stamp': '<(intermediate_dir)/jar.stamp', | 98 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
97 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', | 99 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
| 100 'pack_arm_relocations_stamp': '<(intermediate_dir)/pack_arm_relocations.stam
p', |
98 'strip_stamp': '<(intermediate_dir)/strip.stamp', | 101 'strip_stamp': '<(intermediate_dir)/strip.stamp', |
| 102 'stripped_libraries_dir': '<(SHARED_INTERMEDIATE_DIR)/stripped_libraries', |
99 'classes_dir': '<(intermediate_dir)/classes/2', | 103 'classes_dir': '<(intermediate_dir)/classes/2', |
100 'javac_includes': [], | 104 'javac_includes': [], |
101 'jar_excluded_classes': [], | 105 'jar_excluded_classes': [], |
102 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', | 106 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', |
103 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 107 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
104 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', | 108 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
105 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', | 109 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', |
106 'dex_path': '<(intermediate_dir)/classes.dex', | 110 'dex_path': '<(intermediate_dir)/classes.dex', |
107 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', | 111 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', |
108 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', | 112 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', |
(...skipping 11 matching lines...) Expand all Loading... |
120 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', | 124 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', |
121 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', | 125 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', |
122 'create_standalone_apk%': 1, | 126 'create_standalone_apk%': 1, |
123 'res_v14_verify_only%': 0, | 127 'res_v14_verify_only%': 0, |
124 'variables': { | 128 'variables': { |
125 'variables': { | 129 'variables': { |
126 'native_lib_target%': '', | 130 'native_lib_target%': '', |
127 'native_lib_version_name%': '', | 131 'native_lib_version_name%': '', |
128 'use_chromium_linker%' : 0, | 132 'use_chromium_linker%' : 0, |
129 'load_library_from_zip_file%' : 0, | 133 'load_library_from_zip_file%' : 0, |
| 134 'use_relocation_packer%' : 0, |
130 'enable_chromium_linker_tests%': 0, | 135 'enable_chromium_linker_tests%': 0, |
131 'is_test_apk%': 0, | 136 'is_test_apk%': 0, |
132 }, | 137 }, |
133 'conditions': [ | 138 'conditions': [ |
134 ['gyp_managed_install == 1 and native_lib_target != ""', { | 139 ['gyp_managed_install == 1 and native_lib_target != ""', { |
135 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand
alone-unsigned.apk', | 140 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand
alone-unsigned.apk', |
136 }, { | 141 }, { |
137 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', | 142 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', |
138 }], | 143 }], |
139 ['gyp_managed_install == 1', { | 144 ['gyp_managed_install == 1', { |
140 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 145 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
141 }, { | 146 }, { |
142 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 147 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
143 }], | 148 }], |
144 ['is_test_apk == 0 and emma_coverage != 0', { | 149 ['is_test_apk == 0 and emma_coverage != 0', { |
145 'emma_instrument%': 1, | 150 'emma_instrument%': 1, |
146 },{ | 151 },{ |
147 'emma_instrument%': 0, | 152 'emma_instrument%': 0, |
148 }], | 153 }], |
149 ], | 154 ], |
150 }, | 155 }, |
151 'native_lib_target%': '', | 156 'native_lib_target%': '', |
152 'native_lib_version_name%': '', | 157 'native_lib_version_name%': '', |
153 'use_chromium_linker%' : 0, | 158 'use_chromium_linker%' : 0, |
| 159 'load_library_from_zip_file%' : 0, |
| 160 'use_relocation_packer%' : 0, |
154 'enable_chromium_linker_tests%': 0, | 161 'enable_chromium_linker_tests%': 0, |
155 'load_library_from_zip_file%' : 0, | |
156 'emma_instrument%': '<(emma_instrument)', | 162 'emma_instrument%': '<(emma_instrument)', |
157 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 163 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
158 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 164 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
| 165 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_
extension)', |
159 'extra_native_libs': [], | 166 'extra_native_libs': [], |
160 }, | 167 }, |
161 # Pass the jar path to the apk's "fake" jar target. This would be better as | 168 # Pass the jar path to the apk's "fake" jar target. This would be better as |
162 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 169 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
163 # cannot be lifted in a dependent to all_dependent_settings. | 170 # cannot be lifted in a dependent to all_dependent_settings. |
164 'all_dependent_settings': { | 171 'all_dependent_settings': { |
165 'conditions': [ | 172 'conditions': [ |
166 ['proguard_enabled == "true"', { | 173 ['proguard_enabled == "true"', { |
167 'variables': { | 174 'variables': { |
168 'proguard_enabled': 'true', | 175 'proguard_enabled': 'true', |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 ], | 227 ], |
221 }, | 228 }, |
222 ], | 229 ], |
223 'actions': [ | 230 'actions': [ |
224 { | 231 { |
225 'variables': { | 232 'variables': { |
226 'conditions': [ | 233 'conditions': [ |
227 ['use_chromium_linker == 1', { | 234 ['use_chromium_linker == 1', { |
228 'variables': { | 235 'variables': { |
229 'linker_input_libraries': [ | 236 'linker_input_libraries': [ |
230 '<(SHARED_LIB_DIR)/libchromium_android_linker.>(android_prod
uct_extension)', | 237 '<(SHARED_LIB_DIR)/<(libchromium_android_linker)', |
231 ], | 238 ], |
232 } | 239 } |
233 }, { | 240 }, { |
234 'variables': { | 241 'variables': { |
235 'linker_input_libraries': [], | 242 'linker_input_libraries': [], |
236 }, | 243 }, |
237 }], | 244 }], |
238 ], | 245 ], |
239 'input_libraries': [ | 246 'input_libraries': [ |
240 '<@(native_libs_paths)', | 247 '<@(native_libs_paths)', |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 '--output=<(native_libraries_java_file)', | 332 '--output=<(native_libraries_java_file)', |
326 '--template=<(native_libraries_template)', | 333 '--template=<(native_libraries_template)', |
327 '--stamp=<(native_libraries_java_stamp)', | 334 '--stamp=<(native_libraries_java_stamp)', |
328 '<@(gcc_preprocess_defines)', | 335 '<@(gcc_preprocess_defines)', |
329 ], | 336 ], |
330 }, | 337 }, |
331 { | 338 { |
332 'action_name': 'strip_native_libraries', | 339 'action_name': 'strip_native_libraries', |
333 'variables': { | 340 'variables': { |
334 'ordered_libraries_file%': '<(ordered_libraries_file)', | 341 'ordered_libraries_file%': '<(ordered_libraries_file)', |
335 'stripped_libraries_dir': '<(libraries_source_dir)', | 342 'stripped_libraries_dir%': '<(stripped_libraries_dir)', |
336 'input_paths': [ | 343 'input_paths': [ |
337 '<@(native_libs_paths)', | 344 '<@(native_libs_paths)', |
338 '<@(extra_native_libs)', | 345 '<@(extra_native_libs)', |
339 ], | 346 ], |
340 'stamp': '<(strip_stamp)' | 347 'stamp': '<(strip_stamp)' |
341 }, | 348 }, |
342 'includes': ['../build/android/strip_native_libraries.gypi'], | 349 'includes': ['../build/android/strip_native_libraries.gypi'], |
343 }, | 350 }, |
| 351 { |
| 352 'action_name': 'pack_arm_relocations', |
| 353 'variables': { |
| 354 'conditions': [ |
| 355 ['use_chromium_linker == 1 and use_relocation_packer == 1', { |
| 356 'enable_packing': 1, |
| 357 }, { |
| 358 'enable_packing': 0, |
| 359 }], |
| 360 ], |
| 361 'exclude_packing_list': [ |
| 362 '<(libchromium_android_linker)', |
| 363 ], |
| 364 'ordered_libraries_file%': '<(ordered_libraries_file)', |
| 365 'stripped_libraries_dir%': '<(stripped_libraries_dir)', |
| 366 'packed_libraries_dir': '<(libraries_source_dir)', |
| 367 'input_paths': [ |
| 368 '<(strip_stamp)', |
| 369 ], |
| 370 'stamp': '<(pack_arm_relocations_stamp)', |
| 371 }, |
| 372 'dependencies': [ |
| 373 'strip_native_libraries', |
| 374 ], |
| 375 'includes': ['../build/android/pack_arm_relocations.gypi'], |
| 376 }, |
344 ], | 377 ], |
345 'conditions': [ | 378 'conditions': [ |
346 ['gyp_managed_install == 1', { | 379 ['gyp_managed_install == 1', { |
347 'variables': { | 380 'variables': { |
348 'libraries_top_dir': '<(intermediate_dir)/lib.stripped', | 381 'libraries_top_dir': '<(intermediate_dir)/lib.stripped', |
349 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)
', | 382 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)
', |
350 'device_library_dir': '<(device_intermediate_dir)/lib.stripped', | 383 'device_library_dir': '<(device_intermediate_dir)/lib.stripped', |
351 'configuration_name': '<(CONFIGURATION_NAME)', | 384 'configuration_name': '<(CONFIGURATION_NAME)', |
352 }, | 385 }, |
353 'dependencies': [ | 386 'dependencies': [ |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 '-DEMMA_INSTRUMENT=<(emma_instrument)', | 848 '-DEMMA_INSTRUMENT=<(emma_instrument)', |
816 '-DEMMA_DEVICE_JAR=<(emma_device_jar)', | 849 '-DEMMA_DEVICE_JAR=<(emma_device_jar)', |
817 | 850 |
818 '-Dbasedir=.', | 851 '-Dbasedir=.', |
819 '-buildfile', | 852 '-buildfile', |
820 '<(DEPTH)/build/android/ant/apk-package.xml', | 853 '<(DEPTH)/build/android/ant/apk-package.xml', |
821 ] | 854 ] |
822 }, | 855 }, |
823 ], | 856 ], |
824 } | 857 } |
OLD | NEW |