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
5import("//tools/grit/grit_rule.gni")
6
7interfaces_bindings_gen_dir = "$root_gen_dir/mojo/public/interfaces/bindings"
8
9action("bindings") {
10  bindings_js_files = [
11    # This must be the first file in the list, because it initializes global
12    # variable |mojo| that the others need to refer to.
13    "base.js",
14
15    "bindings.js",
16    "interface_types.js",
17    "lib/buffer.js",
18    "lib/codec.js",
19    "lib/connector.js",
20    "lib/control_message_handler.js",
21    "lib/control_message_proxy.js",
22    "lib/interface_endpoint_client.js",
23    "lib/interface_endpoint_handle.js",
24    "lib/pipe_control_message_handler.js",
25    "lib/pipe_control_message_proxy.js",
26    "lib/router.js",
27    "lib/unicode.js",
28    "lib/validator.js",
29
30    # These two needs to refer to codec.js.
31    "$interfaces_bindings_gen_dir/interface_control_messages.mojom.js",
32    "$interfaces_bindings_gen_dir/pipe_control_messages.mojom.js",
33  ]
34  compiled_file = "$target_gen_dir/mojo_bindings.js"
35
36  # TODO(yzshen): Eventually we would like to use Closure Compiler to minify the
37  # bindings instead of simply concatenating the files.
38  script = "//v8/tools/concatenate-files.py"
39
40  sources = bindings_js_files
41  outputs = [
42    compiled_file,
43  ]
44
45  args = rebase_path(bindings_js_files, root_build_dir)
46  args += [ rebase_path(compiled_file, root_build_dir) ]
47
48  deps = [
49    "//mojo/public/interfaces/bindings:bindings_js__generator",
50  ]
51}
52
53grit("resources") {
54  source = "mojo_bindings_resources.grd"
55
56  # The .grd contains references to generated files.
57  source_is_generated = true
58
59  outputs = [
60    "grit/mojo_bindings_resources.h",
61    "grit/mojo_bindings_resources_map.cc",
62    "grit/mojo_bindings_resources_map.h",
63    "mojo_bindings_resources.pak",
64  ]
65  grit_flags = [
66    "-E",
67    "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
68  ]
69  deps = [
70    ":bindings",
71  ]
72}
73