Commit 028b3b68 authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

[aab] Add build_config for Android App Bundles

Also, add android_app_bundle_module type to build config.

Bug: 862696
Change-Id: Ic893f47d44d8dd98ff7e70d3a8e09cbf2ce5a444
Reviewed-on: https://chromium-review.googlesource.com/1135834
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avataragrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577305}
parent ed3020b1
This diff is collapsed.
......@@ -13,7 +13,8 @@ import("//build/config/sanitizers/sanitizers.gni")
assert(is_android)
# These identify targets that have .build_config files (except for android_apk,
# java_binary, resource_rewriter, since we never need to depend on these).
# java_binary, resource_rewriter, android_app_bundle since we never need to
# depend on these).
_java_target_whitelist = [
"*:*_java",
"*:*_javalib",
......@@ -30,6 +31,7 @@ _java_target_whitelist = [
"*:*_resources",
"*:*_grd",
"*:*locale_paks",
"*_module",
# TODO(agrieve): Rename targets below to match above patterns.
"*android_webview/glue:glue",
......@@ -67,7 +69,8 @@ template("write_build_config") {
# consider them in dependency chains.
if (_type != "android_apk" && _type != "java_binary" &&
_type != "resource_rewriter" && _type != "dist_jar" &&
_type != "java_annotation_processor" && _type != "dist_aar") {
_type != "java_annotation_processor" && _type != "dist_aar" &&
_type != "android_app_bundle") {
set_sources_assignment_filter(_java_target_whitelist)
_parent_invoker = invoker.invoker
_target_label =
......@@ -934,7 +937,7 @@ if (enable_java_templates) {
"--output-path",
rebase_path(_output_jar_path, root_build_dir),
"--classpath",
"@FileArg($_rebased_build_config:android:sdk_jars)",
"@FileArg($_rebased_build_config:deps_info:proguard_classpath_jars)",
]
if (proguard_verbose) {
args += [ "--verbose" ]
......@@ -2952,25 +2955,32 @@ if (enable_java_templates) {
"secondary_abi_loadable_modules",
"type",
])
if (type == "android_apk") {
if (type == "android_apk" || type == "android_app_bundle_module") {
forward_variables_from(
invoker,
[
"android_manifest",
"android_manifest_dep",
"apk_path",
"apk_under_test",
"extra_shared_libraries",
"final_dex_path",
"incremental_allowed",
"incremental_apk_path",
"incremental_install_json_path",
"proto_resources_path",
"secondary_abi_shared_libraries_runtime_deps_file",
"shared_libraries_runtime_deps_file",
"uncompress_shared_libraries",
])
}
if (type == "android_apk") {
forward_variables_from(invoker,
[
"apk_path",
"apk_under_test",
"incremental_allowed",
"incremental_apk_path",
"incremental_install_json_path",
])
}
if (type == "android_app_bundle_module") {
forward_variables_from(invoker, [ "proto_resources_path" ])
}
build_config = _build_config
is_prebuilt = _is_prebuilt
possible_config_deps = _accumulated_deps
......@@ -3068,7 +3078,8 @@ if (enable_java_templates) {
}
if (_lint_enabled) {
android_lint("${_main_target_name}__lint") {
if (invoker.type == "android_apk") {
if (invoker.type == "android_apk" ||
invoker.type == "android_app_bundle_module") {
forward_variables_from(invoker, [ "android_manifest" ])
} else if (defined(_android_manifest_for_lint)) {
android_manifest = _android_manifest_for_lint
......
......@@ -1527,7 +1527,6 @@ if (enable_java_templates) {
args = [
"--proguard-configs=@FileArg($_rebased_build_config:deps_info:proguard_all_configs)",
"--input-paths=@FileArg($_rebased_build_config:deps_info:java_runtime_classpath)",
"--classpath=@FileArg($_rebased_build_config:deps_info:proguard_all_extra_jars)",
]
if (defined(invoker.proguard_config_exclusions)) {
_rebased_proguard_config_exclusions =
......@@ -2317,7 +2316,11 @@ if (enable_java_templates) {
"secondary_abi_loadable_modules",
"uncompress_shared_libraries",
])
type = "android_apk"
if (_is_bundle_module) {
type = "android_app_bundle_module"
} else {
type = "android_apk"
}
main_target_name = _template_name
supports_android = true
requires_android = true
......@@ -2327,15 +2330,17 @@ if (enable_java_templates) {
final_jar_path = _jar_path
dex_path = _lib_dex_path
final_dex_path = _final_dex_path
apk_path = _final_apk_path
if (_is_bundle_module) {
proto_resources_path = _packaged_resources_path
}
incremental_allowed = _incremental_allowed
incremental_apk_path = "${_final_apk_path_no_ext}_incremental.apk"
incremental_install_json_path = _incremental_install_json_path
if (!_is_bundle_module) {
apk_path = _final_apk_path
incremental_allowed = _incremental_allowed
incremental_apk_path = "${_final_apk_path_no_ext}_incremental.apk"
incremental_install_json_path = _incremental_install_json_path
}
proguard_enabled = _proguard_enabled
if (_proguard_enabled) {
......@@ -2401,7 +2406,6 @@ if (enable_java_templates) {
args = [
"--proguard-configs=@FileArg($_rebased_build_config:deps_info:proguard_all_configs)",
"--input-paths=@FileArg($_rebased_build_config:deps_info:java_runtime_classpath)",
"--classpath=@FileArg($_rebased_build_config:deps_info:proguard_all_extra_jars)",
]
if (defined(invoker.proguard_config_exclusions)) {
_rebased_proguard_config_exclusions =
......@@ -3662,6 +3666,19 @@ if (enable_java_templates) {
_all_modules += invoker.extra_modules
}
# Make build config, which is required for synchronized proguarding.
_module_targets = []
foreach(_module, _all_modules) {
_module_targets += [ _module.module_target ]
}
_build_config = "$target_gen_dir/${target_name}.build_config"
_build_config_target = "${target_name}__build_config"
write_build_config(_build_config_target) {
type = "android_app_bundle"
possible_config_deps = _module_targets
build_config = _build_config
}
# Generate one module .zip file per APK.
_all_create_module_targets = []
_all_module_zip_paths = []
......@@ -3760,7 +3777,7 @@ if (enable_java_templates) {
outputs = [
_bundle_path,
]
deps = _all_create_module_targets
deps = _all_create_module_targets + [ ":$_build_config_target" ]
args = [
"--out-bundle=$_rebased_bundle_path",
"--module-zips=$_all_rebased_module_zip_paths",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment