| # Copyright 2019 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//base/android/linker/config.gni") |
| import("//build/config/android/config.gni") |
| import("//build/util/version.gni") |
| import("//chrome/android/modules/chrome_feature_module_tmpl.gni") |
| |
| # Instantiates a Chrome-specific app bundle. |
| # |
| # Supports most variables of chrome_feature_module and android_app_bundle, plus: |
| # module_descs: List of descriptors for modules that are part of this bundle. |
| # See //chrome/android/modules/chrome_feature_modules.gni for the format of |
| # a module descriptor. |
| # is_64_bit_browser: (Optional) Whether Chrome (as opposed to WebView) runs in |
| # 64 bit. |
| # include_32_bit_webview: (Optional) Whether to include 32 bit code for |
| # WebView. |
| template("chrome_bundle") { |
| _bundle_target_name = target_name |
| _package_id = 126 # == 0x7e. |
| _extra_modules = [] |
| foreach(_module_desc, invoker.module_descs) { |
| assert(_package_id > 2, "Too many modules, ran out of package IDs!") |
| chrome_feature_module( |
| "${_bundle_target_name}__${_module_desc.name}_bundle_module") { |
| forward_variables_from(invoker, |
| [ |
| "base_module_target", |
| "is_64_bit_browser", |
| "is_monochrome_or_trichrome", |
| "manifest_package", |
| "min_sdk_version", |
| "version_code", |
| ]) |
| module_desc = _module_desc |
| version_name = chrome_version_name |
| uncompress_shared_libraries = |
| invoker.is_monochrome_or_trichrome || chromium_linker_supported |
| |
| # Each module needs a unique resource package ID so that we don't have ID |
| # collisions between feature modules. |
| package_id = _package_id |
| } |
| _module_desc.module_target = |
| ":${_bundle_target_name}__${_module_desc.name}_bundle_module" |
| _extra_modules += [ _module_desc ] |
| _package_id -= 1 |
| } |
| |
| # Determine whether the bundle has native libraries for both the primary and |
| # the secondary ABI. This is the case if we package WebView with the |
| # complementary ABI of the browser. |
| _is_64_bit_browser = |
| defined(invoker.is_64_bit_browser) && invoker.is_64_bit_browser |
| _include_32_bit_webview = |
| defined(invoker.include_32_bit_webview) && invoker.include_32_bit_webview |
| _is_multi_abi = false |
| if (_is_64_bit_browser) { |
| _is_multi_abi = _include_32_bit_webview |
| } else { |
| assert(!_include_32_bit_webview) |
| |
| # WebView is included with 64bit ABI if |android_64bit_target_cpu| is true. |
| _is_multi_abi = android_64bit_target_cpu |
| } |
| |
| android_app_bundle(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "base_module_target", |
| "bundle_name", |
| "compress_shared_libraries", |
| "failed_proguard_expectation_file", |
| "keystore_name", |
| "keystore_password", |
| "keystore_path", |
| "min_sdk_version", |
| "proguard_android_sdk_dep", |
| "proguard_jar_path", |
| "sign_bundle", |
| "static_library_proguard_disabled", |
| "static_library_provider", |
| "verify_proguard_flags", |
| ]) |
| command_line_flags_file = "chrome-command-line" |
| proguard_enabled = !is_java_debug |
| enable_language_splits = true |
| extra_modules = _extra_modules |
| system_image_locale_whitelist = android_non_bundle_locales |
| is_multi_abi = _is_multi_abi |
| |
| # NOTE: Only sign bundle for official builds since this is very slow. |
| if (enable_chrome_android_internal && use_signing_keys && |
| is_official_build) { |
| sign_bundle = true |
| keystore_path = chrome_keystore_path |
| keystore_name = chrome_keystore_name |
| keystore_password = chrome_keystore_password |
| } |
| } |
| } |