Index: build/config/android/rules.gni |
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
index a0913a5261c9997c891435d68d2ba8d21bf0f915..4b851beebbda8ef03e0772f5bb313b1bdcbd2665 100644 |
--- a/build/config/android/rules.gni |
+++ b/build/config/android/rules.gni |
@@ -710,6 +710,7 @@ if (enable_java_templates) { |
# is specified. |
# android_manifest: AndroidManifest.xml for this target. Defaults to |
# //build/android/AndroidManifest.xml. |
+ # android_manifest_dep: Target that generates AndroidManifest (if applicable) |
# custom_package: java package for generated .java files. |
# v14_skip: If true, don't run v14 resource generator on this. Defaults to |
# false. (see build/android/gyp/generate_v14_compatible_resources.py) |
@@ -746,14 +747,23 @@ if (enable_java_templates) { |
final_target_name = target_name |
write_build_config(build_config_target_name) { |
+ type = "android_resources" |
forward_variables_from(invoker, |
[ |
"android_manifest", |
"custom_package", |
- "deps", |
"resource_dirs", |
]) |
+ if (defined(invoker.deps)) { |
+ possible_config_deps = invoker.deps |
+ } |
+ if (defined(invoker.android_manifest_dep)) { |
+ deps = [ |
+ invoker.android_manifest_dep, |
+ ] |
+ } |
+ |
# No package means resources override their deps. |
if (defined(custom_package) || defined(android_manifest)) { |
r_text = r_text_path |
@@ -761,15 +771,12 @@ if (enable_java_templates) { |
assert(defined(invoker.deps), |
"Must specify deps when custom_package is omitted.") |
} |
- visibility = [ ":$process_resources_target_name" ] |
- type = "android_resources" |
resources_zip = zip_path |
srcjar = srcjar_path |
} |
process_resources(process_resources_target_name) { |
- visibility = [ ":$final_target_name" ] |
forward_variables_from(invoker, |
[ |
"app_as_shared_lib", |
@@ -786,6 +793,9 @@ if (enable_java_templates) { |
deps = [] |
} |
deps += [ ":$build_config_target_name" ] |
+ if (defined(invoker.android_manifest_dep)) { |
+ deps += [ invoker.android_manifest_dep ] |
+ } |
# Always generate R.onResourcesLoaded() method, it is required for |
# compiling ResourceRewriter, there is no side effect because the |
@@ -849,13 +859,15 @@ if (enable_java_templates) { |
_build_config_target_name = "${target_name}__build_config" |
write_build_config(_build_config_target_name) { |
- forward_variables_from(invoker, |
- [ |
- "deps", |
- "disable_compression", |
- ]) |
type = "android_assets" |
build_config = _build_config |
+ |
+ forward_variables_from(invoker, [ "disable_compression" ]) |
+ |
+ if (defined(invoker.deps)) { |
+ possible_config_deps = invoker.deps |
+ } |
+ |
if (defined(invoker.sources)) { |
asset_sources = invoker.sources |
} |
@@ -878,7 +890,11 @@ if (enable_java_templates) { |
} |
group(target_name) { |
- forward_variables_from(invoker, [ "visibility" ]) |
+ forward_variables_from(invoker, |
+ [ |
+ "deps", |
+ "visibility", |
+ ]) |
public_deps = [ |
":$_build_config_target_name", |
] |
@@ -895,13 +911,18 @@ if (enable_java_templates) { |
# } |
template("java_group") { |
write_build_config("${target_name}__build_config") { |
- forward_variables_from(invoker, [ "deps" ]) |
type = "group" |
build_config = "$target_gen_dir/${invoker.target_name}.build_config" |
+ |
+ if (defined(invoker.deps)) { |
+ possible_config_deps = invoker.deps |
+ } |
} |
group(target_name) { |
- deps = [] |
forward_variables_from(invoker, "*") |
+ if (!defined(deps)) { |
+ deps = [] |
+ } |
deps += [ ":${target_name}__build_config" ] |
} |
} |
@@ -929,7 +950,6 @@ if (enable_java_templates) { |
build_config = base_path + ".build_config" |
write_build_config("${target_name}__build_config") { |
- forward_variables_from(invoker, [ "deps" ]) |
type = "android_resources" |
} |
@@ -939,6 +959,7 @@ if (enable_java_templates) { |
grit_target_name = "${target_name}__grit" |
grit_output_dir = "$target_gen_dir/$extra_output_path" |
grit(grit_target_name) { |
+ forward_variables_from(invoker, [ "deps" ]) |
grit_flags = [ |
"-E", |
"ANDROID_JAVA_TAGGED_ONLY=false", |
@@ -999,7 +1020,6 @@ if (enable_java_templates) { |
final_target_name = target_name |
write_build_config(build_config_target_name) { |
- visibility = [ ":$zip_target_name" ] |
type = "android_resources" |
} |
@@ -1610,18 +1630,19 @@ if (enable_java_templates) { |
android_manifest = _android_manifest |
deps = _android_manifest_deps |
+ |
if (defined(invoker.deps)) { |
- deps += invoker.deps |
+ possible_config_deps = invoker.deps |
} |
if (defined(invoker.alternative_locale_resource_dep)) { |
- deps += [ invoker.alternative_locale_resource_dep ] |
+ possible_config_deps += [ invoker.alternative_locale_resource_dep ] |
has_alternative_locale_resource = true |
} |
# Added emma to the target's classpath via its .build_config. |
if (emma_coverage && !_emma_never_instrument) { |
- deps += [ "//third_party/android_tools:emma_device" ] |
+ possible_config_deps += [ "//third_party/android_tools:emma_device" ] |
} |
proguard_enabled = _proguard_enabled |
@@ -2327,8 +2348,8 @@ if (enable_java_templates) { |
forward_variables_from(invoker, "*") |
testonly = true |
- assert(!defined(invoker.proguard_enabled) || !invoker.proguard_enabled |
- || invoker.proguard_configs != []) |
+ assert(!defined(invoker.proguard_enabled) || !invoker.proguard_enabled || |
+ invoker.proguard_configs != []) |
if (!defined(apk_name)) { |
apk_name = get_label_info(invoker.shared_library, "name") |