OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Generate C++ and JavaScript source files from mojom files. The output files | 5 # Generate C++ and JavaScript source files from mojom files. The output files |
6 # will go under the generated file directory tree with the same path as each | 6 # will go under the generated file directory tree with the same path as each |
7 # input file. | 7 # input file. |
8 # | 8 # |
9 # Parameters: | 9 # Parameters: |
10 # | 10 # |
11 # sources (required) | 11 # sources (required) |
12 # List of source .mojom files to compile. | 12 # List of source .mojom files to compile. |
13 # | 13 # |
14 # deps (optional) | 14 # deps (optional) |
15 # | 15 # public_deps (optional) |
16 # visibility (optional) | 16 # visibility (optional) |
17 # Normal meaning. However, this must be a list (normal visibility | |
18 # allows a single string). | |
19 template("mojom") { | 17 template("mojom") { |
20 assert(defined(invoker.sources), | 18 assert(defined(invoker.sources), |
21 "\"sources\" must be defined for the $target_name template.") | 19 "\"sources\" must be defined for the $target_name template.") |
22 | 20 |
23 generator_root = "//mojo/public/tools/bindings" | 21 generator_root = "//mojo/public/tools/bindings" |
24 generator_script = "$generator_root/mojom_bindings_generator.py" | 22 generator_script = "$generator_root/mojom_bindings_generator.py" |
25 generator_sources = [ | 23 generator_sources = [ |
26 generator_script, | 24 generator_script, |
27 "$generator_root/generators/cpp_templates/enum_declaration.tmpl", | 25 "$generator_root/generators/cpp_templates/enum_declaration.tmpl", |
28 "$generator_root/generators/cpp_templates/interface_declaration.tmpl", | 26 "$generator_root/generators/cpp_templates/interface_declaration.tmpl", |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 "{{source_gen_dir}}/{{source_name_part}}_mojom.py", | 76 "{{source_gen_dir}}/{{source_name_part}}_mojom.py", |
79 ] | 77 ] |
80 | 78 |
81 if (defined(invoker.visibility)) { | 79 if (defined(invoker.visibility)) { |
82 # Need to save this because the the target_name is overwritten inside the | 80 # Need to save this because the the target_name is overwritten inside the |
83 # action to be that of the action itself. Only define this in the case the | 81 # action to be that of the action itself. Only define this in the case the |
84 # var is used to avoid unused var error. | 82 # var is used to avoid unused var error. |
85 target_visibility = [ ":$target_name" ] | 83 target_visibility = [ ":$target_name" ] |
86 } | 84 } |
87 | 85 |
88 generator_target_name = target_name + "_generator" | 86 generator_target_name = target_name + "__generator" |
89 action_foreach(generator_target_name) { | 87 action_foreach(generator_target_name) { |
90 if (defined(invoker.visibility)) { | 88 if (defined(invoker.visibility)) { |
91 visibility = target_visibility + invoker.visibility | 89 visibility = target_visibility + invoker.visibility |
92 } | 90 } |
93 script = generator_script | 91 script = generator_script |
94 inputs = generator_sources | 92 inputs = generator_sources |
95 sources = invoker.sources | 93 sources = invoker.sources |
96 outputs = generator_cpp_outputs + | 94 outputs = generator_cpp_outputs + |
97 generator_js_outputs + | 95 generator_js_outputs + |
98 generator_python_outputs | 96 generator_python_outputs |
(...skipping 12 matching lines...) Expand all Loading... |
111 } | 109 } |
112 sources = process_file_template(invoker.sources, generator_cpp_outputs) | 110 sources = process_file_template(invoker.sources, generator_cpp_outputs) |
113 data = process_file_template(invoker.sources, generator_js_outputs) | 111 data = process_file_template(invoker.sources, generator_js_outputs) |
114 deps = [ | 112 deps = [ |
115 ":$generator_target_name", | 113 ":$generator_target_name", |
116 "//mojo/public/cpp/bindings", | 114 "//mojo/public/cpp/bindings", |
117 ] | 115 ] |
118 if (defined(invoker.deps)) { | 116 if (defined(invoker.deps)) { |
119 deps += invoker.deps | 117 deps += invoker.deps |
120 } | 118 } |
| 119 if (defined(invoker.public_deps)) { |
| 120 public_deps = invoker.public_deps |
| 121 } |
121 } | 122 } |
122 } | 123 } |
OLD | NEW |