| # Copyright 2026 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. | |
| load("//build/bazel/rules/cc:fx_cc_library.bzl", "fx_cc_library") | |
| load("//build/bazel/rules/cc:fx_cc_test_binary.bzl", "fx_cc_test_binary") | |
| load("//build/bazel/rules/testing:fx_unittest_package.bzl", "fx_unittest_package") | |
| package(default_applicable_licenses = ["//:license"]) | |
| test_suite( | |
| name = "tests", | |
| tests = [":metrics_buffer_tests"], | |
| visibility = ["//src/lib:__pkg__"], | |
| ) | |
| fx_cc_library( | |
| name = "metrics_buffer", | |
| srcs = [ | |
| "metrics_buffer.cc", | |
| "metrics_impl.cc", | |
| ], | |
| hdrs = [ | |
| "log.h", | |
| "metrics_buffer.h", | |
| "metrics_impl.h", | |
| ], | |
| # Uses Fuchsia-only FIDL, async-loop, component incoming, and sys/cpp APIs. | |
| target_compatible_with = ["@platforms//os:fuchsia"], | |
| visibility = [ | |
| "//src/media/drivers/amlogic_decoder:__pkg__", | |
| "//src/media/lib/codec_impl:__pkg__", | |
| "//src/sysmem/server:__pkg__", | |
| ], | |
| deps = [ | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_cpp_hlcpp_conversion", | |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_cpp", | |
| "//sdk/lib/async-loop:async-loop-cpp", | |
| "//sdk/lib/async-loop:async-loop-default", | |
| "//sdk/lib/component/incoming/cpp", | |
| "//sdk/lib/driver/logging/cpp", | |
| "//sdk/lib/sys/cpp", | |
| ], | |
| alwayslink = True, | |
| ) | |
| fx_cc_test_binary( | |
| name = "metrics_buffer_unittests", | |
| srcs = ["metrics_buffer_unittests.cc"], | |
| target_compatible_with = ["@platforms//os:fuchsia"], | |
| deps = [ | |
| ":metrics_buffer", | |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_cpp", | |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_hlcpp", | |
| "//sdk/lib/fdio", | |
| "//sdk/lib/vfs/cpp", | |
| "//src/lib/fxl/test:gtest_main", | |
| "@com_google_googletest//:gtest", | |
| ], | |
| ) | |
| fx_unittest_package( | |
| name = "metrics_buffer_tests", | |
| unit_tests = [":metrics_buffer_unittests"], | |
| ) |