blob: 166da2254543014a4e4168342a2aaccde950e04d [file] [log] [blame]
# Copyright 2020 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_binary.gni")
import("//build/rust/rustc_library.gni")
# Deps shared between v1 and v2 version of library.
shared_deps = [
"//sdk/fidl/fuchsia.bluetooth:fuchsia.bluetooth-rustc",
"//sdk/fidl/fuchsia.bluetooth.bredr:fuchsia.bluetooth.bredr-rustc",
"//sdk/fidl/fuchsia.component.test:fuchsia.component.test-rustc",
"//sdk/fidl/fuchsia.io:fuchsia.io-rustc",
"//sdk/fidl/fuchsia.logger:fuchsia.logger-rustc",
"//src/connectivity/bluetooth/fidl:host-rustc",
"//src/connectivity/bluetooth/lib/fuchsia-bluetooth",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/trace/rust:trace",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/sys/lib/cm_rust",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:tracing",
]
rustc_library("lib_v1") {
edition = "2021"
name = "mock_piconet_client"
testonly = true
with_unit_tests = true
deps = shared_deps
sources = [ "src/lib.rs" ]
configs -= [ "//build/config/rust:allow_unused_results" ]
}
rustc_library("lib_v2") {
edition = "2021"
name = "mock_piconet_client_v2"
testonly = true
with_unit_tests = true
deps = shared_deps + [ "//src/lib/fuchsia-component-test" ]
sources = [ "src/lib_v2.rs" ]
source_root = "src/lib_v2.rs"
configs -= [ "//build/config/rust:allow_unused_results" ]
test_deps = [ "//third_party/rust_crates:assert_matches" ]
}
fuchsia_unittest_package("mock-piconet-client-v2-tests") {
manifest = "meta/mock-piconet-client-v2-tests.cml"
deps = [
":component-v2",
":lib_v2_test",
]
}
rustc_binary("bin") {
edition = "2021"
output_name = "mock_piconet_server"
with_unit_tests = true
deps = [
"//sdk/fidl/fuchsia.bluetooth:fuchsia.bluetooth-rustc",
"//sdk/fidl/fuchsia.bluetooth.bredr:fuchsia.bluetooth.bredr-rustc",
"//sdk/fidl/fuchsia.sys:fuchsia.sys-rustc",
"//src/connectivity/bluetooth/lib/bt-rfcomm",
"//src/connectivity/bluetooth/lib/fuchsia-bluetooth",
"//src/lib/async-utils",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/syslog/rust:syslog",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:parking_lot",
"//third_party/rust_crates:slab",
"//third_party/rust_crates:tracing",
]
test_deps = [
"//src/lib/fuchsia",
"//third_party/rust_crates:assert_matches",
]
sources = [
"src/main.rs",
"src/peer/mod.rs",
"src/peer/search.rs",
"src/peer/service.rs",
"src/profile.rs",
"src/types.rs",
]
configs -= [ "//build/config/rust:allow_unused_results" ]
}
fuchsia_component("component") {
component_name = "mock-piconet-server"
manifest = "meta/mock-piconet-server.cmx"
deps = [ ":bin" ]
}
fuchsia_component("component-v2") {
component_name = "mock-piconet-server-v2"
manifest = "meta/mock-piconet-server.cml"
deps = [ ":bin" ]
}
fuchsia_package("mock-piconet-server") {
deps = [
":component",
":component-v2",
]
}
fuchsia_unittest_package("mock-piconet-server-tests") {
deps = [ ":bin_test" ]
}
group("tests") {
testonly = true
deps = [
":mock-piconet-client-v2-tests",
":mock-piconet-server-tests",
# Packages for components that are injected into the tests.
"//src/cobalt/bin/testing/mock_cobalt",
]
}