| 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 | 51 # use_content_linker - Enable the content dynamic linker that allows sharing th
e |
| 52 # RELRO section of the native libraries between the different processes. |
| 53 # enable_content_linker_tests - Enable the content dynamic linker test support |
| 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!! |
| 52 { | 56 { |
| 53 'variables': { | 57 'variables': { |
| 54 'additional_input_paths': [], | 58 'additional_input_paths': [], |
| 55 'input_jars_paths': [], | 59 'input_jars_paths': [], |
| 56 'library_dexed_jars_paths': [], | 60 'library_dexed_jars_paths': [], |
| 57 'additional_src_dirs': [], | 61 'additional_src_dirs': [], |
| 58 'generated_src_dirs': [], | 62 'generated_src_dirs': [], |
| 59 'app_manifest_version_name%': '<(android_app_version_name)', | 63 'app_manifest_version_name%': '<(android_app_version_name)', |
| 60 'app_manifest_version_code%': '<(android_app_version_code)', | 64 'app_manifest_version_code%': '<(android_app_version_code)', |
| 61 'proguard_enabled%': 'false', | 65 'proguard_enabled%': 'false', |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', | 113 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', |
| 110 'source_dir': '<(java_in_dir)/src', | 114 'source_dir': '<(java_in_dir)/src', |
| 111 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', | 115 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', |
| 112 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFI
GURATION_NAME)', | 116 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFI
GURATION_NAME)', |
| 113 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', | 117 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', |
| 114 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', | 118 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', |
| 115 'create_standalone_apk%': 1, | 119 'create_standalone_apk%': 1, |
| 116 'variables': { | 120 'variables': { |
| 117 'variables': { | 121 'variables': { |
| 118 'native_lib_target%': '', | 122 'native_lib_target%': '', |
| 123 'use_content_linker%': 0, |
| 124 'enable_content_linker_tests%': 0, |
| 119 }, | 125 }, |
| 120 'conditions': [ | 126 'conditions': [ |
| 121 ['gyp_managed_install == 1 and native_lib_target != ""', { | 127 ['gyp_managed_install == 1 and native_lib_target != ""', { |
| 122 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand
alone-unsigned.apk', | 128 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand
alone-unsigned.apk', |
| 123 }, { | 129 }, { |
| 124 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', | 130 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', |
| 125 }], | 131 }], |
| 126 ['gyp_managed_install == 1', { | 132 ['gyp_managed_install == 1', { |
| 127 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 133 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
| 128 }, { | 134 }, { |
| 129 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 135 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
| 130 }], | 136 }], |
| 131 ], | 137 ], |
| 132 }, | 138 }, |
| 133 'native_lib_target%': '', | 139 'native_lib_target%': '', |
| 140 'use_content_linker%': 0, |
| 141 'enable_content_linker_tests%': 0, |
| 134 'emma_instrument': '<(emma_coverage)', | 142 'emma_instrument': '<(emma_coverage)', |
| 135 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 143 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
| 136 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 144 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
| 137 'extra_native_libs': [], | 145 'extra_native_libs': [], |
| 138 }, | 146 }, |
| 139 # Pass the jar path to the apk's "fake" jar target. This would be better as | 147 # Pass the jar path to the apk's "fake" jar target. This would be better as |
| 140 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 148 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
| 141 # cannot be lifted in a dependent to all_dependent_settings. | 149 # cannot be lifted in a dependent to all_dependent_settings. |
| 142 'all_dependent_settings': { | 150 'all_dependent_settings': { |
| 143 'variables': { | 151 'variables': { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 157 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | 165 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
| 158 'additional_res_packages': ['<(R_package)'], | 166 'additional_res_packages': ['<(R_package)'], |
| 159 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], | 167 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], |
| 160 }, | 168 }, |
| 161 }], | 169 }], |
| 162 ['native_lib_target != "" and component == "shared_library"', { | 170 ['native_lib_target != "" and component == "shared_library"', { |
| 163 'dependencies': [ | 171 'dependencies': [ |
| 164 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', | 172 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', |
| 165 ], | 173 ], |
| 166 }], | 174 }], |
| 175 ['use_content_linker == 1', { |
| 176 'dependencies': [ |
| 177 '<(DEPTH)/content/content.gyp:content_android_linker', |
| 178 ], |
| 179 }], |
| 167 ['native_lib_target != ""', { | 180 ['native_lib_target != ""', { |
| 168 'variables': { | 181 'variables': { |
| 169 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], | 182 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], |
| 170 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], | 183 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
| 171 'native_libs_paths': [ | 184 'native_libs_paths': [ |
| 172 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)' | 185 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)' |
| 173 ], | 186 ], |
| 174 'package_input_paths': [ | 187 'package_input_paths': [ |
| 175 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver', | 188 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver', |
| 176 ], | 189 ], |
| 177 }, | 190 }, |
| 178 'copies': [ | 191 'copies': [ |
| 179 { | 192 { |
| 180 # gdbserver is always copied into the APK's native libs dir. The ant | 193 # gdbserver is always copied into the APK's native libs dir. The ant |
| 181 # build scripts (apkbuilder task) will only include it in a debug | 194 # build scripts (apkbuilder task) will only include it in a debug |
| 182 # build. | 195 # build. |
| 183 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)', | 196 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)', |
| 184 'files': [ | 197 'files': [ |
| 185 '<(android_gdbserver)', | 198 '<(android_gdbserver)', |
| 186 '<@(extra_native_libs)', | 199 '<@(extra_native_libs)', |
| 187 ], | 200 ], |
| 188 }, | 201 }, |
| 189 ], | 202 ], |
| 190 'actions': [ | 203 'actions': [ |
| 191 { | 204 { |
| 192 'variables': { | 205 'variables': { |
| 206 'conditions': [ |
| 207 ['use_content_linker == 1', { |
| 208 'variables': { |
| 209 'linker_input_libraries': [ |
| 210 '<(SHARED_LIB_DIR)/libcontent_android_linker.>(android_produ
ct_extension)', |
| 211 ], |
| 212 } |
| 213 }, { |
| 214 'variables': { |
| 215 'linker_input_libraries': [], |
| 216 }, |
| 217 }], |
| 218 ], |
| 193 'input_libraries': [ | 219 'input_libraries': [ |
| 194 '<@(native_libs_paths)', | 220 '<@(native_libs_paths)', |
| 195 '<@(extra_native_libs)', | 221 '<@(extra_native_libs)', |
| 222 '<@(linker_input_libraries)', |
| 196 ], | 223 ], |
| 197 }, | 224 }, |
| 198 'includes': ['../build/android/write_ordered_libraries.gypi'], | 225 'includes': ['../build/android/write_ordered_libraries.gypi'], |
| 199 }, | 226 }, |
| 200 { | 227 { |
| 201 'action_name': 'native_libraries_template_data_<(_target_name)', | 228 'action_name': 'native_libraries_template_data_<(_target_name)', |
| 202 'message': 'Creating native_libraries_list.h for <(_target_name).', | 229 'message': 'Creating native_libraries_list.h for <(_target_name).', |
| 203 'inputs': [ | 230 'inputs': [ |
| 204 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 231 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 205 '<(DEPTH)/build/android/gyp/create_native_libraries_header.py', | 232 '<(DEPTH)/build/android/gyp/create_native_libraries_header.py', |
| 206 '<(ordered_libraries_file)', | 233 '<(ordered_libraries_file)', |
| 207 ], | 234 ], |
| 208 'outputs': [ | 235 'outputs': [ |
| 209 '<(native_libraries_template_data_stamp)', | 236 '<(native_libraries_template_data_stamp)', |
| 210 ], | 237 ], |
| 211 'action': [ | 238 'action': [ |
| 212 'python', '<(DEPTH)/build/android/gyp/create_native_libraries_header
.py', | 239 'python', '<(DEPTH)/build/android/gyp/create_native_libraries_header
.py', |
| 213 '--ordered-libraries=<(ordered_libraries_file)', | 240 '--ordered-libraries=<(ordered_libraries_file)', |
| 214 '--output=<(native_libraries_template_data_file)', | 241 '--output=<(native_libraries_template_data_file)', |
| 215 '--stamp=<(native_libraries_template_data_stamp)', | 242 '--stamp=<(native_libraries_template_data_stamp)', |
| 216 ], | 243 ], |
| 217 }, | 244 }, |
| 218 { | 245 { |
| 219 'action_name': 'native_libraries_<(_target_name)', | 246 'action_name': 'native_libraries_<(_target_name)', |
| 247 'variables': { |
| 248 'conditions': [ |
| 249 ['use_content_linker == 1', { |
| 250 'variables': { |
| 251 'linker_gcc_preprocess_defines': [ |
| 252 '--defines', 'ENABLE_CONTENT_LINKER', |
| 253 ], |
| 254 } |
| 255 }, { |
| 256 'variables': { |
| 257 'linker_gcc_preprocess_defines': [], |
| 258 }, |
| 259 }], |
| 260 ['enable_content_linker_tests == 1', { |
| 261 'variables': { |
| 262 'linker_tests_gcc_preprocess_defines': [ |
| 263 '--defines', 'ENABLE_CONTENT_LINKER_TESTS', |
| 264 ], |
| 265 } |
| 266 }, { |
| 267 'variables': { |
| 268 'linker_tests_gcc_preprocess_defines': [], |
| 269 }, |
| 270 }], |
| 271 ], |
| 272 'gcc_preprocess_defines': [ |
| 273 '<@(linker_gcc_preprocess_defines)', |
| 274 '<@(linker_tests_gcc_preprocess_defines)', |
| 275 ], |
| 276 }, |
| 220 'message': 'Creating NativeLibraries.java for <(_target_name).', | 277 'message': 'Creating NativeLibraries.java for <(_target_name).', |
| 221 'inputs': [ | 278 'inputs': [ |
| 222 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 279 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 223 '<(DEPTH)/build/android/gyp/gcc_preprocess.py', | 280 '<(DEPTH)/build/android/gyp/gcc_preprocess.py', |
| 224 '<(native_libraries_template_data_stamp)', | 281 '<(native_libraries_template_data_stamp)', |
| 225 '<(native_libraries_template)', | 282 '<(native_libraries_template)', |
| 226 ], | 283 ], |
| 227 'outputs': [ | 284 'outputs': [ |
| 228 '<(native_libraries_java_stamp)', | 285 '<(native_libraries_java_stamp)', |
| 229 ], | 286 ], |
| 230 'action': [ | 287 'action': [ |
| 231 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', | 288 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', |
| 232 '--include-path=<(native_libraries_template_data_dir)', | 289 '--include-path=<(native_libraries_template_data_dir)', |
| 233 '--output=<(native_libraries_java_file)', | 290 '--output=<(native_libraries_java_file)', |
| 234 '--template=<(native_libraries_template)', | 291 '--template=<(native_libraries_template)', |
| 235 '--stamp=<(native_libraries_java_stamp)', | 292 '--stamp=<(native_libraries_java_stamp)', |
| 293 '<@(gcc_preprocess_defines)', |
| 236 ], | 294 ], |
| 237 }, | 295 }, |
| 238 { | 296 { |
| 239 'action_name': 'strip_native_libraries', | 297 'action_name': 'strip_native_libraries', |
| 240 'variables': { | 298 'variables': { |
| 241 'ordered_libraries_file%': '<(ordered_libraries_file)', | 299 'ordered_libraries_file%': '<(ordered_libraries_file)', |
| 242 'stripped_libraries_dir': '<(libraries_source_dir)', | 300 'stripped_libraries_dir': '<(libraries_source_dir)', |
| 243 'input_paths': [ | 301 'input_paths': [ |
| 244 '<@(native_libs_paths)', | 302 '<@(native_libs_paths)', |
| 245 '<@(extra_native_libs)', | 303 '<@(extra_native_libs)', |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 '<(DEPTH)/build/android/ant/apk-package.xml', | 736 '<(DEPTH)/build/android/ant/apk-package.xml', |
| 679 | 737 |
| 680 # Add list of inputs to the command line, so if inputs change | 738 # Add list of inputs to the command line, so if inputs change |
| 681 # (e.g. if a Java file is removed), the command will be re-run. | 739 # (e.g. if a Java file is removed), the command will be re-run. |
| 682 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 740 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 683 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 741 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
| 684 ] | 742 ] |
| 685 }, | 743 }, |
| 686 ], | 744 ], |
| 687 } | 745 } |
| OLD | NEW |