summaryrefslogtreecommitdiff
path: root/chrome/chrome_repack_locales.gni
diff options
context:
space:
mode:
authorPrimiano Tucci <primiano@google.com>2014-09-30 14:45:55 +0100
committerPrimiano Tucci <primiano@google.com>2014-09-30 14:45:55 +0100
commit1320f92c476a1ad9d19dba2a48c72b75566198e9 (patch)
treeea7f149ccad687b22c18a72b729646568b2d54fb /chrome/chrome_repack_locales.gni
parent39b78c562f50ad7d5551ee861121f899239525a2 (diff)
downloadchromium_org-1320f92c476a1ad9d19dba2a48c72b75566198e9.tar.gz
Merge from Chromium at DEPS revision 267aeeb8d85c
This commit was generated by merge_to_master.py. Change-Id: Id3aac9713b301fae64408cdaee0888724eeb7c0e
Diffstat (limited to 'chrome/chrome_repack_locales.gni')
-rw-r--r--chrome/chrome_repack_locales.gni174
1 files changed, 174 insertions, 0 deletions
diff --git a/chrome/chrome_repack_locales.gni b/chrome/chrome_repack_locales.gni
new file mode 100644
index 0000000000..cc3f5b9478
--- /dev/null
+++ b/chrome/chrome_repack_locales.gni
@@ -0,0 +1,174 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/features.gni")
+import("//build/config/ui.gni")
+import("//tools/grit/repack.gni")
+
+# Arguments:
+#
+# locale
+# Internal name of locale. e.g. "pt-BR"
+#
+# output
+# Output file name.
+#
+# visibility
+# Normal meaning.
+template("_repack_one_locale") {
+ locale = invoker.locale
+
+ repack(target_name) {
+ visibility = invoker.visibility
+
+ # Each input pak file should also have a deps line for completeness.
+ sources = [
+ "${root_gen_dir}/chrome/app/resources/platform_locale_settings_${locale}.pak",
+ "${root_gen_dir}/chrome/generated_resources_${locale}.pak",
+ "${root_gen_dir}/chrome/locale_settings_${locale}.pak",
+ "${root_gen_dir}/components/strings/components_strings_${locale}.pak",
+ ]
+ deps = [
+ "//chrome/app/resources:platform_locale_settings",
+ "//chrome/app:generated_resources",
+ "//chrome/app/resources:locale_settings",
+ "//components/strings",
+ ]
+
+ if (use_ash) {
+ sources += [
+ "${root_gen_dir}/ash/strings/ash_strings_${locale}.pak",
+ ]
+ deps += [
+ "//ash/strings",
+ ]
+ }
+ if (is_chromeos) {
+ sources += [
+ "${root_gen_dir}/ui/chromeos/strings/ui_chromeos_strings_${locale}.pak",
+ ]
+ deps += [
+ "//ui/chromeos/strings",
+ ]
+ }
+ if (!is_ios) {
+ sources += [
+ "${root_gen_dir}/content/app/strings/content_strings_${locale}.pak",
+ "${root_gen_dir}/ui/strings/ui_strings_${locale}.pak",
+ "${root_gen_dir}/ui/strings/app_locale_settings_${locale}.pak",
+ ]
+ deps += [
+ "//content/app/strings",
+ "//ui/strings:ui_strings",
+ "//ui/strings:app_locale_settings",
+ ]
+ }
+ if (enable_autofill_dialog && !is_ios && !is_android) {
+ sources += [
+ "${root_gen_dir}/third_party/libaddressinput/address_input_strings_${locale}.pak",
+ ]
+ deps += [
+ "//third_party/libaddressinput:strings",
+ ]
+ }
+ if (enable_extensions) {
+ sources += [
+ "${root_gen_dir}/device/bluetooth/device_bluetooth_strings_${locale}.pak",
+ # TODO(jamescook): When Android stops building extensions code move
+ # this to the OS != 'ios' and OS != 'android' section.
+ "${root_gen_dir}/extensions/strings/extensions_strings_${locale}.pak",
+ ]
+ deps += [
+ "//device/bluetooth:strings",
+ "//extensions/strings",
+ ]
+ }
+
+ if (is_chrome_branded) {
+ sources += [
+ "${root_gen_dir}/chrome/google_chrome_strings_${locale}.pak",
+ ]
+ deps += [
+ "//chrome/app:google_chrome_strings",
+ ]
+ } else {
+ sources += [
+ "${root_gen_dir}/chrome/chromium_strings_${locale}.pak",
+ ]
+ deps += [
+ "//chrome/app:chromium_strings",
+ ]
+ }
+
+ output = invoker.output
+ }
+}
+
+# Creates an action to call the repack_locales script.
+#
+# The GYP version generates the locales in the "gen" directory and then copies
+# it to the root build directory. This isn't easy to express in a GN copy
+# rule since the files on Mac have a complex structure. So we generate the
+# files into the final place and skip the "gen" directory.
+#
+# This template uses GN's looping constructs to avoid the complex call to
+# chrome/tools/build/repack_locales.py which wraps the repack commands in the
+# GYP build.
+#
+# Arguments
+#
+# input_locales
+# List of locale names to use as inputs.
+#
+# output_locales
+# A list containing the corresponding output names for each of the
+# input names. Mac uses different names in some cases.
+#
+# visibility
+template("chrome_repack_locales") {
+ # This is the name of the group below that will collect all the invidual
+ # locale targets. External targets will depend on this.
+ group_target_name = target_name
+
+ # GN's subscript is too stupid to do invoker.output_locales[foo] so we need
+ # to make a copy and do output_locales[foo].
+ output_locales = invoker.output_locales
+
+ # Collects all targets the loop generates.
+ locale_targets = []
+
+ # This loop iterates over the input locales and also keeps a counter so it
+ # can simultaneously iterate over the output locales (using GN's very
+ # limited looping capabilities).
+ current_index = 0
+ foreach(input_locale, invoker.input_locales) {
+ output_locale = output_locales[current_index]
+
+ # Compute the name of the target for the current file. Save it for the deps.
+ current_name = "${target_name}_${input_locale}"
+ locale_targets += [ ":$current_name" ]
+
+ _repack_one_locale(current_name) {
+ visibility = [ ":$group_target_name" ]
+ locale = input_locale
+
+ # Compute the output name. Mac uses a different location.
+ if (is_mac || is_ios) {
+ output = "${root_gen_dir}/repack/${output_locale}.lproj/locale.pak"
+ } else {
+ output = "${root_out_dir}/locales/${output_locale}.pak"
+ }
+ }
+
+ current_index = current_index + 1
+ }
+
+ # The group that external targets depend on which collects all deps.
+ group(group_target_name) {
+ if (defined(invoker.visibility)) {
+ visibility = invoker.visibility
+ }
+ deps = locale_targets
+ }
+}