Chromium Code Reviews| Index: build/config/android/rules.gni |
| diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
| index 7bd22b43c34468cb834661a5a0b3f0812c6f46e5..0dbbc3c3fbed8e560f2b9aace7bb1e04ebf8f7f1 100644 |
| --- a/build/config/android/rules.gni |
| +++ b/build/config/android/rules.gni |
| @@ -680,6 +680,63 @@ template("android_resources") { |
| } |
| } |
| +# Declare an Android assets target. |
| +# |
| +# Defines a set of files to include as assets in a dependent apk. |
| +# |
| +# To include these assets in an apk, this target should be listed in |
| +# the apk's deps, or in the deps of a library target used by an apk. |
| +# |
| +# Variables |
| +# deps: Specifies the dependencies of this target. Any Android assets |
| +# listed in deps will be included by libraries/apks that depend on this |
| +# target. |
| +# sources: List of files to include as assets. |
| +# outputs: List of asset paths to use for the assets (similar to copy()). |
|
pkotwicz
2015/10/24 03:46:03
Can you remove the variable given that it is unuse
agrieve
2015/10/25 17:32:10
I'd like to keep it in to document how I'd like th
|
| +# enable_compression: Whether to enable compressed for files that are not |
|
pkotwicz
2015/10/23 23:17:22
Nit: compressed -> compression
pkotwicz
2015/10/24 03:46:03
I think that disable_compression is a better name
agrieve
2015/10/25 17:32:10
Done.
agrieve
2015/10/25 17:32:10
Done.
|
| +# already known to be non-compressable (default: true). |
| +# |
| +# Example: |
| +# android_assets("content_shell_assets") { |
| +# deps = [ |
| +# ":generates_foo", |
| +# ":other_assets", |
| +# ] |
| +# sources = [ |
| +# "$target_gen_dir/foo.dat", |
| +# ] |
| +# } |
| +template("android_assets") { |
| + set_sources_assignment_filter([]) |
| + forward_variables_from(invoker, [ "testonly" ]) |
| + |
| + assert(!defined(invoker.outputs), "TODO: Add support for output paths") |
| + |
| + _build_config = "$target_gen_dir/$target_name.build_config" |
| + _build_config_target_name = "${target_name}__build_config" |
| + |
| + write_build_config(_build_config_target_name) { |
| + forward_variables_from(invoker, |
| + [ |
| + "deps", |
| + "prefix_to_strip", |
|
pkotwicz
2015/10/24 03:46:03
I can't find a place where "prefix_to_strip" is us
agrieve
2015/10/25 17:32:10
Whoops, zapped.
|
| + "enable_compression", |
| + ]) |
| + type = "android_assets" |
| + build_config = _build_config |
| + assets = invoker.sources |
| + } |
| + |
| + group(target_name) { |
| + forward_variables_from(invoker, [ "visibility" ]) |
| + if (invoker.sources != []) { |
|
pkotwicz
2015/10/24 03:46:03
Should we assert that invoker.sources is non-empty
agrieve
2015/10/25 17:32:10
We'll have empty sources in the examples in the pa
|
| + public_deps = [ |
| + ":$_build_config_target_name", |
| + ] |
| + } |
| + } |
| +} |
| + |
| # Declare a target that generates localized strings.xml from a .grd file. |
| # |
| # If this target is included in the deps of an android resources/library/apk, |
| @@ -1520,6 +1577,7 @@ template("android_apk") { |
| ]) |
| apk_path = _final_apk_path |
| android_manifest = _android_manifest |
| + assets_build_config = _build_config |
| resources_zip = _all_resources_zip_path |
| dex_path = final_dex_path |
| load_library_from_apk = _load_library_from_apk |
| @@ -1540,11 +1598,14 @@ template("android_apk") { |
| keystore_password = _keystore_password |
| # Incremental apk does not use native libs nor final dex. |
| - incremental_deps = |
| - deps + _android_manifest_deps + [ ":$process_resources_target" ] |
| + incremental_deps = deps + _android_manifest_deps + [ |
| + ":$build_config_target", |
| + ":$process_resources_target", |
| + ] |
| # This target generates the input file _all_resources_zip_path. |
| deps += _android_manifest_deps + [ |
| + ":$build_config_target", |
| ":$process_resources_target", |
| ":$final_dex_target_name", |
| ] |