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 mojom_generator_root = "//mojo/public/tools/bindings" | 5 mojom_generator_root = "//mojo/public/tools/bindings" |
6 mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py" | 6 mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py" |
7 mojom_generator_sources = [ | 7 mojom_generator_sources = [ |
8 "$mojom_generator_root/generators/mojom_cpp_generator.py", | 8 "$mojom_generator_root/generators/mojom_cpp_generator.py", |
9 "$mojom_generator_root/generators/mojom_js_generator.py", | 9 "$mojom_generator_root/generators/mojom_js_generator.py", |
10 "$mojom_generator_root/generators/mojom_java_generator.py", | 10 "$mojom_generator_root/generators/mojom_java_generator.py", |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 # typemap_deps (optional) | 57 # typemap_deps (optional) |
58 # A list of public dependencies needed to support active typemaps. | 58 # A list of public dependencies needed to support active typemaps. |
59 # | 59 # |
60 # variant (optional) | 60 # variant (optional) |
61 # A variant name to apply to generated bindings. Variant influences | 61 # A variant name to apply to generated bindings. Variant influences |
62 # generated source filenames as wells the symbols they define. | 62 # generated source filenames as wells the symbols they define. |
63 # | 63 # |
64 # testonly (optional) | 64 # testonly (optional) |
65 # | 65 # |
66 # visibility (optional) | 66 # visibility (optional) |
67 # | |
68 # use_wtf_types (optional, C++ only) | |
Ken Rockot(use gerrit already)
2016/03/01 02:06:37
nit: How about more generically something like for
yzshen1
2016/03/01 18:42:46
Sounds good. Done.
| |
69 # Use WTF types as generated type for mojo string/array/map. | |
67 template("mojom") { | 70 template("mojom") { |
68 assert( | 71 assert( |
69 defined(invoker.sources) || defined(invoker.deps) || | 72 defined(invoker.sources) || defined(invoker.deps) || |
70 defined(invoker.public_deps), | 73 defined(invoker.public_deps), |
71 "\"sources\" or \"deps\" must be defined for the $target_name template.") | 74 "\"sources\" or \"deps\" must be defined for the $target_name template.") |
72 | 75 |
73 cpp_sources_suffix = "cpp_sources" | 76 cpp_sources_suffix = "cpp_sources" |
74 cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}" | 77 cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}" |
75 cpp_only = false | 78 cpp_only = false |
76 if (defined(invoker.sources)) { | 79 if (defined(invoker.sources)) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 | 159 |
157 if (defined(invoker.typemaps)) { | 160 if (defined(invoker.typemaps)) { |
158 foreach(typemap, invoker.typemaps) { | 161 foreach(typemap, invoker.typemaps) { |
159 args += [ | 162 args += [ |
160 "--typemap", | 163 "--typemap", |
161 rebase_path(typemap, root_build_dir), | 164 rebase_path(typemap, root_build_dir), |
162 ] | 165 ] |
163 } | 166 } |
164 inputs += invoker.typemaps | 167 inputs += invoker.typemaps |
165 } | 168 } |
169 | |
170 if (defined(invoker.use_wtf_types) && invoker.use_wtf_types) { | |
171 args += [ "--use_wtf_types" ] | |
172 } | |
166 } | 173 } |
167 } | 174 } |
168 | 175 |
169 source_set(target_name) { | 176 source_set(target_name) { |
170 if (defined(invoker.visibility)) { | 177 if (defined(invoker.visibility)) { |
171 visibility = invoker.visibility | 178 visibility = invoker.visibility |
172 } | 179 } |
173 if (defined(invoker.testonly)) { | 180 if (defined(invoker.testonly)) { |
174 testonly = invoker.testonly | 181 testonly = invoker.testonly |
175 } | 182 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 foreach(d, all_deps) { | 253 foreach(d, all_deps) { |
247 # Resolve the name, so that a target //mojo/something becomes | 254 # Resolve the name, so that a target //mojo/something becomes |
248 # //mojo/something:something and we can append cpp_sources_suffix to | 255 # //mojo/something:something and we can append cpp_sources_suffix to |
249 # get the cpp dependency name. | 256 # get the cpp dependency name. |
250 full_name = get_label_info(d, "label_no_toolchain") | 257 full_name = get_label_info(d, "label_no_toolchain") |
251 deps += [ "${full_name}_${cpp_sources_suffix}" ] | 258 deps += [ "${full_name}_${cpp_sources_suffix}" ] |
252 } | 259 } |
253 if (!defined(invoker.with_environment) || invoker.with_environment) { | 260 if (!defined(invoker.with_environment) || invoker.with_environment) { |
254 deps += [ "//mojo/environment:chromium" ] | 261 deps += [ "//mojo/environment:chromium" ] |
255 } | 262 } |
263 if (defined(invoker.use_wtf_types) && invoker.use_wtf_types) { | |
264 public_deps += [ | |
265 "//mojo/public/cpp/bindings:wtf_support", | |
266 "//third_party/WebKit/Source/wtf", | |
267 ] | |
268 } | |
256 } | 269 } |
257 } | 270 } |
258 | 271 |
259 if (is_android && !defined(invoker.variant)) { | 272 if (is_android && !defined(invoker.variant)) { |
260 import("//build/config/android/rules.gni") | 273 import("//build/config/android/rules.gni") |
261 | 274 |
262 java_srcjar_target_name = target_name + "_java_sources" | 275 java_srcjar_target_name = target_name + "_java_sources" |
263 action(java_srcjar_target_name) { | 276 action(java_srcjar_target_name) { |
264 script = "//mojo/public/tools/gn/zip.py" | 277 script = "//mojo/public/tools/gn/zip.py" |
265 inputs = process_file_template(invoker.sources, generator_java_outputs) | 278 inputs = process_file_template(invoker.sources, generator_java_outputs) |
(...skipping 25 matching lines...) Expand all Loading... | |
291 # //mojo/something:something and we can append "_java" to get the java | 304 # //mojo/something:something and we can append "_java" to get the java |
292 # dependency name. | 305 # dependency name. |
293 full_name = get_label_info(d, "label_no_toolchain") | 306 full_name = get_label_info(d, "label_no_toolchain") |
294 deps += [ "${full_name}_java" ] | 307 deps += [ "${full_name}_java" ] |
295 } | 308 } |
296 | 309 |
297 srcjar_deps = [ ":$java_srcjar_target_name" ] | 310 srcjar_deps = [ ":$java_srcjar_target_name" ] |
298 } | 311 } |
299 } | 312 } |
300 } | 313 } |
OLD | NEW |