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

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

Issue 2691483005: Mojo Bindings: Put typemap files in the build dependency tree (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « mojo/public/tools/bindings/chromium_bindings_configuration.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 22 matching lines...) Expand all
33 _bindings_configuration_files = 33 _bindings_configuration_files =
34 [ "//mojo/public/tools/bindings/chromium_bindings_configuration.gni" ] 34 [ "//mojo/public/tools/bindings/chromium_bindings_configuration.gni" ]
35 } 35 }
36 _bindings_configurations = [] 36 _bindings_configurations = []
37 foreach(config_file, _bindings_configuration_files) { 37 foreach(config_file, _bindings_configuration_files) {
38 _bindings_configurations += [ read_file(config_file, "scope") ] 38 _bindings_configurations += [ read_file(config_file, "scope") ]
39 } 39 }
40 foreach(configuration, _bindings_configurations) { 40 foreach(configuration, _bindings_configurations) {
41 # Check that the mojom field of each typemap refers to a mojom that exists. 41 # Check that the mojom field of each typemap refers to a mojom that exists.
42 foreach(typemap, configuration.typemaps) { 42 foreach(typemap, configuration.typemaps) {
43 read_file(typemap.mojom, "") 43 _typemap_config = {
44 }
45 _typemap_config = typemap.config
46 read_file(_typemap_config.mojom, "")
44 } 47 }
45 if (is_mac && defined(configuration.typemaps_mac)) { 48 if (is_mac && defined(configuration.typemaps_mac)) {
46 foreach(typemap, configuration.typemaps_mac) { 49 foreach(typemap, configuration.typemaps_mac) {
47 read_file(typemap.mojom, "") 50 _typemap_config = {
51 }
52 _typemap_config = typemap.config
53 read_file(_typemap_config.mojom, "")
48 } 54 }
49 } 55 }
50 } 56 }
51 57
52 # Generates targets for building C++, JavaScript and Java bindings from mojom 58 # Generates targets for building C++, JavaScript and Java bindings from mojom
53 # files. The output files will go under the generated file directory tree with 59 # files. The output files will go under the generated file directory tree with
54 # the same path as each input file. 60 # the same path as each input file.
55 # 61 #
56 # Other targets should depend on one of these generated targets (where "foo" 62 # Other targets should depend on one of these generated targets (where "foo"
57 # is the target name): 63 # is the target name):
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 if (!blacklisted) { 299 if (!blacklisted) {
294 enabled_sources += [ source ] 300 enabled_sources += [ source ]
295 } 301 }
296 } 302 }
297 } else { 303 } else {
298 enabled_sources = invoker.sources 304 enabled_sources = invoker.sources
299 } 305 }
300 foreach(source, enabled_sources) { 306 foreach(source, enabled_sources) {
301 # TODO(sammc): Use a map instead of a linear scan when GN supports maps. 307 # TODO(sammc): Use a map instead of a linear scan when GN supports maps.
302 foreach(typemap, bindings_configuration.typemaps) { 308 foreach(typemap, bindings_configuration.typemaps) {
303 if (get_path_info(source, "abspath") == typemap.mojom) { 309 _typemap_config = {
310 }
311 _typemap_config = typemap.config
312 if (get_path_info(source, "abspath") == _typemap_config.mojom) {
304 active_typemaps += [ typemap ] 313 active_typemaps += [ typemap ]
305 } 314 }
306 } 315 }
307 if (is_mac && defined(bindings_configuration.typemaps_mac)) { 316 if (is_mac && defined(bindings_configuration.typemaps_mac)) {
308 foreach(typemap, bindings_configuration.typemaps_mac) { 317 foreach(typemap, bindings_configuration.typemaps_mac) {
309 if (get_path_info(source, "abspath") == typemap.mojom) { 318 _typemap_config = {
319 }
320 _typemap_config = typemap.config
321 if (get_path_info(source, "abspath") == _typemap_config.mojom) {
310 active_typemaps += [ typemap ] 322 active_typemaps += [ typemap ]
311 } 323 }
312 } 324 }
313 } 325 }
314 } 326 }
315 327
316 if (!cpp_only) { 328 if (!cpp_only) {
317 generator_js_outputs = 329 generator_js_outputs =
318 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] 330 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ]
319 generator_java_outputs = 331 generator_java_outputs =
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 "--dependency", 424 "--dependency",
413 dependency_path, 425 dependency_path,
414 ] 426 ]
415 } 427 }
416 428
417 if (enabled_sources != []) { 429 if (enabled_sources != []) {
418 # TODO(sammc): Pass the typemap description in a file to avoid command 430 # TODO(sammc): Pass the typemap description in a file to avoid command
419 # line length limitations. 431 # line length limitations.
420 typemap_description = [] 432 typemap_description = []
421 foreach(typemap, active_typemaps) { 433 foreach(typemap, active_typemaps) {
434 _typemap_config = {
435 }
436 _typemap_config = typemap.config
422 typemap_description += [ "--start-typemap" ] 437 typemap_description += [ "--start-typemap" ]
423 if (defined(typemap.public_headers)) { 438 if (defined(_typemap_config.public_headers)) {
424 foreach(value, typemap.public_headers) { 439 foreach(value, _typemap_config.public_headers) {
425 typemap_description += [ "public_headers=$value" ] 440 typemap_description += [ "public_headers=$value" ]
426 } 441 }
427 } 442 }
428 if (defined(typemap.traits_headers)) { 443 if (defined(_typemap_config.traits_headers)) {
429 foreach(value, typemap.traits_headers) { 444 foreach(value, _typemap_config.traits_headers) {
430 typemap_description += [ "traits_headers=$value" ] 445 typemap_description += [ "traits_headers=$value" ]
431 } 446 }
432 } 447 }
433 foreach(value, typemap.type_mappings) { 448 foreach(value, _typemap_config.type_mappings) {
434 typemap_description += [ "type_mappings=$value" ] 449 typemap_description += [ "type_mappings=$value" ]
435 } 450 }
451
452 # The typemap configuration files are not actually used as inputs here
453 # but this establishes a necessary build dependency to ensure that
454 # typemap changes force a rebuild of affected targets.
455 inputs += [ typemap.filename ]
436 } 456 }
437 args += typemap_description 457 args += typemap_description
438 } 458 }
439 } 459 }
440 460
441 source_set("${target_name}${variant_suffix}") { 461 source_set("${target_name}${variant_suffix}") {
442 if (defined(bindings_configuration.for_blink) && 462 if (defined(bindings_configuration.for_blink) &&
443 bindings_configuration.for_blink && 463 bindings_configuration.for_blink &&
444 defined(invoker.visibility_blink)) { 464 defined(invoker.visibility_blink)) {
445 visibility = invoker.visibility_blink 465 visibility = invoker.visibility_blink
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 # Resolve the name, so that a target //mojo/something becomes 523 # Resolve the name, so that a target //mojo/something becomes
504 # //mojo/something:something and we can append variant_suffix 524 # //mojo/something:something and we can append variant_suffix
505 # to get the cpp dependency name. 525 # to get the cpp dependency name.
506 full_name = get_label_info("$d", "label_no_toolchain") 526 full_name = get_label_info("$d", "label_no_toolchain")
507 public_deps -= [ "${full_name}${variant_suffix}" ] 527 public_deps -= [ "${full_name}${variant_suffix}" ]
508 } 528 }
509 public_deps += invoker.component_deps 529 public_deps += invoker.component_deps
510 } 530 }
511 } 531 }
512 foreach(typemap, active_typemaps) { 532 foreach(typemap, active_typemaps) {
513 if (defined(typemap.public_headers)) { 533 _typemap_config = {
514 sources += typemap.public_headers
515 } 534 }
516 if (defined(typemap.traits_headers)) { 535 _typemap_config = typemap.config
517 sources += typemap.traits_headers 536 if (defined(_typemap_config.public_headers)) {
537 sources += _typemap_config.public_headers
518 } 538 }
519 if (defined(typemap.sources)) { 539 if (defined(_typemap_config.traits_headers)) {
520 sources += typemap.sources 540 sources += _typemap_config.traits_headers
521 } 541 }
522 if (defined(typemap.public_deps)) { 542 if (defined(_typemap_config.sources)) {
523 public_deps += typemap.public_deps 543 sources += _typemap_config.sources
524 } 544 }
525 if (defined(typemap.deps)) { 545 if (defined(_typemap_config.public_deps)) {
526 deps += typemap.deps 546 public_deps += _typemap_config.public_deps
547 }
548 if (defined(_typemap_config.deps)) {
549 deps += _typemap_config.deps
527 } 550 }
528 } 551 }
529 if (defined(bindings_configuration.for_blink) && 552 if (defined(bindings_configuration.for_blink) &&
530 bindings_configuration.for_blink) { 553 bindings_configuration.for_blink) {
531 public_deps += [ "//mojo/public/cpp/bindings:wtf_support" ] 554 public_deps += [ "//mojo/public/cpp/bindings:wtf_support" ]
532 } 555 }
533 } 556 }
534 557
535 if (!cpp_only && is_android) { 558 if (!cpp_only && is_android) {
536 import("//build/config/android/rules.gni") 559 import("//build/config/android/rules.gni")
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 full_name = get_label_info(d, "label_no_toolchain") 599 full_name = get_label_info(d, "label_no_toolchain")
577 deps += [ "${full_name}_java" ] 600 deps += [ "${full_name}_java" ]
578 } 601 }
579 602
580 srcjar_deps = [ ":$java_srcjar_target_name" ] 603 srcjar_deps = [ ":$java_srcjar_target_name" ]
581 run_findbugs_override = false 604 run_findbugs_override = false
582 } 605 }
583 } 606 }
584 } 607 }
585 } 608 }
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/chromium_bindings_configuration.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698