blob: 8aa8757c034008a840ac39c2e563333f72640964 [file] [log] [blame]
# 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/rust/rustc_library.gni")
import("//build/rust/rustc_macro.gni")
rustc_library("cm_rust") {
edition = "2021"
with_unit_tests = true
deps = [
":cm_rust_derive",
"//sdk/fidl/fuchsia.component.config:fuchsia.component.config-rustc",
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl-rustc",
"//sdk/fidl/fuchsia.data:fuchsia.data-rustc",
"//sdk/fidl/fuchsia.io:fuchsia.io-rustc",
"//sdk/fidl/fuchsia.process:fuchsia.process-rustc",
"//src/lib/from-enum",
"//src/sys/lib/cm_fidl_validator",
"//src/sys/lib/cm_types",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:maplit",
"//third_party/rust_crates:thiserror",
]
sources = [ "src/lib.rs" ]
# Some host tools use serde to serialize/deserialize cm_rust types. This
# dependency is guarded in code via #[cfg(feature = "serde")] and
# #[cfg_attr(feature = "serde", ...)] to prevent serde dependencies in
# non-host builds.
features = []
test_deps = []
if (is_host) {
features += [ "serde" ]
deps += [ "//third_party/rust_crates:serde" ]
sources += [ "src/serde_ext.rs" ]
test_deps += [ "//third_party/rust_crates:serde_json" ]
}
}
rustc_macro("cm_rust_derive") {
edition = "2021"
deps = [
"//third_party/rust_crates:darling",
"//third_party/rust_crates:proc-macro2",
"//third_party/rust_crates:quote",
"//third_party/rust_crates:syn",
]
source_root = "src/macro.rs"
sources = [ "src/macro.rs" ]
}
fuchsia_unittest_package("cm_rust_tests") {
deps = [
":cm_rust_test",
"//src/sys/lib/cm_types",
]
test_specs = {
}
}
group("tests") {
testonly = true
deps = [
":cm_rust_test($host_toolchain)",
":cm_rust_tests",
]
}