| # 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/config.gni") |
| import("//build/rust/rustc_binary.gni") |
| |
| shared_deps = [ |
| ":a2dp_profile_config", |
| "//sdk/fidl/fuchsia.bluetooth.a2dp:fuchsia.bluetooth.a2dp_rust", |
| "//sdk/fidl/fuchsia.bluetooth.avrcp:fuchsia.bluetooth.avrcp_rust", |
| "//sdk/fidl/fuchsia.bluetooth.bredr:fuchsia.bluetooth.bredr_rust", |
| "//sdk/fidl/fuchsia.bluetooth.internal.a2dp:fuchsia.bluetooth.internal.a2dp_rust", |
| "//sdk/fidl/fuchsia.component:fuchsia.component_rust", |
| "//sdk/fidl/fuchsia.media:fuchsia.media_rust", |
| "//sdk/fidl/fuchsia.media.sessions2:fuchsia.media.sessions2_rust", |
| "//sdk/fidl/fuchsia.settings:fuchsia.settings_rust", |
| "//src/connectivity/bluetooth/lib/async-helpers", |
| "//src/connectivity/bluetooth/lib/battery-client", |
| "//src/connectivity/bluetooth/lib/bt-a2dp", |
| "//src/connectivity/bluetooth/lib/bt-avdtp", |
| "//src/connectivity/bluetooth/lib/bt-metrics", |
| "//src/connectivity/bluetooth/lib/fuchsia-audio-codec", |
| "//src/connectivity/bluetooth/lib/fuchsia-audio-device", |
| "//src/connectivity/bluetooth/lib/fuchsia-bluetooth", |
| "//src/connectivity/bluetooth/lib/profile-client", |
| "//src/lib/async-utils", |
| "//src/lib/diagnostics/inspect/contrib/rust", |
| "//src/lib/diagnostics/inspect/derive", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fidl_table_validation", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:bitfield", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:nom", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| shared_sources = [ |
| "src/avrcp_relay.rs", |
| "src/config.rs", |
| "src/encoding.rs", |
| "src/latm.rs", |
| "src/main.rs", |
| "src/media.rs", |
| "src/media/inband_source.rs", |
| "src/media/player.rs", |
| "src/media/player_sink.rs", |
| "src/media/sources.rs", |
| "src/pcm_audio.rs", |
| "src/stream_controller.rs", |
| "src/volume_relay.rs", |
| ] |
| |
| rustc_binary("bin") { |
| edition = "2021" |
| output_name = "bt_a2dp" |
| with_unit_tests = true |
| |
| deps = shared_deps |
| |
| test_deps = [ |
| "//sdk/fidl/fuchsia.bluetooth:fuchsia.bluetooth_rust", |
| "//sdk/fidl/fuchsia.power.battery:fuchsia.power.battery_rust", |
| "//src/connectivity/bluetooth/lib/async-helpers:async-test-helpers", |
| "//src/connectivity/bluetooth/testing/test-battery-manager", |
| "//src/lib/async-utils", |
| "//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions", |
| "//src/lib/fuchsia-sync", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:futures-test", |
| "//third_party/rust_crates:hex", |
| "//third_party/rust_crates:sha2", |
| ] |
| |
| sources = shared_sources |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| fuchsia_component_manifest("manifest") { |
| component_name = "bt-a2dp" |
| manifest = "meta/bt-a2dp.cml" |
| } |
| |
| fuchsia_component("component") { |
| cm_label = ":manifest" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_structured_config_rust_lib("a2dp_profile_config") { |
| cm_label = ":manifest" |
| } |
| |
| fuchsia_structured_config_values("default_config_values") { |
| cm_label = ":manifest" |
| values_source = "config/default.json5" |
| } |
| |
| # A configuration for bt-a2dp which disables sink. |
| fuchsia_structured_config_values("source_only_config") { |
| cm_label = ":manifest" |
| values_source = "config/source_only.json5" |
| } |
| |
| fuchsia_package("bt-a2dp") { |
| deps = [ |
| ":component", |
| ":default_config_values", |
| ] |
| } |
| |
| fuchsia_package("source-only") { |
| package_name = "bt-a2dp" |
| deps = [ |
| ":component", |
| ":source_only_config", |
| ] |
| } |
| |
| fuchsia_unittest_package("bt-a2dp-tests") { |
| deps = [ ":bin_test" ] |
| } |
| |
| rustc_test("encoding_integration_bin") { |
| edition = "2021" |
| output_name = "bt_a2dp_encoding_tests" |
| features = [ "test_encoding" ] |
| source_root = "src/main.rs" |
| |
| deps = shared_deps + [ |
| "//sdk/fidl/fuchsia.bluetooth:fuchsia.bluetooth_rust", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust", |
| "//sdk/fidl/fuchsia.power.battery:fuchsia.power.battery_rust", |
| "//src/connectivity/bluetooth/lib/async-helpers:async-test-helpers", |
| "//src/connectivity/bluetooth/lib/bt-avdtp", |
| "//src/connectivity/bluetooth/testing/test-battery-manager", |
| "//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions", |
| "//src/lib/test_util", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:futures-test", |
| "//third_party/rust_crates:hex", |
| "//third_party/rust_crates:sha2", |
| ] |
| |
| test_deps = [ "//src/lib/fuchsia-sync" ] |
| |
| sources = shared_sources |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| fuchsia_unittest_package("bt-a2dp-encoding-tests") { |
| restricted_features = [ "allow_non_hermetic_packages" ] |
| manifest = "meta/bt-a2dp-encoding-tests.cml" |
| deps = [ ":encoding_integration_bin" ] |
| test_type = "system" |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":bt-a2dp-encoding-tests", |
| ":bt-a2dp-tests", |
| |
| # The `bt-a2dp-encoding-tests` use the CFv2 Codec Factory component which is part of this |
| # package. See `include_codecfactory.shard.cml` for the list of provided capabilities. |
| "//src/media/codec:codec_factory", |
| ] |
| } |