| # 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/package.gni") | 
 | import("//build/test.gni") | 
 | import("//build/test/test_package.gni") | 
 | import("//build/testing/environments.gni") | 
 | import("//src/sys/build/components.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/bitset.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/fidl", | 
 |     "//zircon/public/lib/fit", | 
 |     "//zircon/public/lib/zx", | 
 |     "//zircon/system/ulib/async-default", | 
 |   ] | 
 |  | 
 |   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/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", | 
 |     "types.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/zx" ] | 
 |   } | 
 | } | 
 |  | 
 | source_set("test_util") { | 
 |   testonly = true | 
 |  | 
 |   sources = [ "test/test_util.h" ] | 
 |  | 
 |   public_deps = [ ":cpp_base" ] | 
 | } | 
 |  | 
 | source_set("handle_util") { | 
 |   testonly = true | 
 |  | 
 |   sources = [ | 
 |     "test/handle_util.cc", | 
 |     "test/handle_util.h", | 
 |   ] | 
 |  | 
 |   public_deps = [ "//zircon/public/lib/zx" ] | 
 | } | 
 |  | 
 | source_set("test_support") { | 
 |   testonly = true | 
 |  | 
 |   public = [ "test/async_loop_for_test.h" ] | 
 |  | 
 |   public_deps = [ "//zircon/public/lib/async" ] | 
 | } | 
 |  | 
 | gidl_hlcpp_conformance("conformance_test_sources") { | 
 |   testonly = true | 
 |   inputs = conformance_suite_gidl_files | 
 |   fidl = conformance_suite_fidl_target | 
 |   deps = [ | 
 |     ":test_util", | 
 |     "//third_party/googletest:gtest", | 
 |   ] | 
 |   if (is_fuchsia) { | 
 |     deps += [ ":handle_util" ] | 
 |   } | 
 | } | 
 |  | 
 | source_set("host_test_sources") { | 
 |   testonly = true | 
 |  | 
 |   sources = [ | 
 |     "array_unittest.cc", | 
 |     "bits_unittest.cc", | 
 |     "clone_unittest.cc", | 
 |     "comparison_unittest.cc", | 
 |     "defaults_unittest.cc", | 
 |     "fidl_test.cc", | 
 |     "internal/bitset_unittest.cc", | 
 |     "object_coding_unittest.cc", | 
 |     "roundtrip_test.cc", | 
 |     "string_unittest.cc", | 
 |     "table_unittest.cc", | 
 |     "vector_unittest.cc", | 
 |     "xunion_unittest.cc", | 
 |   ] | 
 |  | 
 |   deps = [ | 
 |     ":cpp_base", | 
 |     ":test_util", | 
 |     "test:fidl_test", | 
 |     "//third_party/googletest:gtest", | 
 |   ] | 
 | } | 
 |  | 
 | 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", | 
 |     "xunion_handles_unittest.cc", | 
 |   ] | 
 |  | 
 |   deps = [ | 
 |     ":cpp", | 
 |     ":test_support", | 
 |     ":test_util", | 
 |     ":union_migration_test_fidl", | 
 |     "test:collision_test", | 
 |     "test:fidl_test", | 
 |     "//sdk/lib/fidl/cpp/test", | 
 |     "//third_party/googletest:gtest", | 
 |     "//zircon/system/ulib/async-loop", | 
 |     "//zircon/system/ulib/async-loop:async-loop-cpp", | 
 |     "//zircon/system/ulib/async-loop:async-loop-default", | 
 |   ] | 
 |  | 
 |   public_configs = [ "//sdk/config" ] | 
 | } | 
 |  | 
 | executable("fidl_hlcpp_conformance_test") { | 
 |   visibility = [ ":*" ] | 
 |   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/fbl", | 
 |     "//zircon/system/ulib/async-loop:async-loop-cpp", | 
 |     "//zircon/system/ulib/async-loop:async-loop-default", | 
 |   ] | 
 | } | 
 |  | 
 | fuchsia_unittest_component("fidl-hlcpp-conformance-test") { | 
 |   visibility = [ ":*" ] | 
 |   executable_path = "bin/fidl_hlcpp_conformance_test" | 
 |   deps = [ ":fidl_hlcpp_conformance_test" ] | 
 | } | 
 |  | 
 | executable("fidl_hlcpp_unit_tests") { | 
 |   visibility = [ ":*" ] | 
 |   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/fbl", | 
 |     "//zircon/system/ulib/async-loop:async-loop-cpp", | 
 |     "//zircon/system/ulib/async-loop:async-loop-default", | 
 |   ] | 
 | } | 
 |  | 
 | fuchsia_unittest_component("fidl-hlcpp-unit-tests") { | 
 |   visibility = [ ":*" ] | 
 |   executable_path = "bin/fidl_hlcpp_unit_tests" | 
 |   deps = [ ":fidl_hlcpp_unit_tests" ] | 
 | } | 
 |  | 
 | fuchsia_test_package("fidl-hlcpp-tests") { | 
 |   test_components = [ | 
 |     ":fidl-hlcpp-conformance-test", | 
 |     ":fidl-hlcpp-unit-tests", | 
 |   ] | 
 | } | 
 |  | 
 | 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" ] | 
 | } |