File: inspector_protocol.gni

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (99 lines) | stat: -rw-r--r-- 3,128 bytes parent folder | download | duplicates (13)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This template will generate inspector protocol source code. The code will
# not be compiled, use get_target_outputs(<name>) to compile them.
#
# Inputs
#
#   config_file  (required)
#       Path to json file specifying inspector protocol configuration.
#
#   out_dir  (required)
#       Path to put the generated files in. It must be inside output or
#       generated file directory.
#
#   outputs (required)
#       Files generated. Relative to out_dir.
#
#   inputs  (optional)
#       Extra inputs specified by the config file.
#
#   jinja_dir (optional)
#       Custom path to jinja (defaults to "//third_party").
template("inspector_protocol_generate") {
  assert(defined(invoker.config_file))
  assert(defined(invoker.out_dir))
  assert(defined(invoker.outputs))
  assert(defined(invoker.inspector_protocol_dir))
  inspector_protocol_dir = invoker.inspector_protocol_dir
  use_embedder_types =
      defined(invoker.use_embedder_types) && invoker.use_embedder_types

  if (defined(invoker.jinja_dir)) {
    jinja_dir = invoker.jinja_dir
  } else {
    jinja_dir = "//third_party"
  }
  action(target_name) {
    script = "$inspector_protocol_dir/code_generator.py"

    inputs = [
      invoker.config_file,
      "$inspector_protocol_dir/lib/Forward_h.template",
      "$inspector_protocol_dir/templates/Exported_h.template",
      "$inspector_protocol_dir/templates/Imported_h.template",
      "$inspector_protocol_dir/templates/TypeBuilder_cpp.template",
      "$inspector_protocol_dir/templates/TypeBuilder_h.template",
    ]
    if (defined(invoker.inputs)) {
      inputs += invoker.inputs
    }
    if (!use_embedder_types) {
      inputs += [
        "$inspector_protocol_dir/lib/ValueConversions_cpp.template",
        "$inspector_protocol_dir/lib/ValueConversions_h.template",
        "$inspector_protocol_dir/lib/Values_cpp.template",
        "$inspector_protocol_dir/lib/Values_h.template",
        "$inspector_protocol_dir/lib/Object_cpp.template",
        "$inspector_protocol_dir/lib/Object_h.template",
      ]
    }

    args = [
      "--jinja_dir",
      rebase_path(jinja_dir, root_build_dir),
      "--output_base",
      rebase_path(invoker.out_dir, root_build_dir),
      "--config",
      rebase_path(invoker.config_file, root_build_dir),
      "--inspector_protocol_dir",
      "$inspector_protocol_dir",
    ]
    if (use_embedder_types) {
      args += [
        "--config_value",
        "use_embedder_types=true",
      ]
    }
    if (defined(invoker.config_values)) {
      foreach(value, invoker.config_values) {
        args += [
          "--config_value",
          value,
        ]
      }
    }

    outputs = get_path_info(rebase_path(invoker.outputs, ".", invoker.out_dir),
                            "abspath")

    forward_variables_from(invoker,
                           [
                             "visibility",
                             "deps",
                             "public_deps",
                           ])
  }
}