OLD | NEW |
(Empty) | |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # Calls the remoting_localize script with a jinja2 template. |
| 6 # |
| 7 # Arguments |
| 8 # |
| 9 # sources (required) |
| 10 # List of jinja2 files to load. This is the template. |
| 11 # |
| 12 # locales (required) |
| 13 # List of locales. |
| 14 # |
| 15 # locale_dir (optional) |
| 16 # |
| 17 # defines (optional) |
| 18 # List of defines to pass to script. |
| 19 # Example: defines = [ "FOO_HOST_PATH=bar" ] |
| 20 # |
| 21 # variables (optional) |
| 22 # List of variables to pass to script. |
| 23 # |
| 24 # output (optiona) |
| 25 # Substitution pattern for the output. Defaults to a file in the target |
| 26 # gen dir with the extension stripped (normally the extension is ".jinja2" |
| 27 # which then leaves the non-tempaltized file name). |
| 28 # TODO(brettw) Need locale_output. This is a per-locale output file. |
| 29 # |
| 30 # encoding (optional) |
| 31 # String. |
| 32 # |
| 33 # deps (optional) |
| 34 # visibility (optional) |
| 35 template("remoting_localize") { |
| 36 action_foreach(target_name) { |
| 37 if (defined(invoker.visibility)) { |
| 38 visibility = invoker.visibility |
| 39 } |
| 40 |
| 41 script = "//remoting/tools/build/remoting_localize.py" |
| 42 |
| 43 sources = invoker.sources |
| 44 |
| 45 if (defined(invoker.output)) { |
| 46 outputs = [ |
| 47 invoker.output, |
| 48 ] |
| 49 } else { |
| 50 outputs = [ |
| 51 "$target_gen_dir/{{source_name_part}}", |
| 52 ] |
| 53 } |
| 54 |
| 55 args = [] |
| 56 |
| 57 if (defined(invoker.locale_dir)) { |
| 58 args += [ |
| 59 "--locale_dir", |
| 60 rebase_path(invoker.locale_dir, root_build_dir), |
| 61 ] |
| 62 } |
| 63 |
| 64 # Add defines to command line. |
| 65 if (defined(invoker.defines)) { |
| 66 foreach(i, invoker.defines) { |
| 67 args += [ |
| 68 "--define", |
| 69 i, |
| 70 ] |
| 71 } |
| 72 } |
| 73 |
| 74 # Add variables to command line. |
| 75 if (defined(invoker.variables)) { |
| 76 foreach(i, invoker.variables) { |
| 77 args += [ |
| 78 "--variables", |
| 79 i, |
| 80 ] |
| 81 } |
| 82 } |
| 83 |
| 84 # The template file is required. |
| 85 args += [ |
| 86 "--template", |
| 87 "{{source}}", |
| 88 ] |
| 89 |
| 90 args += [ |
| 91 "--output", |
| 92 rebase_path(outputs[0], root_build_dir), |
| 93 ] |
| 94 |
| 95 if (defined(invoker.encoding)) { |
| 96 args += [ |
| 97 "--encoding", |
| 98 invoker.encoding, |
| 99 ] |
| 100 } |
| 101 |
| 102 args += invoker.locales |
| 103 |
| 104 if (defined(invoker.deps)) { |
| 105 deps = invoker.deps |
| 106 } else { |
| 107 deps = [] |
| 108 } |
| 109 |
| 110 # This script reads the messages strings from the generated resource files. |
| 111 deps += [ "//remoting/resources:strings" ] |
| 112 } |
| 113 } |
OLD | NEW |