Chromium Code Reviews| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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" ] |
| 230 } | 260 } |
| 231 | 261 |
| 232 if (!defined(invoker.use_new_wrapper_types) || | 262 if (!defined(invoker.use_new_wrapper_types) || |
| 233 invoker.use_new_wrapper_types) { | 263 invoker.use_new_wrapper_types) { |
| 234 args += [ "--use_new_wrapper_types" ] | 264 args += [ "--use_new_wrapper_types" ] |
| 235 } | 265 } |
| 266 if (defined(invoker.export_class_attribute) && | |
|
yzshen1
2016/08/08 17:07:32
It seems simpler to merge these new if's with line
jam
2016/08/08 17:36:08
Done.
| |
| 267 !defined(bindings_configuration.variant)) { | |
| 268 args += [ | |
| 269 "--export_attribute", | |
| 270 invoker.export_class_attribute, | |
| 271 ] | |
| 272 } | |
| 273 if (defined(invoker.export_class_attribute_blink) && | |
| 274 defined(bindings_configuration.for_blink)) { | |
| 275 args += [ | |
| 276 "--export_attribute", | |
| 277 invoker.export_class_attribute_blink, | |
| 278 ] | |
| 279 } | |
| 280 if (defined(invoker.export_header) && | |
| 281 !defined(bindings_configuration.variant)) { | |
| 282 args += [ | |
| 283 "--export_header", | |
| 284 invoker.export_header, | |
| 285 ] | |
| 286 } | |
| 287 if (defined(invoker.export_header_blink) && | |
| 288 defined(bindings_configuration.for_blink)) { | |
| 289 args += [ | |
| 290 "--export_header", | |
| 291 invoker.export_header_blink, | |
| 292 ] | |
| 293 } | |
| 236 } | 294 } |
| 237 } | 295 } |
| 238 | 296 |
| 239 action(type_mappings_target_name) { | 297 action(type_mappings_target_name) { |
| 240 inputs = _bindings_configuration_files | 298 inputs = _bindings_configuration_files |
| 241 outputs = [ | 299 outputs = [ |
| 242 type_mappings_path, | 300 type_mappings_path, |
| 243 ] | 301 ] |
| 244 script = "$mojom_generator_root/generate_type_mappings.py" | 302 script = "$mojom_generator_root/generate_type_mappings.py" |
| 245 deps = [] | 303 deps = [] |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 } | 376 } |
| 319 } | 377 } |
| 320 | 378 |
| 321 # The generated C++ source files. The main reason to introduce this target | 379 # 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 | 380 # 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 | 381 # circular dependencies. It means that the target is missing the dependency |
| 324 # on mojo/public/cpp/bindings. No external targets should depend directly on | 382 # on mojo/public/cpp/bindings. No external targets should depend directly on |
| 325 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources | 383 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources |
| 326 # targets. | 384 # targets. |
| 327 source_set(cpp_sources_target_name) { | 385 source_set(cpp_sources_target_name) { |
| 386 defines = [] | |
| 328 if (defined(invoker.testonly)) { | 387 if (defined(invoker.testonly)) { |
| 329 testonly = invoker.testonly | 388 testonly = invoker.testonly |
| 330 } | 389 } |
| 390 if (defined(invoker.export_define)) { | |
| 391 defines += [ invoker.export_define ] | |
| 392 } | |
| 393 if (defined(invoker.export_define_blink)) { | |
| 394 defines += [ invoker.export_define_blink ] | |
| 395 } | |
| 331 if (enabled_sources != []) { | 396 if (enabled_sources != []) { |
| 332 sources = process_file_template(enabled_sources, generator_cpp_outputs) | 397 sources = process_file_template(enabled_sources, generator_cpp_outputs) |
| 333 } | 398 } |
| 334 deps = [ | 399 deps = [ |
| 335 "//mojo/public/cpp/bindings:struct_traits", | 400 "//mojo/public/cpp/bindings:struct_traits", |
| 336 "//mojo/public/interfaces/bindings:bindings__generator", | 401 "//mojo/public/interfaces/bindings:bindings__generator", |
| 337 ] | 402 ] |
| 338 if (enabled_sources != []) { | 403 if (enabled_sources != []) { |
| 339 deps += [ ":$generator_target_name" ] | 404 deps += [ ":$generator_target_name" ] |
| 340 } | 405 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 full_name = get_label_info(d, "label_no_toolchain") | 480 full_name = get_label_info(d, "label_no_toolchain") |
| 416 deps += [ "${full_name}_java" ] | 481 deps += [ "${full_name}_java" ] |
| 417 } | 482 } |
| 418 | 483 |
| 419 srcjar_deps = [ ":$java_srcjar_target_name" ] | 484 srcjar_deps = [ ":$java_srcjar_target_name" ] |
| 420 run_findbugs_override = false | 485 run_findbugs_override = false |
| 421 } | 486 } |
| 422 } | 487 } |
| 423 } | 488 } |
| 424 } | 489 } |
| OLD | NEW |