Chromium Code Reviews| Index: build/config/android/rules.gni |
| diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
| index 340f8fddc099bb4a8c119d917af37c43d3bc2131..a2e4910e086d7bb838832e0b42ee2a19633236cf 100644 |
| --- a/build/config/android/rules.gni |
| +++ b/build/config/android/rules.gni |
| @@ -607,69 +607,6 @@ if (enable_java_templates) { |
| } |
| } |
| - # 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 |
| @@ -1209,6 +1146,77 @@ if (enable_java_templates) { |
| } |
| } |
| + # 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". |
| + # package_suffix: The package where the generated Java file should live. |
|
agrieve
2016/09/21 20:34:02
nit: this might be simpler as just "java_package"
estevenson
2016/09/21 22:35:18
Done.
|
| + # If not specified, "chrome" will be used, and the output Java file |
| + # will reside in org.chromium.chrome (optional). |
| + # |
| + # Example |
| + # locale_pak_assets("chrome_locale_pak") { |
| + # package_suffix = "android_webview" |
| + # sources = [ "path/en-US.pak", "path/fr.pak", ... ] |
| + # } |
| + # |
| + # android_assets("chrome_public_apk_assets") { |
| + # deps = [ "chrome_locale_pak_assets" ] |
| + # } |
| + # |
| + # library_where_we_want_to_use_generated_srcjar("lib") { |
| + # srcjar_deps = [ "chrome_locale_pak_srcjar" ] |
| + # } |
| + template("locale_pak_assets") { |
| + set_sources_assignment_filter([]) |
| + |
| + if (defined(invoker.package_suffix)) { |
| + package_suffix = invoker.package_suffix |
| + } else { |
| + package_suffix = "chrome" |
| + } |
| + |
| + 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, |
| + "--package-suffix", |
| + package_suffix, |
| + ] |
| + } |
| + |
| + android_assets("${target_name}_assets") { |
| + forward_variables_from(invoker, |
| + [ |
| + "sources", |
| + "disable_compression", |
| + ]) |
| + } |
| + } |
| + |
| # Declare a java library target for a prebuilt jar |
| # |
| # Variables |
| @@ -1437,8 +1445,6 @@ if (enable_java_templates) { |
| # 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. |
| @@ -1671,11 +1677,6 @@ if (enable_java_templates) { |
| 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" ] |
| @@ -1726,9 +1727,6 @@ if (enable_java_templates) { |
| 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" ] |