blob: 1ba8884b46ef9026b2829910198c02754f4cd962 [file] [log] [blame] [edit]
# 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/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_llcpp/..."
deps = [
"//tools/fidl/lib/fidlgen",
"//tools/fidl/lib/fidlgen_cpp",
]
sources = [
"codegen/codegen.go",
"codegen/file_header.tmpl.go",
"codegen/file_source.tmpl.go",
"codegen/fragment_bits.tmpl.go",
"codegen/fragment_client.tmpl.go",
"codegen/fragment_client_async_methods.tmpl.go",
"codegen/fragment_client_sync_methods.tmpl.go",
"codegen/fragment_const.tmpl.go",
"codegen/fragment_enum.tmpl.go",
"codegen/fragment_event_sender.tmpl.go",
"codegen/fragment_protocol.tmpl.go",
"codegen/fragment_reply_caller_allocate.tmpl.go",
"codegen/fragment_reply_managed.tmpl.go",
"codegen/fragment_service.tmpl.go",
"codegen/fragment_struct.tmpl.go",
"codegen/fragment_sync_event_handler.tmpl.go",
"codegen/fragment_sync_request_caller_allocate.tmpl.go",
"codegen/fragment_sync_request_managed.tmpl.go",
"codegen/fragment_sync_server.tmpl.go",
"codegen/fragment_table.tmpl.go",
"codegen/fragment_type.tmpl.go",
"codegen/fragment_union.tmpl.go",
"main.go",
]
}
go_binary("fidlgen_llcpp") {
gopackage = "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_llcpp"
deps = [ ":gopkg" ]
}
install_host_tools("host") {
deps = [ ":fidlgen_llcpp" ]
outputs = [ "fidlgen_llcpp" ]
}
golden_test("fidlgen_llcpp_golden_tests") {
goldens_dir = "goldens"
deps = []
entries = []
foreach(info, fidl_testdata_info) {
if (info.denylist + [ "fidlgen_llcpp" ] - [ "fidlgen_llcpp" ] ==
info.denylist) {
deps += [ "${info.target}_llcpp_generate($fidl_toolchain)" ]
gen_dir = "${info.fidl_gen_dir}/${info.target_name}"
include_path = string_replace(info.library, ".", "/") + "/llcpp"
entries += [
{
golden = "${info.name}.h.golden"
generated = "$gen_dir/$include_path/fidl.h"
},
{
golden = "${info.name}.cc.golden"
generated = "$gen_dir/$include_path/fidl.cc"
},
]
}
}
}
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_llcpp" ] - [ "fidlgen_llcpp" ] ==
info[denylist_key]) {
deps += [ "${info.target}_llcpp" ]
}
}
}
group("tests") {
testonly = true
deps = [
":fidlgen_llcpp_golden_tests($host_toolchain)",
":goldens",
":goldens($host_toolchain)",
]
}