kevers | 10278398 | 2014-10-31 15:55:21 | [diff] [blame] | 1 | # Copyright 2014 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 | template("build_closure") { |
| 6 | assert(defined(invoker.sources)) |
| 7 | assert(defined(invoker.target)) |
brettw | bd8c219 | 2016-10-01 01:56:13 | [diff] [blame] | 8 | action(target_name) { |
kevers | 10278398 | 2014-10-31 15:55:21 | [diff] [blame] | 9 | script = "//third_party/google_input_tools/builder.py" |
| 10 | sources = invoker.sources |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 11 | outputs = [ |
| 12 | invoker.target, |
| 13 | ] |
scottmg | 1c240d27 | 2014-12-03 07:28:00 | [diff] [blame] | 14 | args = [ |
| 15 | "--target", |
| 16 | rebase_path(invoker.target, root_build_dir), |
| 17 | ] |
| 18 | if (defined(invoker.json_file)) { |
kevers | 10278398 | 2014-10-31 15:55:21 | [diff] [blame] | 19 | # Optionally parse list of sources from a json file. Useful when the list |
| 20 | # is sufficiently long to create problems with length restrictions on the |
| 21 | # command line. |
| 22 | assert(defined(invoker.json_sources)) |
scottmg | 1c240d27 | 2014-12-03 07:28:00 | [diff] [blame] | 23 | args += [ |
| 24 | "--json_file", |
| 25 | rebase_path(invoker.json_file, root_build_dir), |
| 26 | "--json_sources", |
| 27 | invoker.json_sources, |
| 28 | ] |
kevers | 10278398 | 2014-10-31 15:55:21 | [diff] [blame] | 29 | } else { |
| 30 | # If the number of source files is short, they can be directly extracted |
| 31 | # from the command line. |
scottmg | 1c240d27 | 2014-12-03 07:28:00 | [diff] [blame] | 32 | args += [ "--sources" ] + sources |
kevers | 10278398 | 2014-10-31 15:55:21 | [diff] [blame] | 33 | } |
scottmg | 1c240d27 | 2014-12-03 07:28:00 | [diff] [blame] | 34 | if (defined(invoker.path)) { |
| 35 | args += [ |
| 36 | "--path", |
wychen | 6bf8ffa | 2017-06-07 08:51:52 | [diff] [blame^] | 37 | rebase_path(invoker.path, root_build_dir), |
scottmg | 1c240d27 | 2014-12-03 07:28:00 | [diff] [blame] | 38 | ] |
kevers | 10278398 | 2014-10-31 15:55:21 | [diff] [blame] | 39 | } |
| 40 | } |
kevers | 10278398 | 2014-10-31 15:55:21 | [diff] [blame] | 41 | } |