| 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" |
| 6 mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py" |
| 7 mojom_generator_sources = [ |
| 8 "$mojom_generator_root/generators/mojom_cpp_generator.py", |
| 9 "$mojom_generator_root/generators/mojom_js_generator.py", |
| 10 "$mojom_generator_root/generators/mojom_java_generator.py", |
| 11 "$mojom_generator_root/pylib/mojom/__init__.py", |
| 12 "$mojom_generator_root/pylib/mojom/error.py", |
| 13 "$mojom_generator_root/pylib/mojom/generate/__init__.py", |
| 14 "$mojom_generator_root/pylib/mojom/generate/constant_resolver.py", |
| 15 "$mojom_generator_root/pylib/mojom/generate/data.py", |
| 16 "$mojom_generator_root/pylib/mojom/generate/generator.py", |
| 17 "$mojom_generator_root/pylib/mojom/generate/module.py", |
| 18 "$mojom_generator_root/pylib/mojom/generate/pack.py", |
| 19 "$mojom_generator_root/pylib/mojom/generate/template_expander.py", |
| 20 "$mojom_generator_root/pylib/mojom/parse/__init__.py", |
| 21 "$mojom_generator_root/pylib/mojom/parse/ast.py", |
| 22 "$mojom_generator_root/pylib/mojom/parse/lexer.py", |
| 23 "$mojom_generator_root/pylib/mojom/parse/parser.py", |
| 24 "$mojom_generator_root/pylib/mojom/parse/translate.py", |
| 25 "$mojom_generator_script", |
| 26 ] |
| 27 |
| 5 # Generate C++/JavaScript/Java source files from mojom files. The output files | 28 # Generate C++/JavaScript/Java source files from mojom files. The output files |
| 6 # will go under the generated file directory tree with the same path as each | 29 # will go under the generated file directory tree with the same path as each |
| 7 # input file. | 30 # input file. |
| 8 # | 31 # |
| 9 # Parameters: | 32 # Parameters: |
| 10 # | 33 # |
| 11 # sources (optional if one of the deps sets listed below is present) | 34 # sources (optional if one of the deps sets listed below is present) |
| 12 # List of source .mojom files to compile. | 35 # List of source .mojom files to compile. |
| 13 # | 36 # |
| 14 # deps (optional) | 37 # deps (optional) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 37 # visibility (optional) | 60 # visibility (optional) |
| 38 template("mojom") { | 61 template("mojom") { |
| 39 assert( | 62 assert( |
| 40 defined(invoker.sources) || defined(invoker.deps) || | 63 defined(invoker.sources) || defined(invoker.deps) || |
| 41 defined(invoker.public_deps), | 64 defined(invoker.public_deps), |
| 42 "\"sources\" or \"deps\" must be defined for the $target_name template.") | 65 "\"sources\" or \"deps\" must be defined for the $target_name template.") |
| 43 | 66 |
| 44 cpp_sources_suffix = "cpp_sources" | 67 cpp_sources_suffix = "cpp_sources" |
| 45 cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}" | 68 cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}" |
| 46 if (defined(invoker.sources)) { | 69 if (defined(invoker.sources)) { |
| 47 generator_root = "//mojo/public/tools/bindings" | |
| 48 generator_script = "$generator_root/mojom_bindings_generator.py" | |
| 49 generator_sources = [ | |
| 50 generator_script, | |
| 51 "$generator_root/generators/cpp_templates/enum_macros.tmpl", | |
| 52 "$generator_root/generators/cpp_templates/interface_declaration.tmpl", | |
| 53 "$generator_root/generators/cpp_templates/interface_definition.tmpl", | |
| 54 "$generator_root/generators/cpp_templates/interface_macros.tmpl", | |
| 55 "$generator_root/generators/cpp_templates/interface_proxy_declaration.tmpl
", | |
| 56 "$generator_root/generators/cpp_templates/interface_request_validator_decl
aration.tmpl", | |
| 57 "$generator_root/generators/cpp_templates/interface_response_validator_dec
laration.tmpl", | |
| 58 "$generator_root/generators/cpp_templates/interface_stub_declaration.tmpl"
, | |
| 59 "$generator_root/generators/cpp_templates/module-internal.h.tmpl", | |
| 60 "$generator_root/generators/cpp_templates/module.cc.tmpl", | |
| 61 "$generator_root/generators/cpp_templates/module.h.tmpl", | |
| 62 "$generator_root/generators/cpp_templates/struct_declaration.tmpl", | |
| 63 "$generator_root/generators/cpp_templates/struct_definition.tmpl", | |
| 64 "$generator_root/generators/cpp_templates/struct_macros.tmpl", | |
| 65 "$generator_root/generators/cpp_templates/struct_serialization_declaration
.tmpl", | |
| 66 "$generator_root/generators/cpp_templates/struct_serialization_definition.
tmpl", | |
| 67 "$generator_root/generators/cpp_templates/union_declaration.tmpl", | |
| 68 "$generator_root/generators/cpp_templates/union_definition.tmpl", | |
| 69 "$generator_root/generators/cpp_templates/union_serialization_declaration.
tmpl", | |
| 70 "$generator_root/generators/cpp_templates/union_serialization_definition.t
mpl", | |
| 71 "$generator_root/generators/cpp_templates/validation_macros.tmpl", | |
| 72 "$generator_root/generators/cpp_templates/wrapper_class_declaration.tmpl", | |
| 73 "$generator_root/generators/cpp_templates/wrapper_class_definition.tmpl", | |
| 74 "$generator_root/generators/cpp_templates/wrapper_union_class_declaration.
tmpl", | |
| 75 "$generator_root/generators/cpp_templates/wrapper_union_class_definition.t
mpl", | |
| 76 "$generator_root/generators/java_templates/constant_definition.tmpl", | |
| 77 "$generator_root/generators/java_templates/constants.java.tmpl", | |
| 78 "$generator_root/generators/java_templates/data_types_definition.tmpl", | |
| 79 "$generator_root/generators/java_templates/enum_definition.tmpl", | |
| 80 "$generator_root/generators/java_templates/enum.java.tmpl", | |
| 81 "$generator_root/generators/java_templates/header.java.tmpl", | |
| 82 "$generator_root/generators/java_templates/interface_definition.tmpl", | |
| 83 "$generator_root/generators/java_templates/interface_internal.java.tmpl", | |
| 84 "$generator_root/generators/java_templates/interface.java.tmpl", | |
| 85 "$generator_root/generators/java_templates/struct.java.tmpl", | |
| 86 "$generator_root/generators/java_templates/union.java.tmpl", | |
| 87 "$generator_root/generators/js_templates/enum_definition.tmpl", | |
| 88 "$generator_root/generators/js_templates/interface_definition.tmpl", | |
| 89 "$generator_root/generators/js_templates/module.amd.tmpl", | |
| 90 "$generator_root/generators/js_templates/module_definition.tmpl", | |
| 91 "$generator_root/generators/js_templates/struct_definition.tmpl", | |
| 92 "$generator_root/generators/js_templates/union_definition.tmpl", | |
| 93 "$generator_root/generators/js_templates/validation_macros.tmpl", | |
| 94 "$generator_root/generators/mojom_cpp_generator.py", | |
| 95 "$generator_root/generators/mojom_js_generator.py", | |
| 96 "$generator_root/generators/mojom_java_generator.py", | |
| 97 "$generator_root/pylib/mojom/__init__.py", | |
| 98 "$generator_root/pylib/mojom/error.py", | |
| 99 "$generator_root/pylib/mojom/generate/__init__.py", | |
| 100 "$generator_root/pylib/mojom/generate/constant_resolver.py", | |
| 101 "$generator_root/pylib/mojom/generate/data.py", | |
| 102 "$generator_root/pylib/mojom/generate/generator.py", | |
| 103 "$generator_root/pylib/mojom/generate/module.py", | |
| 104 "$generator_root/pylib/mojom/generate/pack.py", | |
| 105 "$generator_root/pylib/mojom/generate/template_expander.py", | |
| 106 "$generator_root/pylib/mojom/parse/__init__.py", | |
| 107 "$generator_root/pylib/mojom/parse/ast.py", | |
| 108 "$generator_root/pylib/mojom/parse/lexer.py", | |
| 109 "$generator_root/pylib/mojom/parse/parser.py", | |
| 110 "$generator_root/pylib/mojom/parse/translate.py", | |
| 111 ] | |
| 112 if (defined(invoker.variant)) { | 70 if (defined(invoker.variant)) { |
| 113 variant = invoker.variant | 71 variant = invoker.variant |
| 114 generator_cpp_outputs = [ | 72 generator_cpp_outputs = [ |
| 115 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.cc", | 73 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.cc", |
| 116 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.h", | 74 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.h", |
| 117 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}-internal.h", | 75 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}-internal.h", |
| 118 ] | 76 ] |
| 119 generator_js_outputs = [] | 77 generator_js_outputs = [] |
| 120 generator_java_outputs = [] | 78 generator_java_outputs = [] |
| 121 } else { | 79 } else { |
| 122 generator_cpp_outputs = [ | 80 generator_cpp_outputs = [ |
| 123 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", | 81 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", |
| 124 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", | 82 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", |
| 125 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", | 83 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", |
| 126 ] | 84 ] |
| 127 generator_js_outputs = | 85 generator_js_outputs = |
| 128 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] | 86 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] |
| 129 generator_java_outputs = | 87 generator_java_outputs = |
| 130 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] | 88 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] |
| 131 } | 89 } |
| 132 } | 90 } |
| 133 | 91 |
| 134 if (defined(invoker.sources)) { | 92 if (defined(invoker.sources)) { |
| 135 generator_target_name = target_name + "__generator" | 93 generator_target_name = target_name + "__generator" |
| 136 action_foreach(generator_target_name) { | 94 action_foreach(generator_target_name) { |
| 137 script = generator_script | 95 script = mojom_generator_script |
| 138 inputs = generator_sources | 96 inputs = mojom_generator_sources |
| 139 sources = invoker.sources | 97 sources = invoker.sources |
| 98 deps = [ |
| 99 "//mojo/public/tools/bindings:precompile_templates", |
| 100 ] |
| 140 outputs = | 101 outputs = |
| 141 generator_cpp_outputs + generator_java_outputs + generator_js_outputs | 102 generator_cpp_outputs + generator_java_outputs + generator_js_outputs |
| 142 args = [ | 103 args = [ |
| 104 "--use_bundled_pylibs", |
| 105 "generate", |
| 143 "{{source}}", | 106 "{{source}}", |
| 144 "--use_bundled_pylibs", | |
| 145 "-d", | 107 "-d", |
| 146 rebase_path("//", root_build_dir), | 108 rebase_path("//", root_build_dir), |
| 147 "-I", | 109 "-I", |
| 148 rebase_path("//", root_build_dir), | 110 rebase_path("//", root_build_dir), |
| 149 "-o", | 111 "-o", |
| 150 rebase_path(root_gen_dir), | 112 rebase_path(root_gen_dir), |
| 113 "--bytecode_path", |
| 114 rebase_path("$root_gen_dir/mojo/public/tools/bindings"), |
| 151 ] | 115 ] |
| 152 | 116 |
| 153 if (defined(invoker.import_dirs)) { | 117 if (defined(invoker.import_dirs)) { |
| 154 foreach(import_dir, invoker.import_dirs) { | 118 foreach(import_dir, invoker.import_dirs) { |
| 155 args += [ | 119 args += [ |
| 156 "-I", | 120 "-I", |
| 157 rebase_path(import_dir, root_build_dir), | 121 rebase_path(import_dir, root_build_dir), |
| 158 ] | 122 ] |
| 159 } | 123 } |
| 160 } | 124 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 # //mojo/something:something and we can append "_java" to get the java | 265 # //mojo/something:something and we can append "_java" to get the java |
| 302 # dependency name. | 266 # dependency name. |
| 303 full_name = get_label_info(d, "label_no_toolchain") | 267 full_name = get_label_info(d, "label_no_toolchain") |
| 304 deps += [ "${full_name}_java" ] | 268 deps += [ "${full_name}_java" ] |
| 305 } | 269 } |
| 306 | 270 |
| 307 srcjar_deps = [ ":$java_srcjar_target_name" ] | 271 srcjar_deps = [ ":$java_srcjar_target_name" ] |
| 308 } | 272 } |
| 309 } | 273 } |
| 310 } | 274 } |
| OLD | NEW |