Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: mojo/public/tools/bindings/mojom.gni

Issue 799113004: Update mojo sdk to rev 59145288bae55b0fce4276b017df6a1117bcf00f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add mojo's ply to checklicenses whitelist Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 import("../../mojo_sdk.gni") 5 import("../../mojo_sdk.gni")
6 6
7 # Generate C++ and JavaScript source files from mojom files. The output files 7 # Generate C++ and JavaScript source files from mojom files. The output files
8 # will go under the generated file directory tree with the same path as each 8 # will go under the generated file directory tree with the same path as each
9 # input file. 9 # input file.
10 # 10 #
11 # Parameters: 11 # Parameters:
12 # 12 #
13 # sources (required) 13 # sources (required)
14 # List of source .mojom files to compile. 14 # List of source .mojom files to compile.
15 # 15 #
16 # deps (optional) 16 # deps (optional)
17 # Note: this can contain only other mojom targets. 17 # Note: this can contain only other mojom targets.
18 # 18 #
19 # public_deps (optional) 19 # public_deps (optional)
20 # Note: this can contain only other mojom targets. 20 # Note: this can contain only other mojom targets.
21 # 21 #
22 # testonly (optional) 22 # testonly (optional)
23 # 23 #
24 # visibility (optional) 24 # visibility (optional)
25 template("mojom") { 25 template("mojom") {
26 assert(defined(invoker.sources), 26 assert(defined(invoker.sources),
27 "\"sources\" must be defined for the $target_name template.") 27 "\"sources\" must be defined for the $target_name template.")
28 28
29 generator_root = 29 generator_root = rebase_path("mojo/public/tools/bindings", ".", mojo_root)
30 rebase_path("mojo/public/tools/bindings", ".", mojo_root)
31 generator_script = "$generator_root/mojom_bindings_generator.py" 30 generator_script = "$generator_root/mojom_bindings_generator.py"
32 generator_sources = [ 31 generator_sources = [
33 generator_script, 32 generator_script,
34 "$generator_root/generators/cpp_templates/enum_declaration.tmpl", 33 "$generator_root/generators/cpp_templates/enum_declaration.tmpl",
35 "$generator_root/generators/cpp_templates/interface_declaration.tmpl", 34 "$generator_root/generators/cpp_templates/interface_declaration.tmpl",
36 "$generator_root/generators/cpp_templates/interface_definition.tmpl", 35 "$generator_root/generators/cpp_templates/interface_definition.tmpl",
37 "$generator_root/generators/cpp_templates/interface_macros.tmpl", 36 "$generator_root/generators/cpp_templates/interface_macros.tmpl",
38 "$generator_root/generators/cpp_templates/interface_proxy_declaration.tmpl", 37 "$generator_root/generators/cpp_templates/interface_proxy_declaration.tmpl",
39 "$generator_root/generators/cpp_templates/interface_request_validator_declar ation.tmpl", 38 "$generator_root/generators/cpp_templates/interface_request_validator_declar ation.tmpl",
40 "$generator_root/generators/cpp_templates/interface_response_validator_decla ration.tmpl", 39 "$generator_root/generators/cpp_templates/interface_response_validator_decla ration.tmpl",
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 "$generator_root/pylib/mojom/parse/ast.py", 89 "$generator_root/pylib/mojom/parse/ast.py",
91 "$generator_root/pylib/mojom/parse/lexer.py", 90 "$generator_root/pylib/mojom/parse/lexer.py",
92 "$generator_root/pylib/mojom/parse/parser.py", 91 "$generator_root/pylib/mojom/parse/parser.py",
93 "$generator_root/pylib/mojom/parse/translate.py", 92 "$generator_root/pylib/mojom/parse/translate.py",
94 ] 93 ]
95 generator_cpp_outputs = [ 94 generator_cpp_outputs = [
96 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", 95 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc",
97 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", 96 "{{source_gen_dir}}/{{source_name_part}}.mojom.h",
98 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", 97 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h",
99 ] 98 ]
100 generator_dart_outputs = [ 99 generator_dart_outputs =
101 "{{source_gen_dir}}/{{source_name_part}}.mojom.dart", 100 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ]
102 ] 101 generator_java_outputs =
103 generator_java_outputs = [ 102 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ]
104 "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar", 103 generator_js_outputs = [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ]
105 ] 104 generator_python_outputs =
106 generator_js_outputs = [ 105 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ]
107 "{{source_gen_dir}}/{{source_name_part}}.mojom.js",
108 ]
109 generator_python_outputs = [
110 "{{source_gen_dir}}/{{source_name_part}}_mojom.py",
111 ]
112 106
113 if (defined(invoker.visibility)) { 107 if (defined(invoker.visibility)) {
114 # Need to save this because the the target_name is overwritten inside the 108 # Need to save this because the the target_name is overwritten inside the
115 # action to be that of the action itself. Only define this in the case the 109 # action to be that of the action itself. Only define this in the case the
116 # var is used to avoid unused var error. 110 # var is used to avoid unused var error.
117 target_visibility = [ ":$target_name" ] 111 target_visibility = [ ":$target_name" ]
118 } 112 }
119 113
120 generator_target_name = target_name + "__generator" 114 generator_target_name = target_name + "__generator"
121 action_foreach(generator_target_name) { 115 action_foreach(generator_target_name) {
122 if (defined(invoker.visibility)) { 116 if (defined(invoker.visibility)) {
123 visibility = target_visibility + invoker.visibility 117 visibility = target_visibility + invoker.visibility
124 } 118 }
125 script = generator_script 119 script = generator_script
126 inputs = generator_sources 120 inputs = generator_sources
127 sources = invoker.sources 121 sources = invoker.sources
128 outputs = generator_cpp_outputs + 122 outputs =
129 generator_dart_outputs + 123 generator_cpp_outputs + generator_dart_outputs +
130 generator_java_outputs + 124 generator_java_outputs + generator_js_outputs + generator_python_outputs
131 generator_js_outputs +
132 generator_python_outputs
133 args = [ 125 args = [
134 "{{source}}", 126 "{{source}}",
135 "--use_chromium_bundled_pylibs", 127 "--use_bundled_pylibs",
136 "-d", rebase_path("//", root_build_dir), 128 "-d",
137 "-I", rebase_path("//", root_build_dir), 129 rebase_path("//", root_build_dir),
138 "-I", rebase_path(mojo_root, root_build_dir), 130 "-I",
139 "-o", rebase_path(root_gen_dir), 131 rebase_path("//", root_build_dir),
132 "-I",
133 rebase_path(mojo_root, root_build_dir),
134 "-o",
135 rebase_path(root_gen_dir),
140 ] 136 ]
141 } 137 }
142 138
143 source_set(target_name) { 139 source_set(target_name) {
144 if (defined(invoker.visibility)) { 140 if (defined(invoker.visibility)) {
145 visibility = invoker.visibility 141 visibility = invoker.visibility
146 } 142 }
147 if (defined(invoker.testonly)) { 143 if (defined(invoker.testonly)) {
148 testonly = invoker.testonly 144 testonly = invoker.testonly
149 } 145 }
150 sources = process_file_template(invoker.sources, generator_cpp_outputs) 146 sources = process_file_template(invoker.sources, generator_cpp_outputs)
151 data = process_file_template(invoker.sources, generator_js_outputs) 147 data = process_file_template(invoker.sources, generator_js_outputs)
152 148
153 public_configs = rebase_path([ 149 public_configs =
154 "mojo/public/build/config:mojo_sdk", 150 rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root)
155 ], ".", mojo_root)
156 151
157 public_deps = rebase_path([ 152 public_deps = rebase_path([ "mojo/public/cpp/bindings" ], ".", mojo_root)
158 "mojo/public/cpp/bindings",
159 ], ".", mojo_root)
160 if (defined(invoker.public_deps)) { 153 if (defined(invoker.public_deps)) {
161 public_deps += invoker.public_deps 154 public_deps += invoker.public_deps
162 } 155 }
163 156
164 deps = [ 157 deps = [
165 ":$generator_target_name", 158 ":$generator_target_name",
166 ] 159 ]
167 if (defined(invoker.deps)) { 160 if (defined(invoker.deps)) {
168 deps += invoker.deps 161 deps += invoker.deps
169 } 162 }
(...skipping 20 matching lines...) Expand all
190 deps += [ "${name}__is_mojom(${toolchain})" ] 183 deps += [ "${name}__is_mojom(${toolchain})" ]
191 } 184 }
192 } 185 }
193 186
194 if (is_android) { 187 if (is_android) {
195 import("//build/config/android/rules.gni") 188 import("//build/config/android/rules.gni")
196 189
197 java_target_name = target_name + "_java" 190 java_target_name = target_name + "_java"
198 android_library(java_target_name) { 191 android_library(java_target_name) {
199 deps = rebase_path([ 192 deps = rebase_path([
200 "mojo/public/java:bindings", 193 "mojo/public/java:bindings",
201 "mojo/public/java:system", 194 "mojo/public/java:system",
202 ], ".", mojo_root) 195 ],
196 ".",
197 mojo_root)
203 198
204 foreach(d, all_deps) { 199 foreach(d, all_deps) {
205 # Resolve the name, so that a target //mojo/something becomes 200 # Resolve the name, so that a target //mojo/something becomes
206 # //mojo/something:something and we can append "_java" to get the java 201 # //mojo/something:something and we can append "_java" to get the java
207 # dependency name. 202 # dependency name.
208 full_name = get_label_info(d, "label_no_toolchain") 203 full_name = get_label_info(d, "label_no_toolchain")
209 deps += [ "${full_name}_java" ] 204 deps += [ "${full_name}_java" ]
210 } 205 }
211 206
212 srcjars = process_file_template(invoker.sources, generator_java_outputs) 207 srcjars = process_file_template(invoker.sources, generator_java_outputs)
213 } 208 }
214 } 209 }
215 } 210 }
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_js_generator.py ('k') | mojo/public/tools/bindings/mojom_bindings_generator.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698