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

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

Issue 2225673002: Support exporting Mojo bindings for the component build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win_clang Created 4 years, 4 months 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 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 # visibility (optional) 71 # visibility (optional)
72 # 72 #
73 # use_new_wrapper_types (optional) 73 # use_new_wrapper_types (optional)
74 # If set to true, mojom array/map/string will be mapped to STL (for 74 # If set to true, mojom array/map/string will be mapped to STL (for
75 # chromium variant) or WTF (for blink) types. Otherwise, they will be 75 # chromium variant) or WTF (for blink) types. Otherwise, they will be
76 # mapped to mojo::Array/Map/String/etc. 76 # mapped to mojo::Array/Map/String/etc.
77 # Default value is true. 77 # Default value is true.
78 # TODO(yzshen): 78 # TODO(yzshen):
79 # - convert all users to use the new mode; 79 # - convert all users to use the new mode;
80 # - remove support for the old mode. 80 # - remove support for the old mode.
81 #
82 # The following parameters are used to support the component build. They are
83 # needed so that bindings which are linked with a component can use the same
84 # export settings for classes. The first three are for the chromium variant, and
85 # the last three are for the blink variant.
86 # export_class_attribute (optional)
87 # The attribute to add to the class declaration. e.g. "CONTENT_EXPORT"
88 # export_define (optional)
89 # A define to be added to the source_set which is needed by the export
90 # header. e.g. "CONTENT_IMPLEMENTATION=1"
91 # export_header (optional)
92 # A header to be added to the generated bindings to support the component
93 # build. e.g. "content/common/content_export.h"
94 # export_class_attribute_blink (optional)
95 # export_define_blink (optional)
96 # export_header_blink (optional)
97 # These three parameters are the blink variants of the previous 3.
81 template("mojom") { 98 template("mojom") {
82 assert( 99 assert(
83 defined(invoker.sources) || defined(invoker.deps) || 100 defined(invoker.sources) || defined(invoker.deps) ||
84 defined(invoker.public_deps), 101 defined(invoker.public_deps),
85 "\"sources\" or \"deps\" must be defined for the $target_name template.") 102 "\"sources\" or \"deps\" must be defined for the $target_name template.")
103 if (defined(invoker.export_class_attribute) ||
104 defined(invoker.export_define) || defined(invoker.export_header)) {
105 assert(defined(invoker.export_class_attribute))
106 assert(defined(invoker.export_define))
107 assert(defined(invoker.export_header))
108 }
109 if (defined(invoker.export_class_attribute_blink) ||
110 defined(invoker.export_define_blink) ||
111 defined(invoker.export_header_blink)) {
112 assert(defined(invoker.export_class_attribute_blink))
113 assert(defined(invoker.export_define_blink))
114 assert(defined(invoker.export_header_blink))
115 }
86 116
87 all_deps = [] 117 all_deps = []
88 if (defined(invoker.deps)) { 118 if (defined(invoker.deps)) {
89 all_deps += invoker.deps 119 all_deps += invoker.deps
90 } 120 }
91 if (defined(invoker.public_deps)) { 121 if (defined(invoker.public_deps)) {
92 all_deps += invoker.public_deps 122 all_deps += invoker.public_deps
93 } 123 }
94 124
95 group("${target_name}__is_mojom") { 125 group("${target_name}__is_mojom") {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 250 }
221 251
222 args += [ 252 args += [
223 "--typemap", 253 "--typemap",
224 rebase_path(type_mappings_path, root_build_dir), 254 rebase_path(type_mappings_path, root_build_dir),
225 ] 255 ]
226 256
227 if (defined(bindings_configuration.for_blink) && 257 if (defined(bindings_configuration.for_blink) &&
228 bindings_configuration.for_blink) { 258 bindings_configuration.for_blink) {
229 args += [ "--for_blink" ] 259 args += [ "--for_blink" ]
260 if (defined(invoker.export_class_attribute_blink)) {
261 args += [
262 "--export_attribute",
263 invoker.export_class_attribute_blink,
264 "--export_header",
265 invoker.export_header_blink,
266 ]
267 }
268 } else {
269 if (defined(invoker.export_class_attribute)) {
270 args += [
271 "--export_attribute",
272 invoker.export_class_attribute,
273 "--export_header",
274 invoker.export_header,
275 ]
276 }
230 } 277 }
231 278
232 if (!defined(invoker.use_new_wrapper_types) || 279 if (!defined(invoker.use_new_wrapper_types) ||
233 invoker.use_new_wrapper_types) { 280 invoker.use_new_wrapper_types) {
234 args += [ "--use_new_wrapper_types" ] 281 args += [ "--use_new_wrapper_types" ]
235 } 282 }
236 } 283 }
237 } 284 }
238 285
239 action(type_mappings_target_name) { 286 action(type_mappings_target_name) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 } 365 }
319 } 366 }
320 367
321 # The generated C++ source files. The main reason to introduce this target 368 # The generated C++ source files. The main reason to introduce this target
322 # is so that mojo/public/cpp/bindings can depend on mojom interfaces without 369 # is so that mojo/public/cpp/bindings can depend on mojom interfaces without
323 # circular dependencies. It means that the target is missing the dependency 370 # circular dependencies. It means that the target is missing the dependency
324 # on mojo/public/cpp/bindings. No external targets should depend directly on 371 # on mojo/public/cpp/bindings. No external targets should depend directly on
325 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources 372 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources
326 # targets. 373 # targets.
327 source_set(cpp_sources_target_name) { 374 source_set(cpp_sources_target_name) {
375 defines = []
328 if (defined(invoker.testonly)) { 376 if (defined(invoker.testonly)) {
329 testonly = invoker.testonly 377 testonly = invoker.testonly
330 } 378 }
379 if (defined(invoker.export_define)) {
380 defines += [ invoker.export_define ]
381 }
382 if (defined(invoker.export_define_blink)) {
383 defines += [ invoker.export_define_blink ]
384 }
331 if (enabled_sources != []) { 385 if (enabled_sources != []) {
332 sources = process_file_template(enabled_sources, generator_cpp_outputs) 386 sources = process_file_template(enabled_sources, generator_cpp_outputs)
333 } 387 }
334 deps = [ 388 deps = [
335 "//mojo/public/cpp/bindings:struct_traits", 389 "//mojo/public/cpp/bindings:struct_traits",
336 "//mojo/public/interfaces/bindings:bindings__generator", 390 "//mojo/public/interfaces/bindings:bindings__generator",
337 ] 391 ]
338 if (enabled_sources != []) { 392 if (enabled_sources != []) {
339 deps += [ ":$generator_target_name" ] 393 deps += [ ":$generator_target_name" ]
340 } 394 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 full_name = get_label_info(d, "label_no_toolchain") 469 full_name = get_label_info(d, "label_no_toolchain")
416 deps += [ "${full_name}_java" ] 470 deps += [ "${full_name}_java" ]
417 } 471 }
418 472
419 srcjar_deps = [ ":$java_srcjar_target_name" ] 473 srcjar_deps = [ ":$java_srcjar_target_name" ]
420 run_findbugs_override = false 474 run_findbugs_override = false
421 } 475 }
422 } 476 }
423 } 477 }
424 } 478 }
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_cpp_generator.py ('k') | mojo/public/tools/bindings/mojom_bindings_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698