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