blob: d28213dff5fc3e06c31c14006658c810684ad3f2 [file] [log] [blame]
# 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/config/clang/clang.gni")
import("//build/go/go_binary.gni")
import("//build/go/go_library.gni")
import("//build/host.gni")
import("//build/testing/golden_test.gni")
import("//tools/fidl/fidlc/testdata/info.gni")
if (is_host) {
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_method_request.tmpl.go",
"codegen/fragment_method_response.tmpl.go",
"codegen/fragment_method_response_context.tmpl.go",
"codegen/fragment_method_result.tmpl.go",
"codegen/fragment_method_unownedresult.tmpl.go",
"codegen/fragment_protocol.tmpl.go",
"codegen/fragment_protocol_details.tmpl.go",
"codegen/fragment_protocol_dispatcher.tmpl.go",
"codegen/fragment_protocol_event_handler.tmpl.go",
"codegen/fragment_protocol_interface.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_table.tmpl.go",
"codegen/fragment_union.tmpl.go",
"codegen/test_base.tmpl.go",
"main.go",
]
}
go_binary("fidlgen_llcpp") {
gopackage = "go.fuchsia.dev/fuchsia/tools/fidl/fidlgen_llcpp"
deps = [ ":gopkg" ]
}
golden_test("fidlgen_llcpp_golden_tests") {
goldens_dir = "goldens"
reformat_goldens_bin =
rebase_path("${clang_prefix}/clang-format", "", root_build_dir)
reformat_goldens_args = [ "--style=google" ]
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}/llcpp"
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"
},
{
golden = "${info.name}_test_base.h.golden"
generated = "$gen_dir/$include_path/fidl_test_base.h"
},
]
}
}
}
}
install_host_tools("host") {
deps = [ ":fidlgen_llcpp" ]
outputs = [ "fidlgen_llcpp" ]
}
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)",
]
}