Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 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 |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | # This file is meant to be included into a target to provide a rule |
| 6 | # to build Android APKs in a consistent manner. |
| 7 | # |
| 8 | # To use this, create a gyp target with the following form: |
| 9 | # { |
| 10 | # 'target_name': 'my_package_apk', |
| 11 | # 'type': 'none', |
| 12 | # 'variables': { |
| 13 | # 'apk_name': 'MyPackage', |
| 14 | # 'java_in_dir': 'path/to/package/root', |
| 15 | # 'resource_dir': 'path/to/package/root/res', |
| 16 | # }, |
| 17 | # 'includes': ['path/to/this/gypi/file'], |
| 18 | # } |
| 19 | # |
| 20 | # Required variables: |
| 21 | # apk_name - The final apk will be named <apk_name>.apk |
| 22 | # java_in_dir - The top-level java directory. The src should be in |
| 23 | # <(java_in_dir)/src. |
| 24 | # Optional/automatic variables: |
| 25 | # additional_input_paths - These paths will be included in the 'inputs' list to |
| 26 | # ensure that this target is rebuilt when one of these paths changes. |
| 27 | # additional_res_packages - Package names of R.java files generated in addition |
| 28 | # to the default package name defined in AndroidManifest.xml. |
| 29 | # additional_src_dirs - Additional directories with .java files to be compiled |
| 30 | # and included in the output of this target. |
| 31 | # additional_bundled_libs - Additional libraries what will be stripped and |
| 32 | # bundled in the apk. |
| 33 | # asset_location - The directory where assets are located. |
| 34 | # create_abi_split - Whether to create abi-based spilts. Splits |
| 35 | # are supported only for minSdkVersion >= 21. |
| 36 | # create_density_splits - Whether to create density-based apk splits. |
| 37 | # language_splits - List of languages to create apk splits for. |
| 38 | # generated_src_dirs - Same as additional_src_dirs except used for .java files |
| 39 | # that are generated at build time. This should be set automatically by a |
| 40 | # target's dependencies. The .java files in these directories are not |
| 41 | # included in the 'inputs' list (unlike additional_src_dirs). |
| 42 | # library_jars_paths - The path to library jars to be included in the classpath. |
| 43 | # These will not be included into the final apk. |
| 44 | # input_jars_paths - The path to jars to be included in the classpath. This |
| 45 | # should be filled automatically by depending on the appropriate targets. |
| 46 | # is_test_apk - Set to 1 if building a test apk. This prevents resources from |
| 47 | # dependencies from being re-included. |
| 48 | # native_lib_target - The target_name of the target which generates the final |
| 49 | # shared library to be included in this apk. A stripped copy of the |
| 50 | # library will be included in the apk. |
| 51 | # resource_dir - The directory for resources. |
| 52 | # shared_resources - Make a resource package that can be loaded by a different |
| 53 | # application at runtime to access the package's resources. |
| 54 | # app_as_shared_library - Make a resource package that can be loaded as shared |
| 55 | # library. |
| 56 | # R_package - A custom Java package to generate the resource file R.java in. |
| 57 | # By default, the package given in AndroidManifest.xml will be used. |
| 58 | # include_all_resources - Set to 1 to include all resource IDs in all generated |
| 59 | # R.java files. |
| 60 | # use_chromium_linker - Enable the content dynamic linker that allows sharing the |
| 61 | # RELRO section of the native libraries between the different processes. |
| 62 | # load_library_from_zip - When using the dynamic linker, load the library |
| 63 | # directly out of the zip file. |
| 64 | # use_relocation_packer - Enable relocation packing. Relies on the chromium |
| 65 | # linker, so use_chromium_linker must also be enabled. |
| 66 | # enable_chromium_linker_tests - Enable the content dynamic linker test support |
| 67 | # code. This allows a test APK to inject a Linker.TestRunner instance at |
| 68 | # runtime. Should only be used by the chromium_linker_test_apk target!! |
| 69 | # never_lint - Set to 1 to not run lint on this target. |
| 70 | # java_in_dir_suffix - To override the /src suffix on java_in_dir. |
| 71 | # app_manifest_version_name - set the apps 'human readable' version number. |
| 72 | # app_manifest_version_code - set the apps version number. |
| 73 | # dependencies_locale_zip_alternative_paths - a list of paths that used to |
| 74 | # replace dependencies_locale_zip_paths of all_dependent_settings. |
| 75 | { |
| 76 | 'variables': { |
| 77 | 'tested_apk_obfuscated_jar_path%': '/', |
| 78 | 'tested_apk_dex_path%': '/', |
| 79 | 'tested_apk_is_multidex%': 0, |
| 80 | 'tested_apk_generated_multidex_config%': 0, |
| 81 | 'additional_input_paths': [], |
| 82 | 'additional_locale_input_paths': [], |
| 83 | 'create_density_splits%': 0, |
| 84 | 'language_splits': [], |
| 85 | 'library_jars_paths': [], |
| 86 | 'input_jars_paths': [], |
| 87 | 'library_dexed_jars_paths': [], |
| 88 | 'additional_src_dirs': [], |
| 89 | 'generated_src_dirs': [], |
| 90 | 'app_manifest_version_name%': '<(android_app_version_name)', |
| 91 | 'app_manifest_version_code%': '<(android_app_version_code)', |
| 92 | # aapt generates this proguard.txt. |
| 93 | 'generated_proguard_file': '<(intermediate_dir)/proguard.txt', |
| 94 | 'proguard_enabled%': 'false', |
| 95 | 'debug_build_proguard_enabled%': 'false', |
| 96 | 'proguard_flags_paths': ['<(generated_proguard_file)'], |
| 97 | 'jar_name': 'chromium_apk_<(_target_name).jar', |
| 98 | 'resource_dir%':'<(DEPTH)/build/android/ant/empty/res', |
| 99 | 'R_package%':'', |
| 100 | 'include_all_resources%': 0, |
| 101 | 'additional_R_text_files': [], |
| 102 | 'dependencies_locale_zip_alternative_paths%': [], |
| 103 | 'dependencies_locale_zip_paths': [], |
| 104 | 'dependencies_res_zip_paths': [], |
| 105 | 'additional_res_packages': [], |
| 106 | 'additional_bundled_libs%': [], |
| 107 | 'is_test_apk%': 0, |
| 108 | # Allow icu data, v8 snapshots, and pak files to be loaded directly from the .apk. |
| 109 | # Note: These are actually suffix matches, not necessarily extensions. |
| 110 | 'extensions_to_not_compress%': '.dat,.bin,.pak', |
| 111 | 'resource_input_paths': [], |
| 112 | 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', |
| 113 | 'asset_location%': '<(intermediate_dir)/assets', |
| 114 | 'codegen_stamp': '<(intermediate_dir)/codegen.stamp', |
| 115 | 'package_input_paths': [], |
| 116 | 'ordered_libraries_file': '<(intermediate_dir)/native_libraries.json', |
| 117 | 'additional_ordered_libraries_file': '<(intermediate_dir)/additional_native_libraries.json', |
| 118 | 'native_libraries_template': '<(DEPTH)/base/android/java/templates/NativeLibraries.template', |
| 119 | 'native_libraries_java_dir': '<(intermediate_dir)/native_libraries_java/', |
| 120 | 'native_libraries_java_file': '<(native_libraries_java_dir)/NativeLibraries.java', |
| 121 | 'native_libraries_java_stamp': '<(intermediate_dir)/native_libraries_java.stamp', |
| 122 | 'native_libraries_template_data_dir': '<(intermediate_dir)/native_libraries/', |
| 123 | 'native_libraries_template_data_file': '<(native_libraries_template_data_dir)/native_libraries_array.h', |
| 124 | 'native_libraries_template_version_file': '<(native_libraries_template_data_dir)/native_libraries_version.h', |
| 125 | 'generate_build_config%': 0, |
| 126 | 'build_config_template': '<(DEPTH)/base/android/java/templates/BuildConfig.template', |
| 127 | 'build_config_java_dir': '<(intermediate_dir)/build_config/', |
| 128 | 'build_config_java_file': '<(build_config_java_dir)/BuildConfig.java', |
| 129 | 'build_config_java_stamp': '<(intermediate_dir)/build_config_java.stamp', |
| 130 | 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
| 131 | 'lint_stamp': '<(intermediate_dir)/lint.stamp', |
| 132 | 'lint_result': '<(intermediate_dir)/lint_result.xml', |
| 133 | 'lint_config': '<(intermediate_dir)/lint_config.xml', |
| 134 | 'never_lint%': 0, |
| 135 | 'findbugs_stamp': '<(intermediate_dir)/findbugs.stamp', |
| 136 | 'run_findbugs%': 0, |
| 137 | 'java_in_dir_suffix%': '/src', |
| 138 | 'emma_instr_stamp': '<(intermediate_dir)/emma_instr.stamp', |
| 139 | 'jar_stamp': '<(intermediate_dir)/jar.stamp', |
| 140 | 'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp', |
| 141 | 'pack_relocations_stamp': '<(intermediate_dir)/pack_relocations.stamp', |
| 142 | 'strip_stamp': '<(intermediate_dir)/strip.stamp', |
| 143 | 'stripped_libraries_dir': '<(intermediate_dir)/stripped_libraries', |
| 144 | 'strip_additional_stamp': '<(intermediate_dir)/strip_additional.stamp', |
| 145 | 'version_stamp': '<(intermediate_dir)/version.stamp', |
| 146 | 'javac_includes': [], |
| 147 | 'jar_excluded_classes': [], |
| 148 | 'javac_jar_path': '<(intermediate_dir)/<(_target_name).javac.jar', |
| 149 | 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| 150 | 'obfuscated_jar_path': '<(intermediate_dir)/obfuscated.jar', |
| 151 | 'test_jar_path': '<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar', |
| 152 | 'enable_multidex%': 0, |
| 153 | 'enable_multidex_configurations%': [], |
| 154 | 'multidex_configuration_path': '<(intermediate_dir)/multidex_config.json', |
| 155 | 'main_dex_list_path': '<(intermediate_dir)/main_dex_list.txt', |
| 156 | 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar', |
| 157 | 'android_manifest_path%': '<(java_in_dir)/AndroidManifest.xml', |
| 158 | 'split_android_manifest_path': '<(intermediate_dir)/split-manifests/<(android_app_abi)/AndroidManifest.xml', |
| 159 | 'push_stamp': '<(intermediate_dir)/push.stamp', |
| 160 | 'link_stamp': '<(intermediate_dir)/link.stamp', |
| 161 | 'resource_zip_path': '<(intermediate_dir)/<(_target_name).resources.zip', |
| 162 | 'shared_resources%': 0, |
| 163 | 'app_as_shared_library%': 0, |
| 164 | 'final_apk_path_no_extension%': '<(PRODUCT_DIR)/apks/<(apk_name)', |
| 165 | 'final_abi_split_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name)-abi-<(android_app_abi).apk', |
| 166 | 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', |
| 167 | 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', |
| 168 | 'device_intermediate_dir': '/data/data/org.chromium.gyp_managed_install/<(_target_name)/<(CONFIGURATION_NAME)', |
| 169 | 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', |
| 170 | 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh', |
| 171 | 'create_standalone_apk%': 1, |
| 172 | 'res_v14_skip%': 0, |
| 173 | 'variables': { |
| 174 | 'variables': { |
| 175 | 'native_lib_target%': '', |
| 176 | 'native_lib_version_name%': '', |
| 177 | 'use_chromium_linker%' : 0, |
| 178 | 'use_relocation_packer%' : 0, |
| 179 | 'enable_chromium_linker_tests%': 0, |
| 180 | 'is_test_apk%': 0, |
| 181 | 'unsigned_apk_path': '<(intermediate_dir)/<(apk_name)-unsigned.apk', |
| 182 | 'unsigned_abi_split_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-unsigned.apk', |
| 183 | 'create_abi_split%': 0, |
| 184 | 'enable_multidex%': 0, |
| 185 | }, |
| 186 | 'unsigned_apk_path': '<(unsigned_apk_path)', |
| 187 | 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', |
| 188 | 'create_abi_split%': '<(create_abi_split)', |
| 189 | 'final_apk_path%': '<(PRODUCT_DIR)/apks/<(apk_name).apk', |
| 190 | 'conditions': [ |
| 191 | ['gyp_managed_install == 1 and native_lib_target != ""', { |
| 192 | 'conditions': [ |
| 193 | ['create_abi_split == 0', { |
| 194 | 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-standalone-unsigned.apk', |
| 195 | }, { |
| 196 | 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-abi-<(android_app_abi)-standalone-unsigned.apk', |
| 197 | }], |
| 198 | ], |
| 199 | }, { |
| 200 | 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', |
| 201 | }], |
| 202 | ['gyp_managed_install == 1', { |
| 203 | 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
| 204 | }, { |
| 205 | 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
| 206 | }], |
| 207 | ['is_test_apk == 0 and emma_coverage != 0', { |
| 208 | 'emma_instrument%': 1, |
| 209 | },{ |
| 210 | 'emma_instrument%': 0, |
| 211 | }], |
| 212 | # When using abi splits, the abi split is modified by |
| 213 | # gyp_managed_install rather than the main .apk |
| 214 | ['create_abi_split == 1', { |
| 215 | 'managed_input_apk_path': '<(unsigned_abi_split_apk_path)', |
| 216 | }, { |
| 217 | 'managed_input_apk_path': '<(unsigned_apk_path)', |
| 218 | }], |
| 219 | ['enable_multidex == 1', { |
| 220 | 'dex_path': '<(intermediate_dir)/classes.dex.zip', |
| 221 | }, { |
| 222 | 'dex_path': '<(intermediate_dir)/classes.dex', |
| 223 | }], |
| 224 | ], |
| 225 | }, |
| 226 | 'native_lib_target%': '', |
| 227 | 'native_lib_version_name%': '', |
| 228 | 'use_chromium_linker%' : 0, |
| 229 | 'load_library_from_zip%' : 0, |
| 230 | 'use_relocation_packer%' : 0, |
| 231 | 'enable_chromium_linker_tests%': 0, |
| 232 | 'emma_instrument%': '<(emma_instrument)', |
| 233 | 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
| 234 | 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
| 235 | 'unsigned_apk_path': '<(unsigned_apk_path)', |
| 236 | 'unsigned_abi_split_apk_path': '<(unsigned_abi_split_apk_path)', |
| 237 | 'create_abi_split%': '<(create_abi_split)', |
| 238 | 'managed_input_apk_path': '<(managed_input_apk_path)', |
| 239 | 'libchromium_android_linker': 'libchromium_android_linker.>(android_product_extension)', |
| 240 | 'extra_native_libs': [], |
| 241 | 'native_lib_placeholder_stamp': '<(apk_package_native_libs_dir)/<(android_app_abi)/native_lib_placeholder.stamp', |
| 242 | 'native_lib_placeholders': [], |
| 243 | 'main_apk_name': '<(apk_name)', |
| 244 | 'dex_path': '<(dex_path)', |
| 245 | 'conditions': [ |
| 246 | ['chromium_code == 0', { |
| 247 | 'enable_errorprone': 0, |
| 248 | }], |
| 249 | ], |
| 250 | 'enable_errorprone%': 0, |
| 251 | 'errorprone_exe_path': '<(PRODUCT_DIR)/bin.java/chromium_errorprone', |
| 252 | 'final_apk_path%': '<(final_apk_path)', |
| 253 | }, |
| 254 | # Pass the jar path to the apk's "fake" jar target. This would be better as |
| 255 | # direct_dependent_settings, but a variable set by a direct_dependent_settings |
| 256 | # cannot be lifted in a dependent to all_dependent_settings. |
| 257 | 'all_dependent_settings': { |
| 258 | 'conditions': [ |
| 259 | ['proguard_enabled == "true"', { |
| 260 | 'variables': { |
| 261 | 'proguard_enabled': 'true', |
| 262 | } |
| 263 | }], |
| 264 | ['debug_build_proguard_enabled == "true"', { |
| 265 | 'variables': { |
| 266 | 'debug_build_proguard_enabled': 'true', |
| 267 | } |
| 268 | }], |
| 269 | ['is_test_apk == 0', { |
| 270 | 'variables': { |
| 271 | 'tested_apk_path': '<(final_apk_path)', |
| 272 | 'tested_apk_obfuscated_jar_path': '<(obfuscated_jar_path)', |
| 273 | 'tested_apk_dex_path': '<(dex_path)', |
| 274 | 'tested_apk_is_multidex': '<(enable_multidex)', |
| 275 | 'tested_apk_generated_multidex_config': '>(generate_build_config)', |
| 276 | } |
| 277 | }] |
| 278 | ], |
| 279 | 'variables': { |
| 280 | 'apk_output_jar_path': '<(jar_path)', |
| 281 | }, |
| 282 | }, |
| 283 | 'conditions': [ |
| 284 | ['resource_dir!=""', { |
| 285 | 'variables': { |
| 286 | 'resource_input_paths': [ '<!@(find <(resource_dir) -name "*")' ] |
| 287 | }, |
| 288 | }], |
| 289 | ['R_package != ""', { |
| 290 | 'variables': { |
| 291 | # We generate R.java in package R_package (in addition to the package |
| 292 | # listed in the AndroidManifest.xml, which is unavoidable). |
| 293 | 'additional_res_packages': ['<(R_package)'], |
| 294 | 'additional_R_text_files': ['<(intermediate_dir)/R.txt'], |
| 295 | }, |
| 296 | }], |
| 297 | ['native_lib_target != "" and android_must_copy_system_libraries == 1', { |
| 298 | 'dependencies': [ |
| 299 | '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', |
| 300 | ], |
| 301 | }], |
| 302 | ['use_chromium_linker == 1', { |
| 303 | 'dependencies': [ |
| 304 | '<(DEPTH)/base/base.gyp:chromium_android_linker', |
| 305 | ], |
| 306 | }], |
| 307 | ['enable_errorprone == 1', { |
| 308 | 'dependencies': [ |
| 309 | '<(DEPTH)/third_party/errorprone/errorprone.gyp:require_errorprone', |
| 310 | ], |
| 311 | }], |
| 312 | ['native_lib_target != ""', { |
| 313 | 'variables': { |
| 314 | 'conditions': [ |
| 315 | ['use_chromium_linker == 1', { |
| 316 | 'variables': { |
| 317 | 'chromium_linker_path': [ |
| 318 | '<(SHARED_LIB_DIR)/<(libchromium_android_linker)', |
| 319 | ], |
| 320 | } |
| 321 | }, { |
| 322 | 'variables': { |
| 323 | 'chromium_linker_path': [], |
| 324 | }, |
| 325 | }], |
| 326 | ], |
| 327 | 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
| 328 | 'native_libs_paths': [ |
| 329 | '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)', |
| 330 | '<@(chromium_linker_path)' |
| 331 | ], |
| 332 | 'package_input_paths': [ |
| 333 | '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver', |
| 334 | ], |
| 335 | }, |
| 336 | 'copies': [ |
| 337 | { |
| 338 | # gdbserver is always copied into the APK's native libs dir. The ant |
| 339 | # build scripts (apkbuilder task) will only include it in a debug |
| 340 | # build. |
| 341 | 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)', |
| 342 | 'files': [ |
| 343 | '<(android_gdbserver)', |
| 344 | ], |
| 345 | }, |
| 346 | ], |
| 347 | 'actions': [ |
| 348 | { |
| 349 | 'variables': { |
| 350 | 'input_libraries': [ |
| 351 | '<@(native_libs_paths)', |
| 352 | '<@(extra_native_libs)', |
| 353 | ], |
| 354 | }, |
| 355 | 'includes': ['../build/android/write_ordered_libraries.gypi'], |
| 356 | }, |
| 357 | { |
| 358 | 'action_name': 'native_libraries_<(_target_name)', |
| 359 | 'variables': { |
| 360 | 'conditions': [ |
| 361 | ['use_chromium_linker == 1', { |
| 362 | 'variables': { |
| 363 | 'linker_gcc_preprocess_defines': [ |
| 364 | '--defines', 'ENABLE_CHROMIUM_LINKER', |
| 365 | ], |
| 366 | } |
| 367 | }, { |
| 368 | 'variables': { |
| 369 | 'linker_gcc_preprocess_defines': [], |
| 370 | }, |
| 371 | }], |
| 372 | ['load_library_from_zip == 1', { |
| 373 | 'variables': { |
| 374 | 'linker_load_from_zip_file_preprocess_defines': [ |
| 375 | '--defines', 'ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE', |
| 376 | ], |
| 377 | } |
| 378 | }, { |
| 379 | 'variables': { |
| 380 | 'linker_load_from_zip_file_preprocess_defines': [], |
| 381 | }, |
| 382 | }], |
| 383 | ['enable_chromium_linker_tests == 1', { |
| 384 | 'variables': { |
| 385 | 'linker_tests_gcc_preprocess_defines': [ |
| 386 | '--defines', 'ENABLE_CHROMIUM_LINKER_TESTS', |
| 387 | ], |
| 388 | } |
| 389 | }, { |
| 390 | 'variables': { |
| 391 | 'linker_tests_gcc_preprocess_defines': [], |
| 392 | }, |
| 393 | }], |
| 394 | ], |
| 395 | 'gcc_preprocess_defines': [ |
| 396 | '<@(linker_load_from_zip_file_preprocess_defines)', |
| 397 | '<@(linker_gcc_preprocess_defines)', |
| 398 | '<@(linker_tests_gcc_preprocess_defines)', |
| 399 | ], |
| 400 | }, |
| 401 | 'message': 'Creating NativeLibraries.java for <(_target_name)', |
| 402 | 'inputs': [ |
| 403 | '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 404 | '<(DEPTH)/build/android/gyp/gcc_preprocess.py', |
| 405 | '<(ordered_libraries_file)', |
| 406 | '<(native_libraries_template)', |
| 407 | ], |
| 408 | 'outputs': [ |
| 409 | '<(native_libraries_java_stamp)', |
| 410 | ], |
| 411 | 'action': [ |
| 412 | 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', |
| 413 | '--include-path=', |
| 414 | '--output=<(native_libraries_java_file)', |
| 415 | '--template=<(native_libraries_template)', |
| 416 | '--stamp=<(native_libraries_java_stamp)', |
| 417 | '--defines', 'NATIVE_LIBRARIES_LIST=@FileArg(<(ordered_libraries_file):java_libraries_list)', |
| 418 | '--defines', 'NATIVE_LIBRARIES_VERSION_NUMBER="<(native_lib_version_name)"', |
| 419 | '<@(gcc_preprocess_defines)', |
| 420 | ], |
| 421 | }, |
| 422 | { |
| 423 | 'action_name': 'strip_native_libraries', |
| 424 | 'variables': { |
| 425 | 'ordered_libraries_file%': '<(ordered_libraries_file)', |
| 426 | 'stripped_libraries_dir%': '<(stripped_libraries_dir)', |
| 427 | 'input_paths': [ |
| 428 | '<@(native_libs_paths)', |
| 429 | '<@(extra_native_libs)', |
| 430 | ], |
| 431 | 'stamp': '<(strip_stamp)' |
| 432 | }, |
| 433 | 'includes': ['../build/android/strip_native_libraries.gypi'], |
| 434 | }, |
| 435 | { |
| 436 | 'action_name': 'insert_chromium_version', |
| 437 | 'variables': { |
| 438 | 'ordered_libraries_file%': '<(ordered_libraries_file)', |
| 439 | 'stripped_libraries_dir%': '<(stripped_libraries_dir)', |
| 440 | 'version_string': '<(native_lib_version_name)', |
| 441 | 'input_paths': [ |
| 442 | '<(strip_stamp)', |
| 443 | ], |
| 444 | 'stamp': '<(version_stamp)' |
| 445 | }, |
| 446 | 'includes': ['../build/android/insert_chromium_version.gypi'], |
| 447 | }, |
| 448 | { |
| 449 | 'action_name': 'pack_relocations', |
| 450 | 'variables': { |
| 451 | 'conditions': [ |
| 452 | ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', { |
| 453 | 'enable_packing': 1, |
| 454 | }, { |
| 455 | 'enable_packing': 0, |
| 456 | }], |
| 457 | ], |
| 458 | 'exclude_packing_list': [ |
| 459 | '<(libchromium_android_linker)', |
| 460 | ], |
| 461 | 'ordered_libraries_file%': '<(ordered_libraries_file)', |
| 462 | 'stripped_libraries_dir%': '<(stripped_libraries_dir)', |
| 463 | 'packed_libraries_dir': '<(libraries_source_dir)', |
| 464 | 'input_paths': [ |
| 465 | '<(version_stamp)' |
| 466 | ], |
| 467 | 'stamp': '<(pack_relocations_stamp)', |
| 468 | }, |
| 469 | 'includes': ['../build/android/pack_relocations.gypi'], |
| 470 | }, |
| 471 | { |
| 472 | 'variables': { |
| 473 | 'input_libraries': [ |
| 474 | '<@(additional_bundled_libs)', |
| 475 | ], |
| 476 | 'ordered_libraries_file': '<(additional_ordered_libraries_file)', |
| 477 | 'subtarget': '_additional_libraries', |
| 478 | }, |
| 479 | 'includes': ['../build/android/write_ordered_libraries.gypi'], |
| 480 | }, |
| 481 | { |
| 482 | 'action_name': 'strip_additional_libraries', |
| 483 | 'variables': { |
| 484 | 'ordered_libraries_file': '<(additional_ordered_libraries_file)', |
| 485 | 'stripped_libraries_dir': '<(libraries_source_dir)', |
| 486 | 'input_paths': [ |
| 487 | '<@(additional_bundled_libs)', |
| 488 | '<(strip_stamp)', |
| 489 | ], |
| 490 | 'stamp': '<(strip_additional_stamp)' |
| 491 | }, |
| 492 | 'includes': ['../build/android/strip_native_libraries.gypi'], |
| 493 | }, |
| 494 | { |
| 495 | 'action_name': 'Create native lib placeholder files for previous releases', |
| 496 | 'variables': { |
| 497 | 'placeholders': ['<@(native_lib_placeholders)'], |
| 498 | 'conditions': [ |
| 499 | ['gyp_managed_install == 1', { |
| 500 | # This "library" just needs to be put in the .apk. It is not loaded |
| 501 | # at runtime. |
| 502 | 'placeholders': ['libfix.crbug.384638.so'], |
| 503 | }] |
| 504 | ], |
| 505 | }, |
| 506 | 'inputs': [ |
| 507 | '<(DEPTH)/build/android/gyp/create_placeholder_files.py', |
| 508 | ], |
| 509 | 'outputs': [ |
| 510 | '<(native_lib_placeholder_stamp)', |
| 511 | ], |
| 512 | 'action': [ |
| 513 | 'python', '<(DEPTH)/build/android/gyp/create_placeholder_files.py', |
| 514 | '--dest-lib-dir=<(apk_package_native_libs_dir)/<(android_app_abi)/', |
| 515 | '--stamp=<(native_lib_placeholder_stamp)', |
| 516 | '<@(placeholders)', |
| 517 | ], |
| 518 | }, |
| 519 | ], |
| 520 | 'conditions': [ |
| 521 | ['gyp_managed_install == 1', { |
| 522 | 'variables': { |
| 523 | 'libraries_top_dir': '<(intermediate_dir)/lib.stripped', |
| 524 | 'libraries_source_dir': '<(libraries_top_dir)/lib/<(android_app_abi)', |
| 525 | 'device_library_dir': '<(device_intermediate_dir)/lib.stripped', |
| 526 | }, |
| 527 | 'dependencies': [ |
| 528 | '<(DEPTH)/build/android/setup.gyp:get_build_device_configurations', |
| 529 | '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands', |
| 530 | ], |
| 531 | 'actions': [ |
| 532 | { |
| 533 | 'includes': ['../build/android/push_libraries.gypi'], |
| 534 | }, |
| 535 | { |
| 536 | 'action_name': 'create device library symlinks', |
| 537 | 'message': 'Creating links on device for <(_target_name)', |
| 538 | 'inputs': [ |
| 539 | '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 540 | '<(DEPTH)/build/android/gyp/create_device_library_links.py', |
| 541 | '<(apk_install_record)', |
| 542 | '<(build_device_config_path)', |
| 543 | '<(ordered_libraries_file)', |
| 544 | ], |
| 545 | 'outputs': [ |
| 546 | '<(link_stamp)' |
| 547 | ], |
| 548 | 'action': [ |
| 549 | 'python', '<(DEPTH)/build/android/gyp/create_device_library_links.py', |
| 550 | '--build-device-configuration=<(build_device_config_path)', |
| 551 | '--libraries=@FileArg(<(ordered_libraries_file):libraries)', |
| 552 | '--script-host-path=<(symlink_script_host_path)', |
| 553 | '--script-device-path=<(symlink_script_device_path)', |
| 554 | '--target-dir=<(device_library_dir)', |
| 555 | '--apk=<(incomplete_apk_path)', |
| 556 | '--stamp=<(link_stamp)', |
| 557 | '--configuration-name=<(CONFIGURATION_NAME)', |
| 558 | '--output-directory=<(PRODUCT_DIR)', |
| 559 | ], |
| 560 | }, |
| 561 | ], |
| 562 | 'conditions': [ |
| 563 | ['create_standalone_apk == 1', { |
| 564 | 'actions': [ |
| 565 | { |
| 566 | 'action_name': 'create standalone APK', |
| 567 | 'variables': { |
| 568 | 'inputs': [ |
| 569 | '<(ordered_libraries_file)', |
| 570 | '<(strip_additional_stamp)', |
| 571 | '<(pack_relocations_stamp)', |
| 572 | ], |
| 573 | 'output_apk_path': '<(unsigned_standalone_apk_path)', |
| 574 | 'libraries_top_dir%': '<(libraries_top_dir)', |
| 575 | 'input_apk_path': '<(managed_input_apk_path)', |
| 576 | }, |
| 577 | 'includes': [ 'android/create_standalone_apk_action.gypi' ], |
| 578 | }, |
| 579 | ], |
| 580 | }], |
| 581 | ], |
| 582 | }, { |
| 583 | # gyp_managed_install != 1 |
| 584 | 'variables': { |
| 585 | 'libraries_source_dir': '<(apk_package_native_libs_dir)/<(android_app_abi)', |
| 586 | 'package_input_paths': [ |
| 587 | '<(strip_additional_stamp)', |
| 588 | '<(pack_relocations_stamp)', |
| 589 | ], |
| 590 | }, |
| 591 | }], |
| 592 | ], |
| 593 | }], # native_lib_target != '' |
| 594 | ['gyp_managed_install == 0 or create_standalone_apk == 1 or create_abi_split == 1', { |
| 595 | 'dependencies': [ |
| 596 | '<(DEPTH)/build/android/rezip.gyp:rezip_apk_jar', |
| 597 | ], |
| 598 | }], |
| 599 | ['create_abi_split == 1 or gyp_managed_install == 0 or create_standalone_apk == 1', { |
| 600 | 'actions': [ |
| 601 | { |
| 602 | 'action_name': 'finalize_base', |
| 603 | 'variables': { |
| 604 | 'output_apk_path': '<(final_apk_path)', |
| 605 | 'conditions': [ |
| 606 | ['create_abi_split == 0', { |
| 607 | 'input_apk_path': '<(unsigned_standalone_apk_path)', |
| 608 | }, { |
| 609 | 'input_apk_path': '<(unsigned_apk_path)', |
| 610 | 'load_library_from_zip': 0, |
| 611 | }] |
| 612 | ], |
| 613 | }, |
| 614 | 'includes': [ 'android/finalize_apk_action.gypi'] |
| 615 | }, |
| 616 | ], |
| 617 | }], |
| 618 | ['create_abi_split == 1', { |
| 619 | 'actions': [ |
| 620 | { |
| 621 | 'action_name': 'generate_split_manifest_<(_target_name)', |
| 622 | 'inputs': [ |
| 623 | '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 624 | '<(DEPTH)/build/android/gyp/generate_split_manifest.py', |
| 625 | '<(android_manifest_path)', |
| 626 | ], |
| 627 | 'outputs': [ |
| 628 | '<(split_android_manifest_path)', |
| 629 | ], |
| 630 | 'action': [ |
| 631 | 'python', '<(DEPTH)/build/android/gyp/generate_split_manifest.py', |
| 632 | '--main-manifest', '<(android_manifest_path)', |
| 633 | '--out-manifest', '<(split_android_manifest_path)', |
| 634 | '--split', 'abi_<(android_app_abi)', |
| 635 | ], |
| 636 | }, |
| 637 | { |
| 638 | 'variables': { |
| 639 | 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)', |
| 640 | 'asset_location': '', |
| 641 | 'android_manifest_path': '<(split_android_manifest_path)', |
| 642 | 'create_density_splits': 0, |
| 643 | 'language_splits=': [], |
| 644 | }, |
| 645 | 'includes': [ 'android/package_resources_action.gypi' ], |
| 646 | }, |
| 647 | { |
| 648 | 'variables': { |
| 649 | 'apk_name': '<(main_apk_name)-abi-<(android_app_abi)', |
| 650 | 'apk_path': '<(unsigned_abi_split_apk_path)', |
| 651 | 'has_code': 0, |
| 652 | 'native_libs_dir': '<(apk_package_native_libs_dir)', |
| 653 | 'extra_inputs': ['<(native_lib_placeholder_stamp)'], |
| 654 | }, |
| 655 | 'includes': ['android/apkbuilder_action.gypi'], |
| 656 | }, |
| 657 | ], |
| 658 | }], |
| 659 | ['create_abi_split == 1 and (gyp_managed_install == 0 or create_standalone_apk == 1)', { |
| 660 | 'actions': [ |
| 661 | { |
| 662 | 'action_name': 'finalize_split', |
| 663 | 'variables': { |
| 664 | 'output_apk_path': '<(final_abi_split_apk_path)', |
| 665 | 'conditions': [ |
| 666 | ['gyp_managed_install == 1', { |
| 667 | 'input_apk_path': '<(unsigned_standalone_apk_path)', |
| 668 | }, { |
| 669 | 'input_apk_path': '<(unsigned_abi_split_apk_path)', |
| 670 | }], |
| 671 | ], |
| 672 | }, |
| 673 | 'includes': [ 'android/finalize_apk_action.gypi'] |
| 674 | }, |
| 675 | ], |
| 676 | }], |
| 677 | ['gyp_managed_install == 1', { |
| 678 | 'actions': [ |
| 679 | { |
| 680 | 'action_name': 'finalize incomplete apk', |
| 681 | 'variables': { |
| 682 | 'load_library_from_zip': 0, |
| 683 | 'input_apk_path': '<(managed_input_apk_path)', |
| 684 | 'output_apk_path': '<(incomplete_apk_path)', |
| 685 | }, |
| 686 | 'includes': [ 'android/finalize_apk_action.gypi'] |
| 687 | }, |
| 688 | { |
| 689 | 'action_name': 'apk_install_<(_target_name)', |
| 690 | 'message': 'Installing <(apk_name).apk', |
| 691 | 'inputs': [ |
| 692 | '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 693 | '<(DEPTH)/build/android/gyp/apk_install.py', |
| 694 | '<(build_device_config_path)', |
| 695 | '<(incomplete_apk_path)', |
| 696 | ], |
| 697 | 'outputs': [ |
| 698 | '<(apk_install_record)', |
| 699 | ], |
| 700 | 'action': [ |
| 701 | 'python', '<(DEPTH)/build/android/gyp/apk_install.py', |
| 702 | '--build-device-configuration=<(build_device_config_path)', |
| 703 | '--install-record=<(apk_install_record)', |
| 704 | '--configuration-name=<(CONFIGURATION_NAME)', |
| 705 | '--android-sdk-tools', '<(android_sdk_tools)', |
| 706 | '--output-directory', '<(PRODUCT_DIR)', |
| 707 | ], |
| 708 | 'conditions': [ |
| 709 | ['create_abi_split == 1', { |
| 710 | 'inputs': [ |
| 711 | '<(final_apk_path)', |
| 712 | ], |
| 713 | 'action': [ |
| 714 | '--apk-path=<(final_apk_path)', |
| 715 | '--split-apk-path=<(incomplete_apk_path)', |
| 716 | ], |
| 717 | }, { |
| 718 | 'action': [ |
| 719 | '--apk-path=<(incomplete_apk_path)', |
| 720 | ], |
| 721 | }], |
| 722 | ['create_density_splits == 1', { |
| 723 | 'inputs': [ |
| 724 | '<(final_apk_path_no_extension)-density-hdpi.apk', |
| 725 | '<(final_apk_path_no_extension)-density-xhdpi.apk', |
| 726 | '<(final_apk_path_no_extension)-density-xxhdpi.apk', |
| 727 | '<(final_apk_path_no_extension)-density-xxxhdpi.apk', |
| 728 | '<(final_apk_path_no_extension)-density-tvdpi.apk', |
| 729 | ], |
| 730 | 'action': [ |
| 731 | '--split-apk-path=<(final_apk_path_no_extension)-density-hdpi.apk', |
| 732 | '--split-apk-path=<(final_apk_path_no_extension)-density-xhdpi.apk', |
| 733 | '--split-apk-path=<(final_apk_path_no_extension)-density-xxhdpi.apk', |
| 734 | '--split-apk-path=<(final_apk_path_no_extension)-density-xxxhdpi.apk', |
| 735 | '--split-apk-path=<(final_apk_path_no_extension)-density-tvdpi.apk', |
| 736 | ], |
| 737 | }], |
| 738 | ['language_splits != []', { |
| 739 | 'inputs': [ |
| 740 | "<!@(python <(DEPTH)/build/apply_locales.py '<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))", |
| 741 | ], |
| 742 | 'action': [ |
| 743 | "<!@(python <(DEPTH)/build/apply_locales.py -- '--split-apk-path=<(final_apk_path_no_extension)-lang-ZZLOCALE.apk' <(language_splits))", |
| 744 | ], |
| 745 | }], |
| 746 | ], |
| 747 | }, |
| 748 | ], |
| 749 | }], |
| 750 | ['create_density_splits == 1', { |
| 751 | 'actions': [ |
| 752 | { |
| 753 | 'action_name': 'finalize_density_splits', |
| 754 | 'variables': { |
| 755 | 'density_splits': 1, |
| 756 | }, |
| 757 | 'includes': [ 'android/finalize_splits_action.gypi'] |
| 758 | }, |
| 759 | ], |
| 760 | }], |
| 761 | ['is_test_apk == 1', { |
| 762 | 'dependencies': [ |
| 763 | '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands', |
| 764 | '<(DEPTH)/tools/android/android_tools.gyp:android_tools', |
| 765 | ], |
| 766 | }], |
| 767 | ['run_findbugs == 1', { |
| 768 | 'actions': [ |
| 769 | { |
| 770 | 'action_name': 'findbugs_<(_target_name)', |
| 771 | 'message': 'Running findbugs on <(_target_name)', |
| 772 | 'variables': { |
| 773 | 'additional_findbugs_args': [], |
| 774 | 'findbugs_verbose%': 0, |
| 775 | }, |
| 776 | 'conditions': [ |
| 777 | ['findbugs_verbose == 1', { |
| 778 | 'variables': { |
| 779 | 'additional_findbugs_args+': ['-vv'], |
| 780 | }, |
| 781 | }], |
| 782 | ], |
| 783 | 'inputs': [ |
| 784 | '<(DEPTH)/build/android/findbugs_diff.py', |
| 785 | '<(DEPTH)/build/android/findbugs_filter/findbugs_exclude.xml', |
| 786 | '<(DEPTH)/build/android/pylib/utils/findbugs.py', |
| 787 | '>@(input_jars_paths)', |
| 788 | '<(jar_path)', |
| 789 | '<(compile_stamp)', |
| 790 | ], |
| 791 | 'outputs': [ |
| 792 | '<(findbugs_stamp)', |
| 793 | ], |
| 794 | 'action': [ |
| 795 | 'python', '<(DEPTH)/build/android/findbugs_diff.py', |
| 796 | '--auxclasspath-gyp', '>(input_jars_paths)', |
| 797 | '--stamp', '<(findbugs_stamp)', |
| 798 | '<@(additional_findbugs_args)', |
| 799 | '<(jar_path)', |
| 800 | ], |
| 801 | }, |
| 802 | ], |
| 803 | }], |
| 804 | ], |
| 805 | 'target_conditions': [ |
| 806 | ['generate_build_config == 1 and tested_apk_generated_multidex_config == 0', { |
| 807 | 'variables': { |
| 808 | 'generated_src_dirs': ['<(build_config_java_dir)'], |
| 809 | }, |
| 810 | 'actions': [ |
| 811 | { |
| 812 | 'action_name': 'configure_multidex_for_<(_target_name)', |
| 813 | 'inputs': [ |
| 814 | '<(DEPTH)/build/android/gyp/configure_multidex.py', |
| 815 | '<(build_config_template)', |
| 816 | ], |
| 817 | 'outputs': [ |
| 818 | '<(multidex_configuration_path)', |
| 819 | '<(build_config_java_stamp)', |
| 820 | ], |
| 821 | 'variables': { |
| 822 | 'additional_multidex_config_options': [], |
| 823 | 'enabled_configurations': '>(enable_multidex_configurations)', |
| 824 | 'conditions': [ |
| 825 | ['enable_multidex == 1', { |
| 826 | 'additional_multidex_config_options': ['--enable-multidex'], |
| 827 | }], |
| 828 | ], |
| 829 | }, |
| 830 | 'action': [ |
| 831 | 'python', '<(DEPTH)/build/android/gyp/configure_multidex.py', |
| 832 | '--configuration-name', '<(CONFIGURATION_NAME)', |
| 833 | '--enabled-configurations', '<(enabled_configurations)', |
| 834 | '--multidex-configuration-path', '<(multidex_configuration_path)', |
| 835 | '--multidex-config-java-template', '<(build_config_template)', |
| 836 | '--multidex-config-java-file', '<(build_config_java_file)', |
| 837 | '--multidex-config-java-stamp', '<(build_config_java_stamp)', |
| 838 | '>@(additional_multidex_config_options)', |
| 839 | ], |
| 840 | }, |
| 841 | ], |
| 842 | 'conditions': [ |
| 843 | ['enable_multidex == 1', { |
| 844 | 'actions': [ |
| 845 | { |
| 846 | 'action_name': 'main_dex_list_for_<(_target_name)', |
| 847 | 'variables': { |
| 848 | 'jar_paths': ['>@(input_jars_paths)', '<(javac_jar_path)'], |
| 849 | 'output_path': '<(main_dex_list_path)', |
| 850 | }, |
| 851 | 'includes': [ 'android/main_dex_action.gypi' ], |
| 852 | }, |
| 853 | ] |
| 854 | }] |
| 855 | ], |
| 856 | }], |
| 857 | ], |
| 858 | 'dependencies': [ |
| 859 | '<(DEPTH)/build/android/android_lint_cache.gyp:android_lint_cache', |
| 860 | '<(DEPTH)/tools/android/md5sum/md5sum.gyp:md5sum', |
| 861 | ], |
| 862 | 'actions': [ |
| 863 | { |
| 864 | 'action_name': 'process_resources', |
| 865 | 'message': 'processing resources for <(_target_name)', |
| 866 | 'variables': { |
| 867 | 'local_additional_input_paths': [ |
| 868 | '>@(additional_input_paths)', |
| 869 | ], |
| 870 | 'local_dependencies_res_zip_paths': [ |
| 871 | '>@(dependencies_res_zip_paths)' |
| 872 | ], |
| 873 | # Write the inputs list to a file, so that its mtime is updated when |
| 874 | # the list of inputs changes. |
| 875 | 'inputs_list_file': '>|(apk_codegen.<(_target_name).gypcmd >@(local_additional_input_paths) >@(resource_input_paths))', |
| 876 | |
| 877 | 'process_resources_options': [], |
| 878 | 'conditions': [ |
| 879 | ['dependencies_locale_zip_alternative_paths == []', { |
| 880 | 'local_dependencies_res_zip_paths': ['>@(dependencies_locale_zip_paths)'], |
| 881 | 'local_additional_input_paths': ['>@(additional_locale_input_paths)'] |
| 882 | }, { |
| 883 | 'local_dependencies_res_zip_paths': ['<@(dependencies_locale_zip_alternative_paths)'], |
| 884 | 'local_additional_input_paths': ['>@(dependencies_locale_zip_alternative_paths)'], |
| 885 | }], |
| 886 | ['is_test_apk == 1', { |
| 887 | 'dependencies_locale_zip_paths=': [], |
| 888 | 'dependencies_res_zip_paths=': [], |
| 889 | 'additional_res_packages=': [], |
| 890 | }], |
| 891 | ['res_v14_skip == 1', { |
| 892 | 'process_resources_options+': ['--v14-skip'] |
| 893 | }], |
| 894 | ['shared_resources == 1', { |
| 895 | 'process_resources_options+': ['--shared-resources'] |
| 896 | }], |
| 897 | ['app_as_shared_library == 1', { |
| 898 | 'process_resources_options+': ['--app-as-shared-lib'] |
| 899 | }], |
| 900 | ['R_package != ""', { |
| 901 | 'process_resources_options+': ['--custom-package', '<(R_package)'] |
| 902 | }], |
| 903 | ['include_all_resources == 1', { |
| 904 | 'process_resources_options+': ['--include-all-resources'] |
| 905 | }] |
| 906 | ], |
| 907 | }, |
| 908 | 'inputs': [ |
| 909 | '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 910 | '<(DEPTH)/build/android/gyp/process_resources.py', |
| 911 | '<(android_manifest_path)', |
| 912 | '>@(local_additional_input_paths)', |
| 913 | '>@(resource_input_paths)', |
| 914 | '>@(local_dependencies_res_zip_paths)', |
| 915 | '>(inputs_list_file)', |
| 916 | ], |
| 917 | 'outputs': [ |
| 918 | '<(resource_zip_path)', |
| 919 | '<(generated_proguard_file)', |
| 920 | '<(codegen_stamp)', |
| 921 | ], |
| 922 | 'action': [ |
| 923 | 'python', '<(DEPTH)/build/android/gyp/process_resources.py', |
| 924 | '--android-sdk-jar', '<(android_sdk_jar)', |
| 925 | '--aapt-path', '<(android_aapt_path)', |
| 926 | |
| 927 | '--android-manifest', '<(android_manifest_path)', |
| 928 | '--dependencies-res-zips', '>(local_dependencies_res_zip_paths)', |
| 929 | |
| 930 | '--extra-res-packages', '>(additional_res_packages)', |
| 931 | '--extra-r-text-files', '>(additional_R_text_files)', |
| 932 | |
| 933 | '--proguard-file', '<(generated_proguard_file)', |
| 934 | |
| 935 | '--resource-dirs', '<(resource_dir)', |
| 936 | '--resource-zip-out', '<(resource_zip_path)', |
| 937 | |
| 938 | '--R-dir', '<(intermediate_dir)/gen', |
| 939 | |
| 940 | '--stamp', '<(codegen_stamp)', |
| 941 | |
| 942 | '<@(process_resources_options)', |
| 943 | ], |
| 944 | }, |
| 945 | { |
| 946 | 'action_name': 'javac_<(_target_name)', |
| 947 | 'message': 'Compiling java for <(_target_name)', |
| 948 | 'variables': { |
| 949 | 'extra_args': [], |
| 950 | 'extra_inputs': [], |
| 951 | 'gen_src_dirs': [ |
| 952 | '<(intermediate_dir)/gen', |
| 953 | '>@(generated_src_dirs)', |
| 954 | ], |
| 955 | # If there is a separate find for additional_src_dirs, it will find the |
| 956 | # wrong .java files when additional_src_dirs is empty. |
| 957 | # TODO(thakis): Gyp caches >! evaluation by command. Both java.gypi and |
| 958 | # java_apk.gypi evaluate the same command, and at the moment two targets |
| 959 | # set java_in_dir to "java". Add a dummy comment here to make sure |
| 960 | # that the two targets (one uses java.gypi, the other java_apk.gypi) |
| 961 | # get distinct source lists. Medium-term, make targets list all their |
| 962 | # Java files instead of using find. (As is, this will be broken if two |
| 963 | # targets use the same java_in_dir and both use java_apk.gypi or |
| 964 | # both use java.gypi.) |
| 965 | 'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'], |
| 966 | 'conditions': [ |
| 967 | ['enable_errorprone == 1', { |
| 968 | 'extra_inputs': [ |
| 969 | '<(errorprone_exe_path)', |
| 970 | ], |
| 971 | 'extra_args': [ '--use-errorprone-path=<(errorprone_exe_path)' ], |
| 972 | }], |
| 973 | ], |
| 974 | }, |
| 975 | 'inputs': [ |
| 976 | '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 977 | '<(DEPTH)/build/android/gyp/javac.py', |
| 978 | '>@(java_sources)', |
| 979 | '>@(input_jars_paths)', |
| 980 | '<(codegen_stamp)', |
| 981 | '<@(extra_inputs)', |
| 982 | ], |
| 983 | 'conditions': [ |
| 984 | ['native_lib_target != ""', { |
| 985 | 'inputs': [ '<(native_libraries_java_stamp)' ], |
| 986 | }], |
| 987 | ], |
| 988 | 'target_conditions': [ |
| 989 | ['generate_build_config == 1 and tested_apk_generated_multidex_config == 0', { |
| 990 | 'inputs': [ '<(build_config_java_stamp)' ], |
| 991 | }], |
| 992 | ], |
| 993 | 'outputs': [ |
| 994 | '<(compile_stamp)', |
| 995 | '<(javac_jar_path)', |
| 996 | ], |
| 997 | 'action': [ |
| 998 | 'python', '<(DEPTH)/build/android/gyp/javac.py', |
| 999 | '--bootclasspath=<(android_sdk_jar)', |
| 1000 | '--classpath=>(input_jars_paths) <(android_sdk_jar) >(library_jars_paths)', |
| 1001 | '--src-gendirs=>(gen_src_dirs)', |
| 1002 | '--javac-includes=<(javac_includes)', |
| 1003 | '--chromium-code=<(chromium_code)', |
| 1004 | '--jar-path=<(javac_jar_path)', |
| 1005 | '--jar-excluded-classes=<(jar_excluded_classes)', |
| 1006 | '--stamp=<(compile_stamp)', |
| 1007 | '<@(extra_args)', |
| 1008 | '>@(java_sources)', |
| 1009 | ], |
| 1010 | }, |
| 1011 | { |
| 1012 | 'action_name': 'emma_instr_jar_<(_target_name)', |
| 1013 | 'message': 'Instrumenting <(_target_name) jar', |
| 1014 | 'variables': { |
| 1015 | 'input_path': '<(javac_jar_path)', |
| 1016 | 'output_path': '<(jar_path)', |
| 1017 | 'coverage_file': '<(PRODUCT_DIR)/lib.java/<(_target_name).em', |
| 1018 | 'sources_list_file': '<(PRODUCT_DIR)/lib.java/<(_target_name)_sources.txt', |
| 1019 | 'stamp_path': '<(emma_instr_stamp)', |
| 1020 | }, |
| 1021 | 'outputs': [ |
| 1022 | '<(emma_instr_stamp)', |
| 1023 | '<(jar_path)', |
| 1024 | ], |
| 1025 | 'inputs': [ |
| 1026 | '<(javac_jar_path)', |
| 1027 | ], |
| 1028 | 'includes': [ 'android/emma_instr_action.gypi' ], |
| 1029 | }, |
| 1030 | { |
| 1031 | 'variables': { |
| 1032 | 'src_dirs': [ |
| 1033 | '<(java_in_dir)<(java_in_dir_suffix)', |
| 1034 | '>@(additional_src_dirs)', |
| 1035 | ], |
| 1036 | 'lint_jar_path': '<(jar_path)', |
| 1037 | 'stamp_path': '<(lint_stamp)', |
| 1038 | 'result_path': '<(lint_result)', |
| 1039 | 'config_path': '<(lint_config)', |
| 1040 | }, |
| 1041 | 'outputs': [ |
| 1042 | '<(lint_stamp)', |
| 1043 | ], |
| 1044 | 'includes': [ 'android/lint_action.gypi' ], |
| 1045 | }, |
| 1046 | { |
| 1047 | 'action_name': 'obfuscate_<(_target_name)', |
| 1048 | 'message': 'Obfuscating <(_target_name)', |
| 1049 | 'variables': { |
| 1050 | 'additional_obfuscate_options': [], |
| 1051 | 'additional_obfuscate_input_paths': [], |
| 1052 | 'proguard_out_dir': '<(intermediate_dir)/proguard', |
| 1053 | 'proguard_input_jar_paths': [ |
| 1054 | '>@(input_jars_paths)', |
| 1055 | '<(jar_path)', |
| 1056 | ], |
| 1057 | 'target_conditions': [ |
| 1058 | ['is_test_apk == 1', { |
| 1059 | 'additional_obfuscate_options': [ |
| 1060 | '--testapp', |
| 1061 | ], |
| 1062 | }], |
| 1063 | ['is_test_apk == 1 and tested_apk_obfuscated_jar_path != "/"', { |
| 1064 | 'additional_obfuscate_options': [ |
| 1065 | '--tested-apk-obfuscated-jar-path', '>(tested_apk_obfuscated_jar_path)', |
| 1066 | ], |
| 1067 | 'additional_obfuscate_input_paths': [ |
| 1068 | '>(tested_apk_obfuscated_jar_path).info', |
| 1069 | ], |
| 1070 | }], |
| 1071 | ['proguard_enabled == "true"', { |
| 1072 | 'additional_obfuscate_options': [ |
| 1073 | '--proguard-enabled', |
| 1074 | ], |
| 1075 | }], |
| 1076 | ['debug_build_proguard_enabled == "true"', { |
| 1077 | 'additional_obfuscate_options': [ |
| 1078 | '--debug-build-proguard-enabled', |
| 1079 | ], |
| 1080 | }], |
| 1081 | ], |
| 1082 | 'obfuscate_input_jars_paths': [ |
| 1083 | '>@(input_jars_paths)', |
| 1084 | '<(jar_path)', |
| 1085 | ], |
| 1086 | }, |
| 1087 | 'conditions': [ |
| 1088 | ['is_test_apk == 1', { |
| 1089 | 'outputs': [ |
| 1090 | '<(test_jar_path)', |
| 1091 | ], |
| 1092 | }], |
| 1093 | ['enable_multidex == 1', { |
| 1094 | 'inputs': [ |
| 1095 | '<(main_dex_list_path)', |
| 1096 | '<(multidex_configuration_path)', |
| 1097 | ], |
| 1098 | 'variables': { |
| 1099 | 'additional_obfuscate_options': [ |
| 1100 | '--main-dex-list-path', '<(main_dex_list_path)', |
| 1101 | '--multidex-configuration-path', '<(multidex_configuration_path)', |
| 1102 | ], |
| 1103 | }, |
| 1104 | }], |
| 1105 | ], |
| 1106 | 'inputs': [ |
| 1107 | '<(DEPTH)/build/android/gyp/apk_obfuscate.py', |
| 1108 | '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 1109 | '>@(proguard_flags_paths)', |
| 1110 | '>@(obfuscate_input_jars_paths)', |
| 1111 | '>@(additional_obfuscate_input_paths)', |
| 1112 | '<(emma_instr_stamp)', |
| 1113 | ], |
| 1114 | 'outputs': [ |
| 1115 | '<(obfuscate_stamp)', |
| 1116 | |
| 1117 | # In non-Release builds, these paths will all be empty files. |
| 1118 | '<(obfuscated_jar_path)', |
| 1119 | '<(obfuscated_jar_path).info', |
| 1120 | '<(obfuscated_jar_path).dump', |
| 1121 | '<(obfuscated_jar_path).seeds', |
| 1122 | '<(obfuscated_jar_path).mapping', |
| 1123 | '<(obfuscated_jar_path).usage', |
| 1124 | ], |
| 1125 | 'action': [ |
| 1126 | 'python', '<(DEPTH)/build/android/gyp/apk_obfuscate.py', |
| 1127 | |
| 1128 | '--configuration-name', '<(CONFIGURATION_NAME)', |
| 1129 | |
| 1130 | '--android-sdk', '<(android_sdk)', |
| 1131 | '--android-sdk-tools', '<(android_sdk_tools)', |
| 1132 | '--android-sdk-jar', '<(android_sdk_jar)', |
| 1133 | |
| 1134 | '--input-jars-paths=>(proguard_input_jar_paths)', |
| 1135 | '--proguard-configs=>(proguard_flags_paths)', |
| 1136 | |
| 1137 | '--test-jar-path', '<(test_jar_path)', |
| 1138 | '--obfuscated-jar-path', '<(obfuscated_jar_path)', |
| 1139 | |
| 1140 | '--proguard-jar-path', '<(DEPTH)/third_party/proguard/lib/proguard.jar', |
| 1141 | |
| 1142 | '--stamp', '<(obfuscate_stamp)', |
| 1143 | |
| 1144 | '>@(additional_obfuscate_options)', |
| 1145 | ], |
| 1146 | }, |
| 1147 | { |
| 1148 | 'action_name': 'dex_<(_target_name)', |
| 1149 | 'variables': { |
| 1150 | 'dex_additional_options': [], |
| 1151 | 'dex_input_paths': [ |
| 1152 | '<(jar_path)', |
| 1153 | ], |
| 1154 | 'output_path': '<(dex_path)', |
| 1155 | 'proguard_enabled_input_path': '<(obfuscated_jar_path)', |
| 1156 | }, |
| 1157 | 'conditions': [ |
| 1158 | ['enable_multidex == 1', { |
| 1159 | 'inputs': [ |
| 1160 | '<(main_dex_list_path)', |
| 1161 | '<(multidex_configuration_path)', |
| 1162 | ], |
| 1163 | 'variables': { |
| 1164 | 'dex_additional_options': [ |
| 1165 | '--main-dex-list-path', '<(main_dex_list_path)', |
| 1166 | '--multidex-configuration-path', '<(multidex_configuration_path)', |
| 1167 | ], |
| 1168 | }, |
| 1169 | }], |
| 1170 | ], |
| 1171 | 'target_conditions': [ |
| 1172 | ['enable_multidex == 1 or tested_apk_is_multidex == 1', { |
| 1173 | 'variables': { |
| 1174 | 'dex_input_paths': [ |
| 1175 | '>@(input_jars_paths)', |
| 1176 | ], |
| 1177 | }, |
| 1178 | }, { |
| 1179 | 'variables': { |
| 1180 | 'dex_input_paths': [ |
| 1181 | '>@(library_dexed_jars_paths)', |
| 1182 | ], |
| 1183 | }, |
| 1184 | }], |
| 1185 | ['emma_instrument != 0', { |
| 1186 | 'variables': { |
| 1187 | 'dex_no_locals': 1, |
| 1188 | 'dex_input_paths': [ |
| 1189 | '<(emma_device_jar)' |
| 1190 | ], |
| 1191 | }, |
| 1192 | }], |
| 1193 | ['is_test_apk == 1 and tested_apk_dex_path != "/"', { |
| 1194 | 'variables': { |
| 1195 | 'dex_additional_options': [ |
| 1196 | '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)' |
| 1197 | ], |
| 1198 | }, |
| 1199 | 'inputs': [ |
| 1200 | '>(tested_apk_dex_path).inputs', |
| 1201 | ], |
| 1202 | }], |
| 1203 | ['proguard_enabled == "true" or debug_build_proguard_enabled == "true"', { |
| 1204 | 'inputs': [ '<(obfuscate_stamp)' ] |
| 1205 | }, { |
| 1206 | 'inputs': [ '<(emma_instr_stamp)' ] |
| 1207 | }], |
| 1208 | ], |
| 1209 | 'includes': [ 'android/dex_action.gypi' ], |
| 1210 | }, |
| 1211 | { |
| 1212 | 'variables': { |
| 1213 | 'local_dependencies_res_zip_paths': ['>@(dependencies_res_zip_paths)'], |
| 1214 | 'extra_inputs': ['<(codegen_stamp)'], |
| 1215 | 'resource_zips': [ |
| 1216 | '<(resource_zip_path)', |
| 1217 | ], |
| 1218 | 'conditions': [ |
| 1219 | ['dependencies_locale_zip_alternative_paths == []', { |
| 1220 | 'local_dependencies_res_zip_paths': ['>@(dependencies_locale_zip_paths)'], |
| 1221 | }, { |
| 1222 | 'local_dependencies_res_zip_paths': ['<@(dependencies_locale_zip_alternative_paths)'], |
| 1223 | }], |
| 1224 | ['is_test_apk == 0', { |
| 1225 | 'resource_zips': [ |
| 1226 | '>@(local_dependencies_res_zip_paths)', |
| 1227 | ], |
| 1228 | }], |
| 1229 | ], |
| 1230 | }, |
| 1231 | 'includes': [ 'android/package_resources_action.gypi' ], |
| 1232 | }, |
| 1233 | { |
| 1234 | 'variables': { |
| 1235 | 'apk_path': '<(unsigned_apk_path)', |
| 1236 | 'conditions': [ |
| 1237 | ['native_lib_target != ""', { |
| 1238 | 'extra_inputs': ['<(native_lib_placeholder_stamp)'], |
| 1239 | }], |
| 1240 | ['create_abi_split == 0', { |
| 1241 | 'native_libs_dir': '<(apk_package_native_libs_dir)', |
| 1242 | }, { |
| 1243 | 'native_libs_dir': '<(DEPTH)/build/android/ant/empty/res', |
| 1244 | }], |
| 1245 | ], |
| 1246 | }, |
| 1247 | 'includes': ['android/apkbuilder_action.gypi'], |
| 1248 | }, |
| 1249 | ], |
| 1250 | } |