summaryrefslogtreecommitdiff
path: root/mojo/public/js/BUILD.gn
blob: d6b97bda6bf22da1fd20f355d9e41b96b4de7bd8 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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.

import("//tools/grit/grit_rule.gni")

interfaces_bindings_gen_dir = "$root_gen_dir/mojo/public/interfaces/bindings"

action("bindings") {
  bindings_js_files = [
    # This must be the first file in the list, because it initializes global
    # variable |mojo| that the others need to refer to.
    "base.js",

    "bindings.js",
    "interface_types.js",
    "lib/buffer.js",
    "lib/codec.js",
    "lib/connector.js",
    "lib/control_message_handler.js",
    "lib/control_message_proxy.js",
    "lib/interface_endpoint_client.js",
    "lib/interface_endpoint_handle.js",
    "lib/pipe_control_message_handler.js",
    "lib/pipe_control_message_proxy.js",
    "lib/router.js",
    "lib/unicode.js",
    "lib/validator.js",

    # These two needs to refer to codec.js.
    "$interfaces_bindings_gen_dir/interface_control_messages.mojom.js",
    "$interfaces_bindings_gen_dir/pipe_control_messages.mojom.js",
  ]
  compiled_file = "$target_gen_dir/mojo_bindings.js"

  # TODO(yzshen): Eventually we would like to use Closure Compiler to minify the
  # bindings instead of simply concatenating the files.
  script = "//v8/tools/concatenate-files.py"

  sources = bindings_js_files
  outputs = [
    compiled_file,
  ]

  args = rebase_path(bindings_js_files, root_build_dir)
  args += [ rebase_path(compiled_file, root_build_dir) ]

  deps = [
    "//mojo/public/interfaces/bindings:bindings_js__generator",
  ]
}

grit("resources") {
  source = "mojo_bindings_resources.grd"

  # The .grd contains references to generated files.
  source_is_generated = true

  outputs = [
    "grit/mojo_bindings_resources.h",
    "grit/mojo_bindings_resources_map.cc",
    "grit/mojo_bindings_resources_map.h",
    "mojo_bindings_resources.pak",
  ]
  grit_flags = [
    "-E",
    "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
  ]
  deps = [
    ":bindings",
  ]
}