summaryrefslogtreecommitdiffstats
path: root/third_party/google_input_tools/closure.gni
blob: 81f866581fa621fb089718e6a9a5c762c432ab0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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.

template("build_closure") {
  assert(defined(invoker.sources))
  assert(defined(invoker.target))
  action_name = target_name + "_js_gen"
  action(action_name) {
    script = "//third_party/google_input_tools/builder.py"
    sources = invoker.sources
    outputs = [
      invoker.target,
    ]
    args = [
      "--target",
      rebase_path(invoker.target, root_build_dir),
    ]
    if (defined(invoker.json_file)) {
      # Optionally parse list of sources from a json file. Useful when the list
      # is sufficiently long to create problems with length restrictions on the
      # command line.
      assert(defined(invoker.json_sources))
      args += [
        "--json_file",
        rebase_path(invoker.json_file, root_build_dir),
        "--json_sources",
        invoker.json_sources,
      ]
    } else {
      # If the number of source files is short, they can be directly extracted
      # from the command line.
      args += [ "--sources" ] + sources
    }
    if (defined(invoker.path)) {
      args += [
        "--path",
        invoker.path,
      ]
    }
  }
  group(target_name) {
    deps = [
      ":$action_name",
    ]
  }
}