Index: remoting/tools/build/remoting_localize.gni |
diff --git a/remoting/tools/build/remoting_localize.gni b/remoting/tools/build/remoting_localize.gni |
new file mode 100644 |
index 0000000000000000000000000000000000000000..54ff46e27f829916e872dbd865f467d7ea1341a7 |
--- /dev/null |
+++ b/remoting/tools/build/remoting_localize.gni |
@@ -0,0 +1,113 @@ |
+# Copyright 2015 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. |
+ |
+# Calls the remoting_localize script with a jinja2 template. |
+# |
+# Arguments |
+# |
+# sources (required) |
+# List of jinja2 files to load. This is the template. |
+# |
+# locales (required) |
+# List of locales. |
+# |
+# locale_dir (optional) |
+# |
+# defines (optional) |
+# List of defines to pass to script. |
+# Example: defines = [ "FOO_HOST_PATH=bar" ] |
+# |
+# variables (optional) |
+# List of variables to pass to script. |
+# |
+# output (optiona) |
+# Substitution pattern for the output. Defaults to a file in the target |
+# gen dir with the extension stripped (normally the extension is ".jinja2" |
+# which then leaves the non-tempaltized file name). |
+# TODO(brettw) Need locale_output. This is a per-locale output file. |
+# |
+# encoding (optional) |
+# String. |
+# |
+# deps (optional) |
+# visibility (optional) |
+template("remoting_localize") { |
+ action_foreach(target_name) { |
+ if (defined(invoker.visibility)) { |
+ visibility = invoker.visibility |
+ } |
+ |
+ script = "//remoting/tools/build/remoting_localize.py" |
+ |
+ sources = invoker.sources |
+ |
+ if (defined(invoker.output)) { |
+ outputs = [ |
+ invoker.output, |
+ ] |
+ } else { |
+ outputs = [ |
+ "$target_gen_dir/{{source_name_part}}", |
+ ] |
+ } |
+ |
+ args = [] |
+ |
+ if (defined(invoker.locale_dir)) { |
+ args += [ |
+ "--locale_dir", |
+ rebase_path(invoker.locale_dir, root_build_dir), |
+ ] |
+ } |
+ |
+ # Add defines to command line. |
+ if (defined(invoker.defines)) { |
+ foreach(i, invoker.defines) { |
+ args += [ |
+ "--define", |
+ i, |
+ ] |
+ } |
+ } |
+ |
+ # Add variables to command line. |
+ if (defined(invoker.variables)) { |
+ foreach(i, invoker.variables) { |
+ args += [ |
+ "--variables", |
+ i, |
+ ] |
+ } |
+ } |
+ |
+ # The template file is required. |
+ args += [ |
+ "--template", |
+ "{{source}}", |
+ ] |
+ |
+ args += [ |
+ "--output", |
+ rebase_path(outputs[0], root_build_dir), |
+ ] |
+ |
+ if (defined(invoker.encoding)) { |
+ args += [ |
+ "--encoding", |
+ invoker.encoding, |
+ ] |
+ } |
+ |
+ args += invoker.locales |
+ |
+ if (defined(invoker.deps)) { |
+ deps = invoker.deps |
+ } else { |
+ deps = [] |
+ } |
+ |
+ # This script reads the messages strings from the generated resource files. |
+ deps += [ "//remoting/resources:strings" ] |
+ } |
+} |