| # Copyright 2019 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/components.gni") |
| import("//build/fidl/fidl.gni") |
| import("//build/test.gni") |
| import("//build/testing/environments.gni") |
| import("//third_party/protobuf/proto_library.gni") |
| |
| static_library("fidl_codec") { |
| friend = [ ":tests" ] |
| |
| public = [ |
| "builtin_semantic.h", |
| "display_handle.h", |
| "display_options.h", |
| "encoder.h", |
| "json_visitor.h", |
| "library_loader.h", |
| "logger.h", |
| "memory_helpers.h", |
| "message_decoder.h", |
| "printer.h", |
| "proto_value.h", |
| "semantic.h", |
| "semantic_parser.h", |
| "status.h", |
| "type_visitor.h", |
| "visitor.h", |
| "wire_object.h", |
| "wire_parser.h", |
| "wire_types.h", |
| ] |
| |
| sources = [ |
| "builtin_semantic.cc", |
| "display_handle.cc", |
| "encoder.cc", |
| "library_loader.cc", |
| "logger.cc", |
| "message_decoder.cc", |
| "printer.cc", |
| "proto_value.cc", |
| "semantic.cc", |
| "semantic_parser.cc", |
| "status.cc", |
| "wire_object.cc", |
| "wire_parser.cc", |
| "wire_types.cc", |
| ] |
| |
| public_deps = [ |
| "//sdk/lib/syslog/cpp", |
| "//src/lib/fxl", |
| ] |
| deps = [ |
| ":value_proto", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_hlcpp", |
| "//sdk/lib/fidl_base", |
| "//third_party/rapidjson", |
| "//zircon/system/public", |
| ] |
| } |
| |
| proto_library("value_proto") { |
| proto_in_dir = "//" |
| |
| sources = [ "//src/lib/fidl_codec/proto/value.proto" ] |
| |
| generate_python = false |
| |
| deps = [ "//third_party/protobuf:protobuf_full" ] |
| } |
| |
| executable("fidl_codec_test_bin") { |
| testonly = true |
| sources = [ |
| "builtin_semantic_test.cc", |
| "dispatcher_test.cc", |
| "library_loader_test.cc", |
| "message_decoder_test.cc", |
| "printer_test.cc", |
| "proto_test.cc", |
| "semantic_parser_test.cc", |
| "wire_object_test.cc", |
| "wire_parser_test.cc", |
| "wire_types_test.cc", |
| ] |
| |
| deps = [ |
| ":fidl_codec", |
| ":fidl_hlcpp", |
| ":json_for_test", |
| ":list_for_test", |
| ":value_proto", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_hlcpp", |
| "//sdk/testing/fidl:test", |
| "//sdk/testing/fidl:test_support", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| "//third_party/rapidjson", |
| "//zircon/system/public:public", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_unittest_package("fidl-codec-tests") { |
| deps = [ ":fidl_codec_test_bin" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":fidl-codec-tests", |
| "rust:tests", |
| ] |
| } |
| |
| action("json_for_test") { |
| testonly = true |
| |
| deps = [ |
| ":fidl($fidl_toolchain)", |
| ":fidl-composed($fidl_toolchain)", |
| ":fidl-sys($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.io($fidl_toolchain)", |
| "//sdk/testing/fidl:frobinator($fidl_toolchain)", |
| ] |
| inputs = [ |
| "${root_build_dir}/fidling/gen/sdk/testing/fidl/frobinator.fidl.json", |
| "${root_build_dir}/fidling/gen/sdk/fidl/fuchsia.io/fuchsia.io.fidl.json", |
| "${root_build_dir}/fidling/gen/src/lib/fidl_codec/fidl.fidl.json", |
| "${root_build_dir}/fidling/gen/src/lib/fidl_codec/fidl-composed.fidl.json", |
| "${root_build_dir}/fidling/gen/src/lib/fidl_codec/fidl-sys.fidl.json", |
| ] |
| outputs = [ "${target_gen_dir}/library_loader_test_data.h" ] |
| |
| script = "generate_test_includes.sh" |
| args = [ |
| rebase_path("${target_gen_dir}/library_loader_test_data.h", |
| root_build_dir), |
| "FidlcodecExamples", |
| ] + rebase_path(inputs, root_build_dir) |
| } |
| |
| # NB: This exists because the core SDK is too large. It is a subset |
| # of FIDL definitions in core. If you need to remove a dep in this |
| # list, please add one to replace it, but make sure that you don't |
| # inflate the size of list_test_data as generated by :list_for_test |
| # too large. See https://fxbug.dev/42171835 for more detail. |
| generated_file("stripped_sdk_fidl_json") { |
| testonly = true |
| outputs = [ "$target_gen_dir/stripped_sdk_fidl_json.txt" ] |
| data_keys = [ "fidl_json" ] |
| walk_keys = [ "fidl_json_barrier" ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.bluetooth.a2dp:fuchsia.bluetooth.a2dp_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.bluetooth.sys:fuchsia.bluetooth.sys_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.component:fuchsia.component_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.component.test:fuchsia.component.test_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.component.types:fuchsia.component.types_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.data:fuchsia.data_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.feedback:fuchsia.feedback_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.input:fuchsia.input_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.inspect:fuchsia.inspect_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.logger:fuchsia.logger_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.math:fuchsia.math_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.net.interfaces:fuchsia.net.interfaces_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.process:fuchsia.process_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle_sdk($fidl_toolchain)", |
| |
| # TODO(https://fxbug.dev/42081845): Uncomment when fidlcat supports the `internal` type |
| # "//sdk/fidl/fuchsia.session:fuchsia.session_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_sdk($fidl_toolchain)", |
| "//sdk/fidl/fuchsia.url:fuchsia.url_sdk($fidl_toolchain)", |
| ] |
| } |
| |
| action("list_for_test") { |
| testonly = true |
| deps = [ ":stripped_sdk_fidl_json" ] |
| inputs = get_target_outputs(deps[0]) |
| outputs = [ "${target_gen_dir}/list_test_data.h" ] |
| depfile = "${target_gen_dir}/list_test_data.h.d" |
| script = "generate_test_includes.sh" |
| args = [ |
| rebase_path(outputs[0], root_build_dir), |
| "SdkExamples", |
| "-content", |
| rebase_path(inputs[0], root_build_dir), |
| rebase_path(depfile, root_build_dir), |
| ] |
| } |
| |
| fidl("fidl") { |
| testonly = true |
| name = "test.fidlcodec.examples" |
| |
| sources = [ |
| "testdata/empty.test.fidl", |
| "testdata/types.test.fidl", |
| "testdata/xunionmigration.fidl", |
| ] |
| |
| public_deps = [ "//zircon/vdso/zx" ] |
| |
| excluded_checks = [ "explicit-flexible-modifier" ] |
| |
| enable_hlcpp = true |
| } |
| |
| fidl("fidl-composed") { |
| testonly = true |
| name = "test.fidlcodec.composedinto" |
| |
| sources = [ "testdata/composed_into.test.fidl" ] |
| |
| public_deps = [ ":fidl" ] |
| } |
| |
| fidl("fidl-sys") { |
| testonly = true |
| name = "test.fidlcodec.sys" |
| |
| sources = [ "testdata/sys.test.fidl" ] |
| |
| public_deps = [ "//zircon/vdso/zx" ] |
| |
| excluded_checks = [ |
| "invalid-copyright-for-platform-source-library", |
| "string-bounds-not-specified", |
| "vector-bounds-not-specified", |
| ] |
| } |