| # 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/go/go_binary.gni") |
| import("//build/go/go_library.gni") |
| import("//build/go/go_test.gni") |
| import("//build/go/toolchain.gni") |
| import("//build/host.gni") |
| import("//build/testing/golden_test.gni") |
| import("//zircon/tools/fidl/testdata/info.gni") |
| |
| go_library("gopkg") { |
| name = "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_go/..." |
| deps = [ "//tools/fidl/lib/fidlgen" ] |
| sources = [ |
| "codegen/bits.tmpl.go", |
| "codegen/codegen.go", |
| "codegen/enum.tmpl.go", |
| "codegen/ir.go", |
| "codegen/ir_test.go", |
| "codegen/library.tmpl.go", |
| "codegen/protocol.tmpl.go", |
| "codegen/struct.tmpl.go", |
| "codegen/table.tmpl.go", |
| "codegen/union.tmpl.go", |
| "main.go", |
| ] |
| } |
| |
| go_binary("fidlgen_go") { |
| gopackage = "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_go" |
| |
| sdk_category = "partner" |
| deps = [ ":gopkg" ] |
| } |
| |
| install_host_tools("host") { |
| deps = [ ":fidlgen_go" ] |
| outputs = [ "fidlgen_go" ] |
| } |
| |
| go_test("fidlgen_go_lib_tests") { |
| gopackages = [ "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_go/codegen" ] |
| deps = [ ":gopkg" ] |
| } |
| |
| golden_test("fidlgen_go_golden_tests") { |
| goldens_dir = "goldens" |
| deps = [] |
| entries = [] |
| foreach(info, fidl_testdata_info) { |
| if (info.denylist + [ "fidlgen_go" ] - [ "fidlgen_go" ] == info.denylist) { |
| deps += [ "${info.target}_go_generate($go_toolchain)" ] |
| entries += [ |
| { |
| golden = "${info.name}.go.golden" |
| generated = "${info.fidl_gen_dir}/${info.target_name}/${info.library}.fidl/impl.go" |
| }, |
| ] |
| } |
| } |
| } |
| |
| group("goldens") { |
| testonly = true |
| |
| deps = [] |
| foreach(info, fidl_testdata_info) { |
| if (info.build_denylist + [ "fidlgen_go" ] - [ "fidlgen_go" ] == |
| info.build_denylist) { |
| deps += [ info.target ] |
| } |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fidlgen_go_golden_tests($host_toolchain)", |
| ":fidlgen_go_lib_tests($host_toolchain)", |
| ":goldens($go_toolchain)", |
| ] |
| } |