| # Copyright 2020 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/fidl/toolchain.gni") |
| import("//build/go/go_binary.gni") |
| import("//build/go/go_library.gni") |
| import("//build/host.gni") |
| import("//build/rust/fidl_rust.gni") |
| import("//build/testing/golden_files.gni") |
| import("//tools/fidl/fidlc/testdata/info.gni") |
| import("//tools/fidl/lib/fidlgentest/fidlgentest_go_test.gni") |
| |
| if (is_host) { |
| golden_files("fidlgen_rust_golden_tests") { |
| testonly = true |
| |
| formatter = { |
| script = "$rustc_prefix/bin/rustfmt" |
| inputs = [ "//rustfmt.toml" ] |
| args = [ |
| "--config-path", |
| rebase_path(inputs[0], root_build_dir), |
| ] |
| } |
| |
| deps = [] |
| comparisons = [] |
| foreach(info, fidl_testdata_info) { |
| if (info.denylist + [ "fidlgen_rust" ] - [ "fidlgen_rust" ] == |
| info.denylist) { |
| deps += [ |
| "${info.target}_rust_common_generate($fidl_toolchain)", |
| "${info.target}_rust_generate($fidl_toolchain)", |
| ] |
| _library_underscore = string_replace(info.library, ".", "_") |
| comparisons += [ |
| { |
| golden = "goldens/${info.name}.rs.golden" |
| candidate = "${info.fidl_gen_dir}/${info.target_name}/rust/fidl_${_library_underscore}.rs" |
| }, |
| { |
| golden = "goldens/${info.name}_common.rs.golden" |
| candidate = "${info.fidl_gen_dir}/${info.target_name}/rust/fidl_${_library_underscore}__common.rs" |
| }, |
| ] |
| } |
| } |
| } |
| } |
| |
| group("goldens") { |
| testonly = true |
| |
| denylist_key = "device_build_denylist" |
| if (is_host) { |
| denylist_key = "host_build_denylist" |
| } |
| |
| deps = [] |
| foreach(info, fidl_testdata_info) { |
| if (info[denylist_key] + [ "fidlgen_rust" ] - [ "fidlgen_rust" ] == |
| info[denylist_key]) { |
| deps += [ |
| "${info.target}_rust", |
| "${info.target}_rust_common", |
| ] |
| } |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fidlgen_rust_golden_tests($host_toolchain)", |
| ":goldens", |
| ":goldens($host_toolchain)", |
| "codegen:fidlgen_rust_lib_tests($host_toolchain)", |
| ] |
| } |
| |
| ## BAZEL2GN SENTINEL - DO NOT EDIT BELOW THIS LINE ## |
| # |
| # ________ _________ ________ ________ |
| # |\ ____\|\___ ___\\ __ \|\ __ \ |
| # \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \ |
| # \ \_____ \ \ \ \ \ \ \\\ \ \ ____\ |
| # \|____|\ \ \ \ \ \ \ \\\ \ \ \___| |
| # ____\_\ \ \ \__\ \ \_______\ \__\ |
| # |\_________\ \|__| \|_______|\|__| |
| # \|_________| |
| # |
| # |
| # AUTO-GENERATED - DO NOT EDIT |
| # |
| # The targets below are auto-generated based on the targets defined in the |
| # BUILD.bazel file from the same directory. If you made changes to targets in |
| # Bazel, instead of editing this file manually, run: |
| # |
| # > fx bazel2gn |
| # |
| # Please do NOT edit this file directly. Instead, edit the BUILD.bazel file and |
| # rerun bazel2gn. |
| |
| import("//build/tools/bazel2gn/bazel_migration.gni") |
| |
| # A self-verification target for generated content in this file. |
| if (is_host) { |
| verify_bazel2gn("verify_bazel2gn") { |
| } |
| } |
| |
| if (is_host) { |
| go_binary("fidlgen_rust") { |
| sources = [ "main.go" ] |
| deps = [ |
| "//tools/fidl/fidlgen_rust/codegen", |
| "//tools/fidl/lib/fidlgen", |
| ] |
| } |
| } |
| if (is_host) { |
| sdk_host_tool("fidlgen_rust_sdk") { |
| sdk_area = "FIDL" |
| category = "partner" |
| sdk_name = "fidlgen_rust" |
| deps = [ ":fidlgen_rust" ] |
| } |
| } |
| if (is_host) { |
| install_host_tools("host") { |
| deps = [ ":fidlgen_rust" ] |
| outputs = [ "fidlgen_rust" ] |
| } |
| } |