Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: build/config/android/rules.gni

Issue 1198193006: Revert "Revert "Android: Store language .pak files in res/raw rather than assets"" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/locale_pak_resources.gypi ('k') | chrome/android/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/android/rules.gni
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index 4c22fac76814df3c0aeaa14a54d096b755c238a2..57af185bf57bc78c2f06370682fa8b144f931c21 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -544,6 +544,69 @@ template("jinja_template_resources") {
}
}
+# 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"
+ }
+
+ action("${target_name}__create_resources_zip") {
+ sources = invoker.sources
+ script = "//build/android/gyp/locale_pak_resources.py"
+ depfile = "$target_gen_dir/$target_name.d"
+
+ outputs = [
+ depfile,
+ _resources_zip,
+ ]
+
+ _rebased_sources = rebase_path(invoker.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),
+ ]
+
+ if (defined(invoker.deps)) {
+ deps = invoker.deps
+ }
+ }
+
+ group(target_name) {
+ 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
« no previous file with comments | « build/android/locale_pak_resources.gypi ('k') | chrome/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698