1# Copyright 2016 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
5import("//mojo/public/tools/bindings/mojom.gni")
6import("//third_party/jinja2/jinja2.gni")
7
8action("precompile_templates") {
9  sources = mojom_generator_sources
10  sources += [
11    "$mojom_generator_root/generators/cpp_templates/enum_macros.tmpl",
12    "$mojom_generator_root/generators/cpp_templates/enum_serialization_declaration.tmpl",
13    "$mojom_generator_root/generators/cpp_templates/interface_declaration.tmpl",
14    "$mojom_generator_root/generators/cpp_templates/interface_definition.tmpl",
15    "$mojom_generator_root/generators/cpp_templates/interface_macros.tmpl",
16    "$mojom_generator_root/generators/cpp_templates/interface_proxy_declaration.tmpl",
17    "$mojom_generator_root/generators/cpp_templates/interface_request_validator_declaration.tmpl",
18    "$mojom_generator_root/generators/cpp_templates/interface_response_validator_declaration.tmpl",
19    "$mojom_generator_root/generators/cpp_templates/interface_stub_declaration.tmpl",
20    "$mojom_generator_root/generators/cpp_templates/module-shared-internal.h.tmpl",
21    "$mojom_generator_root/generators/cpp_templates/module-shared-message-ids.h.tmpl",
22    "$mojom_generator_root/generators/cpp_templates/module-shared.cc.tmpl",
23    "$mojom_generator_root/generators/cpp_templates/module-shared.h.tmpl",
24    "$mojom_generator_root/generators/cpp_templates/module.cc.tmpl",
25    "$mojom_generator_root/generators/cpp_templates/module.h.tmpl",
26    "$mojom_generator_root/generators/cpp_templates/struct_data_view_declaration.tmpl",
27    "$mojom_generator_root/generators/cpp_templates/struct_data_view_definition.tmpl",
28    "$mojom_generator_root/generators/cpp_templates/struct_declaration.tmpl",
29    "$mojom_generator_root/generators/cpp_templates/struct_definition.tmpl",
30    "$mojom_generator_root/generators/cpp_templates/struct_macros.tmpl",
31    "$mojom_generator_root/generators/cpp_templates/struct_serialization_declaration.tmpl",
32    "$mojom_generator_root/generators/cpp_templates/struct_traits_declaration.tmpl",
33    "$mojom_generator_root/generators/cpp_templates/struct_traits_definition.tmpl",
34    "$mojom_generator_root/generators/cpp_templates/struct_unserialized_message_context.tmpl",
35    "$mojom_generator_root/generators/cpp_templates/union_data_view_declaration.tmpl",
36    "$mojom_generator_root/generators/cpp_templates/union_data_view_definition.tmpl",
37    "$mojom_generator_root/generators/cpp_templates/union_declaration.tmpl",
38    "$mojom_generator_root/generators/cpp_templates/union_definition.tmpl",
39    "$mojom_generator_root/generators/cpp_templates/union_serialization_declaration.tmpl",
40    "$mojom_generator_root/generators/cpp_templates/union_traits_declaration.tmpl",
41    "$mojom_generator_root/generators/cpp_templates/union_traits_definition.tmpl",
42    "$mojom_generator_root/generators/cpp_templates/validation_macros.tmpl",
43    "$mojom_generator_root/generators/cpp_templates/wrapper_class_declaration.tmpl",
44    "$mojom_generator_root/generators/cpp_templates/wrapper_class_definition.tmpl",
45    "$mojom_generator_root/generators/cpp_templates/wrapper_class_template_definition.tmpl",
46    "$mojom_generator_root/generators/cpp_templates/wrapper_union_class_declaration.tmpl",
47    "$mojom_generator_root/generators/cpp_templates/wrapper_union_class_definition.tmpl",
48    "$mojom_generator_root/generators/cpp_templates/wrapper_union_class_template_definition.tmpl",
49    "$mojom_generator_root/generators/java_templates/constant_definition.tmpl",
50    "$mojom_generator_root/generators/java_templates/constants.java.tmpl",
51    "$mojom_generator_root/generators/java_templates/data_types_definition.tmpl",
52    "$mojom_generator_root/generators/java_templates/enum.java.tmpl",
53    "$mojom_generator_root/generators/java_templates/enum_definition.tmpl",
54    "$mojom_generator_root/generators/java_templates/header.java.tmpl",
55    "$mojom_generator_root/generators/java_templates/interface.java.tmpl",
56    "$mojom_generator_root/generators/java_templates/interface_definition.tmpl",
57    "$mojom_generator_root/generators/java_templates/interface_internal.java.tmpl",
58    "$mojom_generator_root/generators/java_templates/struct.java.tmpl",
59    "$mojom_generator_root/generators/java_templates/union.java.tmpl",
60    "$mojom_generator_root/generators/js_templates/enum_definition.tmpl",
61    "$mojom_generator_root/generators/js_templates/externs/interface_definition.tmpl",
62    "$mojom_generator_root/generators/js_templates/externs/module.externs.tmpl",
63    "$mojom_generator_root/generators/js_templates/externs/struct_definition.tmpl",
64    "$mojom_generator_root/generators/js_templates/fuzzing.tmpl",
65    "$mojom_generator_root/generators/js_templates/interface_definition.tmpl",
66    "$mojom_generator_root/generators/js_templates/module.amd.tmpl",
67    "$mojom_generator_root/generators/js_templates/module_definition.tmpl",
68    "$mojom_generator_root/generators/js_templates/struct_definition.tmpl",
69    "$mojom_generator_root/generators/js_templates/union_definition.tmpl",
70    "$mojom_generator_root/generators/js_templates/validation_macros.tmpl",
71  ]
72  script = mojom_generator_script
73
74  inputs = jinja2_sources
75  outputs = [
76    "$target_gen_dir/cpp_templates.zip",
77    "$target_gen_dir/java_templates.zip",
78    "$target_gen_dir/js_templates.zip",
79  ]
80  args = [
81    "--use_bundled_pylibs",
82    "precompile",
83    "-o",
84    rebase_path(target_gen_dir, root_build_dir),
85  ]
86}
87