| Index: build/config/android/rules.gni
|
| diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
|
| index 95b1f92c5016f51cce1996b1a5a4183454a657d5..340f8fddc099bb4a8c119d917af37c43d3bc2131 100644
|
| --- a/build/config/android/rules.gni
|
| +++ b/build/config/android/rules.gni
|
| @@ -607,6 +607,69 @@
|
| }
|
| }
|
|
|
| + # Creates a resources.zip with locale.pak files placed into appropriate
|
| + # resource configs (e.g. en-GB.pak -> res/raw-en/en_gb.pak). Also generates
|
| + # a locale_paks TypedArray so that resource files can be enumerated at runtime.
|
| + #
|
| + # If this target is included in the deps of an android resources/library/apk,
|
| + # the resources will be included with that target.
|
| + #
|
| + # Variables:
|
| + # sources: List of .pak files. Names must be of the form "en.pak" or
|
| + # "en-US.pak".
|
| + # deps: (optional) List of dependencies that might be needed to generate
|
| + # the .pak files.
|
| + #
|
| + # Example
|
| + # locale_pak_resources("locale_paks") {
|
| + # sources = [ "path/en-US.pak", "path/fr.pak", ... ]
|
| + # }
|
| + template("locale_pak_resources") {
|
| + set_sources_assignment_filter([])
|
| + assert(defined(invoker.sources))
|
| +
|
| + _base_path = "$target_gen_dir/$target_name"
|
| + _resources_zip = _base_path + ".resources.zip"
|
| + _build_config = _base_path + ".build_config"
|
| +
|
| + write_build_config("${target_name}__build_config") {
|
| + build_config = _build_config
|
| + resources_zip = _resources_zip
|
| + type = "android_resources"
|
| + is_locale_resource = true
|
| + }
|
| +
|
| + action("${target_name}__create_resources_zip") {
|
| + forward_variables_from(invoker,
|
| + [
|
| + "deps",
|
| + "sources",
|
| + ])
|
| + script = "//build/android/gyp/locale_pak_resources.py"
|
| + depfile = "$target_gen_dir/$target_name.d"
|
| +
|
| + outputs = [
|
| + _resources_zip,
|
| + ]
|
| +
|
| + _rebased_sources = rebase_path(sources, root_build_dir)
|
| + args = [
|
| + "--locale-paks=${_rebased_sources}",
|
| + "--resources-zip",
|
| + rebase_path(_resources_zip, root_build_dir),
|
| + "--depfile",
|
| + rebase_path(depfile, root_build_dir),
|
| + ]
|
| + }
|
| +
|
| + group(target_name) {
|
| + public_deps = [
|
| + ":${target_name}__build_config",
|
| + ":${target_name}__create_resources_zip",
|
| + ]
|
| + }
|
| + }
|
| +
|
| # Declare an Android resources target
|
| #
|
| # This creates a resources zip file that will be used when building an Android
|
| @@ -1143,65 +1206,6 @@
|
| set_sources_assignment_filter([])
|
| java_library_impl(target_name) {
|
| forward_variables_from(invoker, "*")
|
| - }
|
| - }
|
| -
|
| - # Creates android assets for locale pak files and a srcjar with a java class
|
| - # containing the pak file paths so that they can be extracted as necessary.
|
| - #
|
| - # Variables:
|
| - # sources: List of .pak files. Names must be of the form "en.pak" or
|
| - # "en-US.pak".
|
| - #
|
| - # Example
|
| - # locale_pak_assets("chrome_locale_pak") {
|
| - # sources = [ "path/en-US.pak", "path/fr.pak", ... ]
|
| - # }
|
| - #
|
| - # android_assets("chrome_public_apk_assets") {
|
| - # deps = [ "chrome_locale_pak_assets" ]
|
| - # }
|
| - #
|
| - # chrome_public_apk_tmpl(target_name) {
|
| - # srcjar_deps = [ "chrome_locale_pak_srcjar" ]
|
| - # }
|
| - template("locale_pak_assets") {
|
| - set_sources_assignment_filter([])
|
| -
|
| - action("${target_name}_srcjar") {
|
| - _output_path = "$target_gen_dir/$target_name.srcjar"
|
| - _target = get_label_info(":$target_name", "label_no_toolchain")
|
| -
|
| - forward_variables_from(invoker,
|
| - [
|
| - "deps",
|
| - "sources",
|
| - ])
|
| - script = "//build/android/gyp/locale_pak_assets.py"
|
| - depfile = "$target_gen_dir/$target_name.d"
|
| - _rebased_sources = rebase_path(sources, root_build_dir)
|
| -
|
| - outputs = [
|
| - _output_path,
|
| - ]
|
| -
|
| - args = [
|
| - "--locale-paks=${_rebased_sources}",
|
| - "--srcjar",
|
| - rebase_path(_output_path, root_build_dir),
|
| - "--depfile",
|
| - rebase_path(depfile, root_build_dir),
|
| - "--target",
|
| - _target,
|
| - ]
|
| - }
|
| -
|
| - android_assets("${target_name}_assets") {
|
| - forward_variables_from(invoker,
|
| - [
|
| - "sources",
|
| - "disable_compression",
|
| - ])
|
| }
|
| }
|
|
|
| @@ -1433,6 +1437,8 @@
|
| # testonly: Marks this target as "test-only".
|
| # write_asset_list: Adds an extra file to the assets, which contains a list of
|
| # all other asset files.
|
| + # alternative_locale_resource_dep: The locale resource target which overrides
|
| + # any exsting locale resources in dep graph.
|
| # requires_sdk_api_level_23: If defined and true, the apk is intended for
|
| # installation only on Android M or later. In these releases the system
|
| # linker does relocation unpacking, so we can enable it unconditionally.
|
| @@ -1665,6 +1671,11 @@
|
| possible_config_deps = invoker.deps
|
| }
|
|
|
| + if (defined(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) {
|
| possible_config_deps += [ "//third_party/android_tools:emma_device" ]
|
| @@ -1714,6 +1725,9 @@
|
| deps = _android_manifest_deps + [ ":$build_config_target" ]
|
| if (defined(invoker.deps)) {
|
| deps += invoker.deps
|
| + }
|
| + if (defined(invoker.alternative_locale_resource_dep)) {
|
| + deps += [ invoker.alternative_locale_resource_dep ]
|
| }
|
| }
|
| _srcjar_deps += [ ":$process_resources_target" ]
|
|
|