blob: 55092dec8db420d2d5358ce46a496a81f16a0c7f [file] [log] [blame]
# Copyright 2018 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/cpp/sdk_source_set.gni")
import("//build/fidl/fidl.gni")
import("//build/fidl/wireformat.gni")
import("//build/package.gni")
import("//build/test.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
import("//src/tests/fidl/conformance_suite/gidl-conformance-suite.gni")
import("//tools/fidl/gidl/gidl.gni")
sdk_source_set("cpp") {
category = "partner"
sdk_name = "fidl_cpp"
sources = [
"binding.h",
"binding_set.h",
"enum.h",
"event_sender.h",
"interface_ptr.h",
"interface_ptr_set.h",
"internal/header.h",
"internal/implementation.h",
"internal/message_handler.cc",
"internal/message_handler.h",
"internal/message_reader.cc",
"internal/message_reader.h",
"internal/pending_response.cc",
"internal/pending_response.h",
"internal/proxy.cc",
"internal/proxy.h",
"internal/proxy_controller.cc",
"internal/proxy_controller.h",
"internal/stub.cc",
"internal/stub.h",
"internal/stub_controller.cc",
"internal/stub_controller.h",
"internal/weak_stub_controller.cc",
"internal/weak_stub_controller.h",
"member_connector.h",
"optional.h",
"service_connector.h",
"service_handler_base.h",
"thread_safe_binding_set.h",
"type_converter.h",
]
include_base = "//sdk"
public_deps = [
":cpp_sync",
"//zircon/public/lib/async",
"//zircon/public/lib/async-default",
"//zircon/public/lib/fidl",
"//zircon/public/lib/fidl-async",
"//zircon/public/lib/fit",
"//zircon/public/lib/zx",
]
public_configs = [ "//sdk/config" ]
}
sdk_source_set("cpp_sync") {
category = "partner"
sdk_name = "fidl_cpp_sync"
sources = [
"interface_handle.h",
"interface_request.h",
"internal/message_sender.cc",
"internal/message_sender.h",
"internal/synchronous_proxy.cc",
"internal/synchronous_proxy.h",
"synchronous_interface_ptr.h",
]
include_base = "//sdk"
public_configs = [ "//sdk/config" ]
public_deps = [
":cpp_base",
"//zircon/public/lib/fidl",
"//zircon/public/lib/fidl-async",
"//zircon/public/lib/fit",
"//zircon/public/lib/zx",
]
}
sdk_source_set("cpp_base") {
category = "partner"
sdk_name = "fidl_cpp_base"
sources = [
"clone.cc",
"clone.h",
"coding_traits.h",
"comparison.h",
"decoder.cc",
"decoder.h",
"encoder.cc",
"encoder.h",
"internal/logging.cc",
"internal/logging.h",
"object_coding.h",
"string.h",
"traits.h",
"transition.h",
"vector.h",
]
include_base = "//sdk"
public_configs = [ "//sdk/config" ]
public_deps = [
"//zircon/public/lib/fidl_base",
"//zircon/public/lib/fit",
]
if (is_fuchsia) {
public_deps += [
"//zircon/public/lib/fidl-async",
"//zircon/public/lib/zx",
]
}
}
source_set("test_util") {
testonly = true
sources = [
"test/test_util.cc",
"test/test_util.h",
]
public_deps = [ ":cpp_base" ]
}
source_set("test_support") {
testonly = true
public = [ "test/async_loop_for_test.h" ]
public_deps = [ "//zircon/public/lib/async" ]
}
fidl("fidl_test") {
name = "fidl.test.misc"
testonly = true
sources = [ "fidl_test.test.fidl" ]
}
gidl_cpp("conformance_test_sources") {
testonly = true
type = "conformance"
inputs = conformance_suite_gidl_files
fidl = conformance_suite_fidl_target
deps = [
":test_util",
"//third_party/googletest:gtest",
]
}
source_set("host_test_sources") {
testonly = true
sources = [
"array_unittest.cc",
"bits_unittest.cc",
"clone_unittest.cc",
"defaults_unittest.cc",
"fidl_test.cc",
"object_coding_unittest.cc",
"roundtrip_test.cc",
"string_unittest.cc",
"table_unittest.cc",
"vector_unittest.cc",
"xunion_unittest.cc",
]
deps = [
":cpp_base",
":fidl_test",
":test_util",
"//third_party/googletest:gtest",
]
if (fidl_write_v1_wireformat) {
defines = [ "FIDL_EXPERIMENTAL_WRITE_V1_WIREFORMAT_DISABLE_TEST" ]
}
}
source_set("test_sources") {
testonly = true
# TODO(jamesr): Make this an sdk source set
# sdk_name = "fidl_cpp_tests"
# include_base = "//sdk"
sources = [
"binding_set_unittest.cc",
"binding_unittest.cc",
"collision_unittest.cc",
"encode_decode_unittest.cc",
"event_sender_unittest.cc",
"interface_handle_unittest.cc",
"interface_ptr_set_unittest.cc",
"interface_ptr_unittest.cc",
"interface_request_unittest.cc",
"internal/message_reader_unittest.cc",
"internal/proxy_controller_unittest.cc",
"internal/stub_controller_unittest.cc",
"synchronous_interface_ptr_unittest.cc",
"thread_safe_binding_set_unittest.cc",
"transformer_integration_unittest.cc",
]
deps = [
":cpp",
":example",
":fidl_test",
":test_support",
":test_util",
":transformerintegration.test",
":union_migration_test_fidl",
"//sdk/lib/fidl/cpp/test",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-loop",
"//zircon/public/lib/async-loop-default",
]
public_configs = [ "//sdk/config" ]
}
executable("conformance_test") {
testonly = true
sources = [ "test/async_loop_for_test.cc" ]
deps = [
":conformance_test_sources",
":test_support",
"//sdk/lib/fidl/cpp/test",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-loop-cpp",
"//zircon/public/lib/async-loop-default",
"//zircon/public/lib/fbl",
]
}
executable("fidl_cpp_unittests") {
testonly = true
sources = [ "test/async_loop_for_test.cc" ]
deps = [
":host_test_sources",
":test_sources",
":test_support",
"//sdk/lib/fidl/cpp/test",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-loop-cpp",
"//zircon/public/lib/async-loop-default",
"//zircon/public/lib/fbl",
]
}
unittest_package("fidl_tests") {
deps = [
":conformance_test",
":fidl_cpp_unittests",
]
tests = [
{
name = "fidl_cpp_unittests"
environments = basic_envs
},
{
name = "conformance_test"
environments = basic_envs
},
]
}
if (is_linux || is_mac) {
test("fidl_cpp_host_unittests") {
deps = [
":host_test_sources",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gtest",
]
}
}
if (is_linux || is_mac) {
test("fidl_cpp_host_conformance_test") {
deps = [
":conformance_test_sources",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gtest",
]
}
}
# group("host_tests") {
# deps = [
# ":fidl_cpp_host_conformance_test($host_toolchain)",
# ":fidl_cpp_host_unittests($host_toolchain)",
# ]
# testonly = true
# }
fidl("union_migration_test_fidl") {
name = "fidl.test.unionmigration"
sources = [ "union_migration.test.fidl" ]
}
fidl("example") {
sources = [ "transformer_integration_example_lib.test.fidl" ]
}
fidl("transformerintegration.test") {
sources = [ "transformer_integration.test.fidl" ]
public_deps = [ ":example" ]
}