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. | 5 # Generate C++ and JavaScript source files from mojom files. |
6 template("mojom") { | 6 template("mojom") { |
7 assert(defined(invoker.sources), | 7 assert(defined(invoker.sources), |
8 "\"sources\" must be defined for the $target_name template.") | 8 "\"sources\" must be defined for the $target_name template.") |
9 | 9 |
10 generator_root = "//mojo/public/tools/bindings" | 10 generator_root = "//mojo/public/tools/bindings" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 generator_js_outputs = [ | 58 generator_js_outputs = [ |
59 "$target_gen_dir/{{source_name_part}}.mojom.js", | 59 "$target_gen_dir/{{source_name_part}}.mojom.js", |
60 ] | 60 ] |
61 | 61 |
62 target_visibility = ":$target_name" | 62 target_visibility = ":$target_name" |
63 | 63 |
64 generator_target_name = target_name + "_generator" | 64 generator_target_name = target_name + "_generator" |
65 action_foreach(generator_target_name) { | 65 action_foreach(generator_target_name) { |
66 visibility = target_visibility | 66 visibility = target_visibility |
67 script = generator_script | 67 script = generator_script |
68 source_prereqs = generator_sources | 68 inputs = generator_sources |
69 sources = invoker.sources | 69 sources = invoker.sources |
70 outputs = generator_cpp_outputs + generator_js_outputs | 70 outputs = generator_cpp_outputs + generator_js_outputs |
71 args = [ | 71 args = [ |
72 "{{source}}", | 72 "{{source}}", |
73 "--use_chromium_bundled_pylibs", | 73 "--use_chromium_bundled_pylibs", |
74 "-d", rebase_path("//", root_build_dir), | 74 "-d", rebase_path("//", root_build_dir), |
75 "-I", rebase_path("//", root_build_dir), | 75 "-I", rebase_path("//", root_build_dir), |
76 "-o", rebase_path(target_gen_dir, root_build_dir), | 76 "-o", rebase_path(target_gen_dir, root_build_dir), |
77 ] | 77 ] |
78 } | 78 } |
79 | 79 |
80 source_set(target_name) { | 80 source_set(target_name) { |
81 if (defined(invoker.visibility)) { | 81 if (defined(invoker.visibility)) { |
82 visibility = invoker.visibility | 82 visibility = invoker.visibility |
83 } | 83 } |
84 sources = process_file_template(invoker.sources, generator_cpp_outputs) | 84 sources = process_file_template(invoker.sources, generator_cpp_outputs) |
85 data = process_file_template(invoker.sources, generator_js_outputs) | 85 data = process_file_template(invoker.sources, generator_js_outputs) |
86 deps = [ | 86 deps = [ |
87 ":$generator_target_name", | 87 ":$generator_target_name", |
88 "//mojo/public/cpp/bindings", | 88 "//mojo/public/cpp/bindings", |
89 ] | 89 ] |
90 if (defined(invoker.deps)) { | 90 if (defined(invoker.deps)) { |
91 deps += invoker.deps | 91 deps += invoker.deps |
92 } | 92 } |
93 } | 93 } |
94 } | 94 } |
OLD | NEW |