| # Copyright 2021 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| import("//build/python/python_action.gni") | |
| template("protocols") { | |
| output_name = target_name | |
| if (defined(invoker.output_name)) { | |
| output_name = invoker.output_name | |
| } | |
| protocols_deps = [] | |
| if (defined(invoker.deps)) { | |
| protocols_deps += invoker.deps | |
| } | |
| generated_file = "$target_gen_dir/" + output_name | |
| libraries = [] | |
| foreach(dep, protocols_deps) { | |
| libraries += [ get_label_info(dep, "name") ] | |
| } | |
| python_action(target_name) { | |
| binary_label = "//src/developer/ffx/build:gn_generate_protocols_macro" | |
| template = "//src/developer/ffx/build/templates/protocols_macro.rs.jinja" | |
| args = [ | |
| "--template", | |
| rebase_path(template, root_build_dir), | |
| "--deps", | |
| string_join(",", libraries), | |
| "--deps_full", | |
| string_join(",", protocols_deps), | |
| "--out", | |
| rebase_path(generated_file, root_build_dir), | |
| ] | |
| inputs = [ template ] | |
| outputs = [ generated_file ] | |
| } | |
| } |