Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 # Generate C++ and JavaScript source files from mojom files. | |
| 6 template("mojom") { | |
| 7 assert(defined(invoker.sources), | |
| 8 "\"sources\" must be defined for the $target_name template.") | |
| 9 | |
| 10 generator_root = "//mojo/public/tools/bindings" | |
| 11 generator_script = "$generator_root/mojom_bindings_generator.py" | |
| 12 generator_sources = [ | |
| 13 generator_script, | |
| 14 "$generator_root/generators/cpp_templates/enum_declaration.tmpl", | |
| 15 "$generator_root/generators/cpp_templates/interface_declaration.tmpl", | |
| 16 "$generator_root/generators/cpp_templates/interface_definition.tmpl", | |
| 17 "$generator_root/generators/cpp_templates/interface_macros.tmpl", | |
| 18 "$generator_root/generators/cpp_templates/interface_proxy_declaration.tmpl", | |
| 19 "$generator_root/generators/cpp_templates/interface_stub_declaration.tmpl", | |
| 20 "$generator_root/generators/cpp_templates/module.cc.tmpl", | |
| 21 "$generator_root/generators/cpp_templates/module.h.tmpl", | |
| 22 "$generator_root/generators/cpp_templates/module-internal.h.tmpl", | |
| 23 "$generator_root/generators/cpp_templates/params_definition.tmpl", | |
| 24 "$generator_root/generators/cpp_templates/struct_builder_definition.tmpl", | |
| 25 "$generator_root/generators/cpp_templates/struct_declaration.tmpl", | |
| 26 "$generator_root/generators/cpp_templates/struct_definition.tmpl", | |
| 27 "$generator_root/generators/cpp_templates/struct_destructor.tmpl", | |
| 28 "$generator_root/generators/cpp_templates/struct_macros.tmpl", | |
| 29 "$generator_root/generators/cpp_templates/wrapper_class_declaration.tmpl", | |
| 30 "$generator_root/generators/js_templates/enum_definition.tmpl", | |
| 31 "$generator_root/generators/js_templates/interface_definition.tmpl", | |
| 32 "$generator_root/generators/js_templates/module.js.tmpl", | |
| 33 "$generator_root/generators/js_templates/struct_definition.tmpl", | |
| 34 "$generator_root/generators/mojom_cpp_generator.py", | |
| 35 "$generator_root/generators/mojom_js_generator.py", | |
| 36 "$generator_root/pylib/mojom/generate/__init__.py", | |
| 37 "$generator_root/pylib/mojom/generate/data.py", | |
| 38 "$generator_root/pylib/mojom/generate/generator.py", | |
| 39 "$generator_root/pylib/mojom/generate/module.py", | |
| 40 "$generator_root/pylib/mojom/generate/pack.py", | |
| 41 "$generator_root/pylib/mojom/generate/template_expander.py", | |
| 42 "$generator_root/pylib/mojom/parse/__init__.py", | |
| 43 "$generator_root/pylib/mojom/parse/ast.py", | |
| 44 "$generator_root/pylib/mojom/parse/lexer.py", | |
| 45 "$generator_root/pylib/mojom/parse/parser.py", | |
| 46 "$generator_root/pylib/mojom/parse/translate.py", | |
| 47 ] | |
| 48 generator_cpp_outputs = [ | |
| 49 "$target_gen_dir/{{source_name_part}}.mojom.cc", | |
| 50 "$target_gen_dir/{{source_name_part}}.mojom.h", | |
| 51 "$target_gen_dir/{{source_name_part}}.mojom-internal.h", | |
| 52 ] | |
| 53 generator_js_outputs = [ | |
| 54 "$target_gen_dir/{{source_name_part}}.mojom.js", | |
| 55 ] | |
| 56 | |
| 57 target_visibility = ":$target_name" | |
| 58 | |
| 59 generator_target_name = target_name + "_generator" | |
| 60 action_foreach(generator_target_name) { | |
| 61 visibility = target_visibility | |
| 62 hard_dep = true | |
| 63 script = generator_script | |
| 64 source_prereqs = generator_sources | |
| 65 sources = invoker.sources | |
| 66 outputs = generator_cpp_outputs + generator_js_outputs | |
| 67 args = [ | |
| 68 "{{source}}", | |
| 69 "-d", rebase_path("//", root_build_dir), | |
| 70 "-o", rebase_path(target_gen_dir, root_build_dir), | |
| 71 ] | |
| 72 } | |
| 73 | |
| 74 config_name = target_name + "_config" | |
| 75 config(config_name) { | |
| 76 visibility = target_visibility | |
| 77 include_dirs = [ root_gen_dir ] | |
|
brettw
2014/04/28 19:46:24
This should be implicit for everybody, you should
yzshen1
2014/04/28 20:40:29
Done.
| |
| 78 } | |
| 79 | |
| 80 source_set(target_name) { | |
| 81 hard_dep = true | |
| 82 sources = process_file_template(invoker.sources, generator_cpp_outputs) | |
| 83 data = process_file_template(invoker.sources, generator_js_outputs) | |
| 84 direct_dependent_configs = [ ":$config_name" ] | |
| 85 deps = [ | |
| 86 ":$generator_target_name", | |
| 87 "//mojo/public:bindings", | |
| 88 ] | |
| 89 } | |
| 90 } | |
| 91 | |
| OLD | NEW |