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 # Generate C++ and JavaScript source files from mojom files. The output files | 5 # Generate C++ and JavaScript source files from mojom files. The output files |
6 # will go under the generated file directory tree with the same path as each | 6 # will go under the generated file directory tree with the same path as each |
7 # input file. | 7 # input file. |
8 # | 8 # |
9 # Parameters: | 9 # Parameters: |
10 # | 10 # |
(...skipping 27 matching lines...) Expand all Loading... |
38 "$generator_root/generators/cpp_templates/struct_definition.tmpl", | 38 "$generator_root/generators/cpp_templates/struct_definition.tmpl", |
39 "$generator_root/generators/cpp_templates/struct_serialization_declaration.t
mpl", | 39 "$generator_root/generators/cpp_templates/struct_serialization_declaration.t
mpl", |
40 "$generator_root/generators/cpp_templates/struct_serialization_definition.tm
pl", | 40 "$generator_root/generators/cpp_templates/struct_serialization_definition.tm
pl", |
41 "$generator_root/generators/cpp_templates/struct_macros.tmpl", | 41 "$generator_root/generators/cpp_templates/struct_macros.tmpl", |
42 "$generator_root/generators/cpp_templates/wrapper_class_declaration.tmpl", | 42 "$generator_root/generators/cpp_templates/wrapper_class_declaration.tmpl", |
43 "$generator_root/generators/cpp_templates/wrapper_class_definition.tmpl", | 43 "$generator_root/generators/cpp_templates/wrapper_class_definition.tmpl", |
44 "$generator_root/generators/js_templates/enum_definition.tmpl", | 44 "$generator_root/generators/js_templates/enum_definition.tmpl", |
45 "$generator_root/generators/js_templates/interface_definition.tmpl", | 45 "$generator_root/generators/js_templates/interface_definition.tmpl", |
46 "$generator_root/generators/js_templates/module.js.tmpl", | 46 "$generator_root/generators/js_templates/module.js.tmpl", |
47 "$generator_root/generators/js_templates/struct_definition.tmpl", | 47 "$generator_root/generators/js_templates/struct_definition.tmpl", |
| 48 "$generator_root/generators/python_templates/module.py.tmpl", |
48 "$generator_root/generators/mojom_cpp_generator.py", | 49 "$generator_root/generators/mojom_cpp_generator.py", |
49 "$generator_root/generators/mojom_js_generator.py", | 50 "$generator_root/generators/mojom_js_generator.py", |
| 51 "$generator_root/generators/mojom_python_generator.py", |
50 "$generator_root/pylib/mojom/__init__.py", | 52 "$generator_root/pylib/mojom/__init__.py", |
51 "$generator_root/pylib/mojom/error.py", | 53 "$generator_root/pylib/mojom/error.py", |
52 "$generator_root/pylib/mojom/generate/__init__.py", | 54 "$generator_root/pylib/mojom/generate/__init__.py", |
53 "$generator_root/pylib/mojom/generate/data.py", | 55 "$generator_root/pylib/mojom/generate/data.py", |
54 "$generator_root/pylib/mojom/generate/generator.py", | 56 "$generator_root/pylib/mojom/generate/generator.py", |
55 "$generator_root/pylib/mojom/generate/module.py", | 57 "$generator_root/pylib/mojom/generate/module.py", |
56 "$generator_root/pylib/mojom/generate/pack.py", | 58 "$generator_root/pylib/mojom/generate/pack.py", |
57 "$generator_root/pylib/mojom/generate/template_expander.py", | 59 "$generator_root/pylib/mojom/generate/template_expander.py", |
58 "$generator_root/pylib/mojom/parse/__init__.py", | 60 "$generator_root/pylib/mojom/parse/__init__.py", |
59 "$generator_root/pylib/mojom/parse/ast.py", | 61 "$generator_root/pylib/mojom/parse/ast.py", |
60 "$generator_root/pylib/mojom/parse/lexer.py", | 62 "$generator_root/pylib/mojom/parse/lexer.py", |
61 "$generator_root/pylib/mojom/parse/parser.py", | 63 "$generator_root/pylib/mojom/parse/parser.py", |
62 "$generator_root/pylib/mojom/parse/translate.py", | 64 "$generator_root/pylib/mojom/parse/translate.py", |
63 ] | 65 ] |
64 generator_cpp_outputs = [ | 66 generator_cpp_outputs = [ |
65 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", | 67 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", |
66 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", | 68 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", |
67 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", | 69 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", |
68 ] | 70 ] |
69 generator_js_outputs = [ | 71 generator_js_outputs = [ |
70 "{{source_gen_dir}}/{{source_name_part}}.mojom.js", | 72 "{{source_gen_dir}}/{{source_name_part}}.mojom.js", |
71 ] | 73 ] |
| 74 generator_python_outputs = [ |
| 75 "{{source_gen_dir}}/{{source_name_part}}_mojom.py", |
| 76 ] |
72 | 77 |
73 target_visibility = ":$target_name" | 78 target_visibility = ":$target_name" |
74 | 79 |
75 generator_target_name = target_name + "_generator" | 80 generator_target_name = target_name + "_generator" |
76 action_foreach(generator_target_name) { | 81 action_foreach(generator_target_name) { |
77 visibility = target_visibility | 82 visibility = target_visibility |
78 script = generator_script | 83 script = generator_script |
79 inputs = generator_sources | 84 inputs = generator_sources |
80 sources = invoker.sources | 85 sources = invoker.sources |
81 outputs = generator_cpp_outputs + generator_js_outputs | 86 outputs = generator_cpp_outputs + |
| 87 generator_js_outputs + |
| 88 generator_python_outputs |
82 args = [ | 89 args = [ |
83 "{{source}}", | 90 "{{source}}", |
84 "--use_chromium_bundled_pylibs", | 91 "--use_chromium_bundled_pylibs", |
85 "-d", rebase_path("//", root_build_dir), | 92 "-d", rebase_path("//", root_build_dir), |
86 "-I", rebase_path("//", root_build_dir), | 93 "-I", rebase_path("//", root_build_dir), |
87 "-o", "{{source_gen_dir}}", | 94 "-o", "{{source_gen_dir}}", |
88 ] | 95 ] |
89 } | 96 } |
90 | 97 |
91 source_set(target_name) { | 98 source_set(target_name) { |
92 if (defined(invoker.visibility)) { | 99 if (defined(invoker.visibility)) { |
93 visibility = invoker.visibility | 100 visibility = invoker.visibility |
94 } | 101 } |
95 sources = process_file_template(invoker.sources, generator_cpp_outputs) | 102 sources = process_file_template(invoker.sources, generator_cpp_outputs) |
96 data = process_file_template(invoker.sources, generator_js_outputs) | 103 data = process_file_template(invoker.sources, generator_js_outputs) |
97 deps = [ | 104 deps = [ |
98 ":$generator_target_name", | 105 ":$generator_target_name", |
99 "//mojo/public/cpp/bindings", | 106 "//mojo/public/cpp/bindings", |
100 ] | 107 ] |
101 if (defined(invoker.deps)) { | 108 if (defined(invoker.deps)) { |
102 deps += invoker.deps | 109 deps += invoker.deps |
103 } | 110 } |
104 } | 111 } |
105 } | 112 } |
OLD | NEW |