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