| # Copyright 2024 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/rust/rustc_library.gni") |
| import("//build/rust/rustc_test.gni") |
| |
| rustc_library("fidl_next_bind") { |
| edition = "2021" |
| sources = [ |
| "src/client.rs", |
| "src/decoded.rs", |
| "src/endpoint.rs", |
| "src/error.rs", |
| "src/executor.rs", |
| "src/future/mod.rs", |
| "src/future/send.rs", |
| "src/future/two_way.rs", |
| "src/lib.rs", |
| "src/protocol.rs", |
| "src/server.rs", |
| "src/service.rs", |
| ] |
| deps = [ |
| "//src/lib/fidl/rust_next/fidl_next_codec", |
| "//src/lib/fidl/rust_next/fidl_next_protocol", |
| "//third_party/rust_crates:pin-project", |
| "//third_party/rust_crates:thiserror", |
| ] |
| features = [] |
| |
| # Enables compatibility impls with the existing Rust bindings. |
| # This can be removed once we no longer require backwards compatibility. |
| features += [ "compat" ] |
| sources += [ "src/compat.rs" ] |
| deps += [ "//src/lib/fidl/rust/fidl" ] |
| |
| # Enables support for fuchsia-async. |
| # This feature _should_ be named `fuchsia_async`, but our cargo manifest |
| # generator doesn't support features with the same name as mandatory |
| # dependencies. |
| features += [ "fasync" ] |
| sources += [ "src/fuchsia_async.rs" ] |
| deps += [ "//src/lib/fuchsia-async" ] |
| |
| if (is_fuchsia) { |
| sources += [ "src/fuchsia.rs" ] |
| deps += [ "//sdk/rust/zx" ] |
| features += [ "fuchsia" ] |
| } |
| |
| with_unit_tests = true |
| |
| # NOTE: this library is still experimental |
| visibility = [ |
| "//:developer_universe_packages", |
| "//sdk/lib/driver/*", |
| "//src/lib/fidl/rust_next/*", |
| "//tools/fidl/fidlc/testdata/*", |
| "//tools/fidl/fidlgen_rust_next/*", |
| ] |
| } |
| |
| fuchsia_unittest_package("fidl_next_bind_test_package") { |
| deps = [ ":fidl_next_bind_test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fidl_next_bind_test($host_toolchain)", |
| # TODO: fix and re-enable device-side tests. |
| # ":fidl_next_bind_test_package", |
| ] |
| } |