| template("wayland_protocol_codegen") { |
| assert(defined(invoker.template), |
| "Need template for for wayland_protocol_codegen") |
| assert(defined(invoker.sources), |
| "Need sources for for wayland_protocol_codegen") |
| assert(defined(invoker.output_pattern), |
| "Need output_pattern for for wayland_protocol_codegen") |
| |
| # If the invoker sets "reduce=true", we are generating a single output from |
| # all the source protocols. |
| if (defined(invoker.reduce) && invoker.reduce) { |
| action = "action" |
| } else { |
| action = "action_foreach" |
| } |
| |
| target(action, target_name) { |
| forward_variables_from(invoker, |
| [ |
| "data", |
| "data_deps", |
| "depfile", |
| "deps", |
| "metadata", |
| "pool", |
| "response_file_contents", |
| "sources", |
| "testonly", |
| ]) |
| |
| script = "//components/exo/wayland/compatibility_test/wayland_protocol_codegen.py" |
| inputs = [ invoker.template ] |
| outputs = [ invoker.output_pattern ] |
| |
| clang_format_path = "//third_party/depot_tools/clang-format" |
| |
| args = [ |
| rebase_path("//third_party", root_build_dir), |
| rebase_path(clang_format_path, root_build_dir), |
| rebase_path(invoker.template, root_build_dir), |
| rebase_path(invoker.output_pattern, root_build_dir), |
| ] |
| if (defined(invoker.reduce) && invoker.reduce) { |
| args += rebase_path(sources, root_build_dir) |
| } else { |
| args += [ "{{source}}" ] |
| } |
| } |
| } |