| 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 import("../../mojo_sdk.gni") | 5 import("../../mojo_sdk.gni") |
| 6 | 6 |
| 7 # Generate C++/JavaScript/Java/Python/Dart/Go source files from mojom files. The | 7 # Generate C++/JavaScript/Java/Python/Dart/Go source files from mojom files. The |
| 8 # output files will go under the generated file directory tree with the same | 8 # output files will go under the generated file directory tree with the same |
| 9 # path as each input file. | 9 # path as each input file. |
| 10 # | 10 # |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 "$generator_root/generators/cpp_templates/validation_macros.tmpl", | 78 "$generator_root/generators/cpp_templates/validation_macros.tmpl", |
| 79 "$generator_root/generators/cpp_templates/wrapper_class_declaration.tmpl", | 79 "$generator_root/generators/cpp_templates/wrapper_class_declaration.tmpl", |
| 80 "$generator_root/generators/cpp_templates/wrapper_class_definition.tmpl", | 80 "$generator_root/generators/cpp_templates/wrapper_class_definition.tmpl", |
| 81 "$generator_root/generators/cpp_templates/wrapper_union_class_declaration.
tmpl", | 81 "$generator_root/generators/cpp_templates/wrapper_union_class_declaration.
tmpl", |
| 82 "$generator_root/generators/cpp_templates/wrapper_union_class_definition.t
mpl", | 82 "$generator_root/generators/cpp_templates/wrapper_union_class_definition.t
mpl", |
| 83 "$generator_root/generators/dart_templates/enum_definition.tmpl", | 83 "$generator_root/generators/dart_templates/enum_definition.tmpl", |
| 84 "$generator_root/generators/dart_templates/interface_definition.tmpl", | 84 "$generator_root/generators/dart_templates/interface_definition.tmpl", |
| 85 "$generator_root/generators/dart_templates/module.lib.tmpl", | 85 "$generator_root/generators/dart_templates/module.lib.tmpl", |
| 86 "$generator_root/generators/dart_templates/module_definition.tmpl", | 86 "$generator_root/generators/dart_templates/module_definition.tmpl", |
| 87 "$generator_root/generators/dart_templates/struct_definition.tmpl", | 87 "$generator_root/generators/dart_templates/struct_definition.tmpl", |
| 88 "$generator_root/generators/go_templates/encoding_macros.tmpl", |
| 88 "$generator_root/generators/go_templates/enum.tmpl", | 89 "$generator_root/generators/go_templates/enum.tmpl", |
| 89 "$generator_root/generators/go_templates/interface.tmpl", | 90 "$generator_root/generators/go_templates/interface.tmpl", |
| 90 "$generator_root/generators/go_templates/source.tmpl", | 91 "$generator_root/generators/go_templates/source.tmpl", |
| 91 "$generator_root/generators/go_templates/struct.tmpl", | 92 "$generator_root/generators/go_templates/struct.tmpl", |
| 93 "$generator_root/generators/go_templates/union.tmpl", |
| 92 "$generator_root/generators/java_templates/constant_definition.tmpl", | 94 "$generator_root/generators/java_templates/constant_definition.tmpl", |
| 93 "$generator_root/generators/java_templates/constants.java.tmpl", | 95 "$generator_root/generators/java_templates/constants.java.tmpl", |
| 96 "$generator_root/generators/java_templates/data_types_definition.tmpl", |
| 97 "$generator_root/generators/java_templates/enum_definition.tmpl", |
| 94 "$generator_root/generators/java_templates/enum.java.tmpl", | 98 "$generator_root/generators/java_templates/enum.java.tmpl", |
| 95 "$generator_root/generators/java_templates/enum_definition.tmpl", | |
| 96 "$generator_root/generators/java_templates/header.java.tmpl", | 99 "$generator_root/generators/java_templates/header.java.tmpl", |
| 97 "$generator_root/generators/java_templates/interface.java.tmpl", | |
| 98 "$generator_root/generators/java_templates/interface_definition.tmpl", | 100 "$generator_root/generators/java_templates/interface_definition.tmpl", |
| 99 "$generator_root/generators/java_templates/interface_internal.java.tmpl", | 101 "$generator_root/generators/java_templates/interface_internal.java.tmpl", |
| 102 "$generator_root/generators/java_templates/interface.java.tmpl", |
| 100 "$generator_root/generators/java_templates/struct.java.tmpl", | 103 "$generator_root/generators/java_templates/struct.java.tmpl", |
| 101 "$generator_root/generators/java_templates/struct_definition.tmpl", | 104 "$generator_root/generators/java_templates/union.java.tmpl", |
| 102 "$generator_root/generators/js_templates/enum_definition.tmpl", | 105 "$generator_root/generators/js_templates/enum_definition.tmpl", |
| 103 "$generator_root/generators/js_templates/interface_definition.tmpl", | 106 "$generator_root/generators/js_templates/interface_definition.tmpl", |
| 104 "$generator_root/generators/js_templates/module.amd.tmpl", | 107 "$generator_root/generators/js_templates/module.amd.tmpl", |
| 105 "$generator_root/generators/js_templates/module_definition.tmpl", | 108 "$generator_root/generators/js_templates/module_definition.tmpl", |
| 106 "$generator_root/generators/js_templates/struct_definition.tmpl", | 109 "$generator_root/generators/js_templates/struct_definition.tmpl", |
| 107 "$generator_root/generators/python_templates/module.py.tmpl", | 110 "$generator_root/generators/python_templates/module.py.tmpl", |
| 108 "$generator_root/generators/python_templates/module_macros.tmpl", | 111 "$generator_root/generators/python_templates/module_macros.tmpl", |
| 109 "$generator_root/generators/mojom_cpp_generator.py", | 112 "$generator_root/generators/mojom_cpp_generator.py", |
| 110 "$generator_root/generators/mojom_dart_generator.py", | 113 "$generator_root/generators/mojom_dart_generator.py", |
| 111 "$generator_root/generators/mojom_go_generator.py", | 114 "$generator_root/generators/mojom_go_generator.py", |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 if (defined(invoker.sources)) { | 217 if (defined(invoker.sources)) { |
| 215 public_deps += [ ":${cpp_sources_target_name}" ] | 218 public_deps += [ ":${cpp_sources_target_name}" ] |
| 216 } | 219 } |
| 217 public_deps += rebased_mojo_sdk_public_deps | 220 public_deps += rebased_mojo_sdk_public_deps |
| 218 if (defined(invoker.public_deps)) { | 221 if (defined(invoker.public_deps)) { |
| 219 public_deps += invoker.public_deps | 222 public_deps += invoker.public_deps |
| 220 } | 223 } |
| 221 | 224 |
| 222 deps = [] | 225 deps = [] |
| 223 if (defined(invoker.sources)) { | 226 if (defined(invoker.sources)) { |
| 224 deps += [ ":$generator_target_name" ] | 227 public_deps += [ ":$generator_target_name" ] |
| 225 } | 228 } |
| 226 deps += rebased_mojo_sdk_deps | 229 deps += rebased_mojo_sdk_deps |
| 227 if (defined(invoker.deps)) { | 230 if (defined(invoker.deps)) { |
| 228 deps += invoker.deps | 231 deps += invoker.deps |
| 229 } | 232 } |
| 230 data_deps = [ ":${target_name}_dart" ] | 233 data_deps = [ ":${target_name}_dart" ] |
| 231 if (defined(invoker.mojo_sdk_deps)) { | 234 if (defined(invoker.mojo_sdk_deps)) { |
| 232 foreach(sdk_dep, invoker.mojo_sdk_deps) { | 235 foreach(sdk_dep, invoker.mojo_sdk_deps) { |
| 233 # Check that the SDK dep was not mistakenly given as an absolute path. | 236 # Check that the SDK dep was not mistakenly given as an absolute path. |
| 234 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) | 237 assert(get_path_info(sdk_dep, "abspath") != sdk_dep) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 255 foreach(d, all_deps) { | 258 foreach(d, all_deps) { |
| 256 name = get_label_info(d, "label_no_toolchain") | 259 name = get_label_info(d, "label_no_toolchain") |
| 257 toolchain = get_label_info(d, "toolchain") | 260 toolchain = get_label_info(d, "toolchain") |
| 258 deps += [ "${name}__is_mojom(${toolchain})" ] | 261 deps += [ "${name}__is_mojom(${toolchain})" ] |
| 259 } | 262 } |
| 260 } | 263 } |
| 261 | 264 |
| 262 action("${target_name}_python") { | 265 action("${target_name}_python") { |
| 263 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root) | 266 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root) |
| 264 | 267 |
| 265 if (defined(invoker.sources)) { | |
| 266 inputs = process_file_template(invoker.sources, generator_python_outputs) | |
| 267 } | |
| 268 | |
| 269 deps = [] | 268 deps = [] |
| 270 zip_inputs = [] | 269 zip_inputs = [] |
| 271 | 270 |
| 271 if (defined(invoker.sources)) { |
| 272 inputs = process_file_template(invoker.sources, generator_python_outputs) |
| 273 deps += [ ":$generator_target_name" ] |
| 274 } |
| 275 |
| 272 foreach(d, all_deps) { | 276 foreach(d, all_deps) { |
| 273 # Resolve the name, so that a target //mojo/something becomes | 277 # Resolve the name, so that a target //mojo/something becomes |
| 274 # //mojo/something:something and we can append "_python" to get the python | 278 # //mojo/something:something and we can append "_python" to get the python |
| 275 # dependency name. | 279 # dependency name. |
| 276 full_name = get_label_info(d, "label_no_toolchain") | 280 full_name = get_label_info(d, "label_no_toolchain") |
| 277 dep_name = get_label_info(d, "name") | 281 dep_name = get_label_info(d, "name") |
| 278 dep_target_out_dir = get_label_info(d, "target_out_dir") | 282 dep_target_out_dir = get_label_info(d, "target_out_dir") |
| 279 deps += [ "${full_name}_python" ] | 283 deps += [ "${full_name}_python" ] |
| 280 zip_inputs += [ "$dep_target_out_dir/${dep_name}_python.pyzip" ] | 284 zip_inputs += [ "$dep_target_out_dir/${dep_name}_python.pyzip" ] |
| 281 } | 285 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 297 "--output=$rebase_output", | 301 "--output=$rebase_output", |
| 298 ] | 302 ] |
| 299 if (defined(invoker.sources)) { | 303 if (defined(invoker.sources)) { |
| 300 args += [ "--inputs=$rebase_inputs" ] | 304 args += [ "--inputs=$rebase_inputs" ] |
| 301 } | 305 } |
| 302 } | 306 } |
| 303 | 307 |
| 304 action("${target_name}_dart") { | 308 action("${target_name}_dart") { |
| 305 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root) | 309 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root) |
| 306 | 310 |
| 307 if (defined(invoker.sources)) { | |
| 308 inputs = process_file_template(invoker.sources, generator_dart_outputs) | |
| 309 } | |
| 310 | |
| 311 deps = [] | 311 deps = [] |
| 312 zip_inputs = [] | 312 zip_inputs = [] |
| 313 | 313 |
| 314 if (defined(invoker.sources)) { |
| 315 inputs = process_file_template(invoker.sources, generator_dart_outputs) |
| 316 deps += [ ":$generator_target_name" ] |
| 317 } |
| 318 |
| 314 foreach(d, all_deps) { | 319 foreach(d, all_deps) { |
| 315 # Resolve the name, so that a target //mojo/something becomes | 320 # Resolve the name, so that a target //mojo/something becomes |
| 316 # //mojo/something:something and we can append "_dart" to get the dart | 321 # //mojo/something:something and we can append "_dart" to get the dart |
| 317 # dependency name. | 322 # dependency name. |
| 318 full_name = get_label_info(d, "label_no_toolchain") | 323 full_name = get_label_info(d, "label_no_toolchain") |
| 319 dep_name = get_label_info(d, "name") | 324 dep_name = get_label_info(d, "name") |
| 320 dep_target_out_dir = get_label_info(d, "target_out_dir") | 325 dep_target_out_dir = get_label_info(d, "target_out_dir") |
| 321 deps += [ "${full_name}_dart" ] | 326 deps += [ "${full_name}_dart" ] |
| 322 zip_inputs += [ "$dep_target_out_dir/$dep_name.dartzip" ] | 327 zip_inputs += [ "$dep_target_out_dir/$dep_name.dartzip" ] |
| 323 } | 328 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 # //mojo/something:something and we can append "_java" to get the java | 412 # //mojo/something:something and we can append "_java" to get the java |
| 408 # dependency name. | 413 # dependency name. |
| 409 full_name = get_label_info(d, "label_no_toolchain") | 414 full_name = get_label_info(d, "label_no_toolchain") |
| 410 deps += [ "${full_name}_java" ] | 415 deps += [ "${full_name}_java" ] |
| 411 } | 416 } |
| 412 | 417 |
| 413 srcjar_deps = [ ":$java_srcjar_target_name" ] | 418 srcjar_deps = [ ":$java_srcjar_target_name" ] |
| 414 } | 419 } |
| 415 } | 420 } |
| 416 } | 421 } |
| OLD | NEW |