| # 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_codec") { |
| edition = "2021" |
| sources = [ |
| "src/chunk.rs", |
| "src/compat.rs", |
| "src/copy_optimization.rs", |
| "src/decode/error.rs", |
| "src/decode/mod.rs", |
| "src/decoded.rs", |
| "src/decoder.rs", |
| "src/encode/error.rs", |
| "src/encode/mod.rs", |
| "src/encoder.rs", |
| "src/from_wire.rs", |
| "src/into_natural.rs", |
| "src/lib.rs", |
| "src/primitives.rs", |
| "src/slot.rs", |
| "src/testing.rs", |
| "src/wire/boxed.rs", |
| "src/wire/envelope.rs", |
| "src/wire/mod.rs", |
| "src/wire/ptr.rs", |
| "src/wire/result.rs", |
| "src/wire/string/mod.rs", |
| "src/wire/string/optional.rs", |
| "src/wire/string/required.rs", |
| "src/wire/table.rs", |
| "src/wire/union.rs", |
| "src/wire/vec/mod.rs", |
| "src/wire/vec/optional.rs", |
| "src/wire/vec/raw.rs", |
| "src/wire/vec/required.rs", |
| ] |
| deps = [ |
| "//third_party/rust_crates:bitflags", |
| "//third_party/rust_crates:munge", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:zerocopy", |
| ] |
| features = [] |
| |
| # Enables compatibility impls with the existing Rust bindings. |
| # This can be removed once we no longer require backwards compatibility. |
| features += [ "compat" ] |
| deps += [ "//src/lib/fidl/rust/fidl" ] |
| |
| if (is_fuchsia) { |
| # "fuchsia" feature |
| sources += [ |
| "src/fuchsia/handle.rs", |
| "src/fuchsia/handle_types.rs", |
| "src/fuchsia/mod.rs", |
| "src/fuchsia/object_type.rs", |
| "src/fuchsia/rights.rs", |
| ] |
| deps += [ "//sdk/rust/zx" ] |
| features += [ "fuchsia" ] |
| } |
| |
| with_unit_tests = true |
| |
| # NOTE: this library is still experimental |
| visibility = [ |
| "//:developer_universe_packages", |
| "//sdk/lib/driver/runtime/rust/*", |
| "//src/lib/fdomain/*", |
| "//src/lib/fidl/rust_next/*", |
| "//tools/fidl/fidlc/testdata/*", |
| "//tools/fidl/fidlgen_rust_next/*", |
| ] |
| } |
| |
| fuchsia_unittest_package("fidl_next_codec_test_package") { |
| deps = [ ":fidl_next_codec_test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fidl_next_codec_test($host_toolchain)", |
| # TODO: fix and re-enable device-side tests. |
| # ":fidl_next_codec_test_package", |
| ] |
| } |