Index: build/config/android/rules.gni |
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
index 01202c944b6fd3408848051080dd386018ad1a72..6c7fef3bbeea49f76870b947f1fcc4a7cf0b35df 100644 |
--- a/build/config/android/rules.gni |
+++ b/build/config/android/rules.gni |
@@ -1352,7 +1352,8 @@ template("android_apk") { |
} |
assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) |
- assert(defined(invoker.android_manifest)) |
+ assert(defined(invoker.android_manifest) || |
+ defined(invoker.android_manifest_dep)) |
gen_dir = "$target_gen_dir/$target_name" |
base_path = "$gen_dir/$target_name" |
_build_config = "$target_gen_dir/$target_name.build_config" |
@@ -1454,7 +1455,25 @@ template("android_apk") { |
} |
} |
- _android_manifest = invoker.android_manifest |
+ # The manifest can be passed as a file (through android_manifest), or as a |
+ # rule that generates a manifest (through android_manifest_dep). |
+ # When it is a rule, we need to make sure to include the rule as a dep to each |
+ # target that uses the manifest as an input. |
+ _android_manifest_deps = [] |
+ if (defined(invoker.android_manifest_dep)) { |
+ _android_manifest_deps = [ invoker.android_manifest_dep ] |
+ } |
+ if (defined(invoker.android_manifest)) { |
+ _android_manifest = invoker.android_manifest |
+ } else { |
+ _manifest_out_files = get_target_outputs(_android_manifest_deps[0]) |
+ |
+ # Use the last output, since depfile outputs always need to come first. |
cjhopman
2015/06/26 22:38:48
This is strange and makes hard to find assumptions
|
+ foreach(_file, _manifest_out_files) { |
+ _android_manifest = _file |
+ } |
+ } |
+ |
_rebased_build_config = rebase_path(_build_config, root_build_dir) |
_create_abi_split = |
defined(invoker.create_abi_split) && invoker.create_abi_split |
@@ -1472,7 +1491,7 @@ template("android_apk") { |
build_config = _build_config |
android_manifest = _android_manifest |
- deps = _chromium_linker_dep |
+ deps = _chromium_linker_dep + _android_manifest_deps |
if (defined(invoker.deps)) { |
deps += invoker.deps |
} |
@@ -1502,9 +1521,7 @@ template("android_apk") { |
} |
build_config = _build_config |
- deps = [ |
- ":$build_config_target", |
- ] |
+ deps = _android_manifest_deps + [ ":$build_config_target" ] |
if (defined(invoker.deps)) { |
deps += invoker.deps |
} |
@@ -1553,9 +1570,7 @@ template("android_apk") { |
supports_android = true |
requires_android = true |
override_build_config = _build_config |
- deps = [ |
- ":$build_config_target", |
- ] |
+ deps = _android_manifest_deps + [ ":$build_config_target" ] |
android_manifest = _android_manifest |
chromium_code = true |
@@ -1712,10 +1727,10 @@ template("android_apk") { |
keystore_password = _keystore_password |
# This target generates the input file _all_resources_zip_path. |
- deps = [ |
- ":$process_resources_target", |
- ":$final_dex_target_name", |
- ] |
+ deps = _android_manifest_deps + [ |
+ ":$process_resources_target", |
+ ":$final_dex_target_name", |
+ ] |
if (defined(invoker.deps)) { |
deps += invoker.deps |
} |
@@ -1744,6 +1759,7 @@ template("android_apk") { |
out_manifest = |
"$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" |
split_name = "abi_${android_app_abi}" |
+ deps = _android_manifest_deps |
} |
_apk_rule = "${_template_name}__split_apk_abi_${android_app_abi}" |
@@ -1769,6 +1785,7 @@ template("android_apk") { |
native_libs_dir = _native_libs_dir |
deps = [ |
":${_template_name}__prepare_native", |
+ ":${_manifest_rule}", |
] |
} |
} |