123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- # 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.
- #
- # locale_list (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 (optional)
- # 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",
- rebase_path(i, root_build_dir),
- ]
- }
- }
- # 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.locale_list
- if (defined(invoker.deps)) {
- deps = invoker.deps
- } else {
- deps = []
- }
- # This script reads the messages strings from the generated resource files.
- deps += [ "//remoting/resources:strings" ]
- }
- }
|