| # 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("@rules_cc//cc:cc_library.bzl", "cc_library") | |
| package(default_applicable_licenses = ["//:license"]) | |
| cc_library( | |
| name = "test_support", | |
| testonly = True, | |
| srcs = [ | |
| "mock_memory.cc", | |
| "mock_memory.h", | |
| "register_test_support.cc", | |
| "register_test_support.h", | |
| "test_with_loop.h", | |
| ], | |
| visibility = [ | |
| "//src/developer/debug:__subpackages__", | |
| "//src/lib/unwinder:__subpackages__", | |
| ], | |
| deps = [ | |
| ":shared", | |
| "@com_google_googletest//:gtest", | |
| ], | |
| ) | |
| # Unit tests for this directory. These are intended to be referenced by unit | |
| # test targets for the consumers of this library. | |
| cc_library( | |
| name = "tests", | |
| testonly = True, | |
| srcs = [ | |
| "address_range_unittest.cc", | |
| "handle_info_unittest.cc", | |
| "largest_less_or_equal_unittest.cc", | |
| "message_loop_unittest.cc", | |
| "regex_unittest.cc", | |
| "register_info_unittest.cc", | |
| "stream_buffer_unittest.cc", | |
| "string_util_unittest.cc", | |
| ] + select({ | |
| "@platforms//os:linux": ["message_loop_linux_unittest.cc"], | |
| "@platforms//os:fuchsia": ["message_loop_fuchsia_unittest.cc"], | |
| }), | |
| implementation_deps = [ | |
| ":shared", | |
| "@com_google_googletest//:gtest", | |
| ], | |
| ) | |
| cc_library( | |
| name = "shared", | |
| srcs = [ | |
| "address_range.cc", | |
| "arch.cc", | |
| "arch_x86.cc", | |
| "buffered_bidi_pipe.cc", | |
| "buffered_fd.cc", | |
| "handle_info.cc", | |
| "message_loop.cc", | |
| "platform.cc", | |
| "regex.cc", | |
| "register_info.cc", | |
| "register_value.cc", | |
| "serialization.cc", | |
| "status.cc", | |
| "stream_buffer.cc", | |
| "string_util.cc", | |
| "test_stream_buffer.cc", | |
| "zx_status.cc", | |
| ] + select({ | |
| "@platforms//os:fuchsia": [ | |
| "buffered_zx_socket.cc", | |
| "event_handlers.cc", | |
| "message_loop_fuchsia.cc", | |
| "zircon_utils.cc", | |
| ], | |
| "@platforms//os:linux": [ | |
| "message_loop_linux.cc", | |
| "message_loop_poll.cc", | |
| ], | |
| "//conditions:default": [ | |
| "message_loop_poll.cc", | |
| ], | |
| }), | |
| hdrs = [ | |
| "address_range.h", | |
| "arch.h", | |
| "arch_arm64.h", | |
| "arch_x86.h", | |
| "buffered_bidi_pipe.h", | |
| "buffered_fd.h", | |
| "buffered_stream.h", | |
| "handle_info.h", | |
| "largest_less_or_equal.h", | |
| "message_loop.h", | |
| "platform.h", | |
| "platform_message_loop.h", | |
| "regex.h", | |
| "register_id.h", | |
| "register_info.h", | |
| "register_value.h", | |
| "result.h", | |
| "serialization.h", | |
| "status.h", | |
| "stream_buffer.h", | |
| "string_util.h", | |
| "test_stream_buffer.h", | |
| "zx_status.h", | |
| "zx_status_definitions.h", | |
| ] + select({ | |
| "@platforms//os:fuchsia": [ | |
| "buffered_zx_socket.h", | |
| "channel_watcher.h", | |
| "event_handlers.h", | |
| "event_pair_watcher.h", | |
| "message_loop_fuchsia.h", | |
| "peered_object_watcher.h", | |
| "socket_watcher.h", | |
| "zircon_exception_watcher.h", | |
| "zircon_utils.h", | |
| ], | |
| "@platforms//os:linux": [ | |
| "message_loop_linux.h", | |
| "message_loop_poll.h", | |
| ], | |
| "//conditions:default": [ | |
| "message_loop_poll.h", | |
| ], | |
| }), | |
| visibility = ["//visibility:public"], | |
| deps = [ | |
| "//sdk/lib/fit-promise", | |
| "//sdk/lib/syslog/cpp", | |
| "//src/developer/debug/shared/logging", | |
| "//src/lib/containers/cpp", | |
| "//src/lib/fxl", | |
| "@re2", | |
| ] + select({ | |
| "@platforms//os:fuchsia": [ | |
| "//sdk/lib/async:async-cpp", | |
| "//sdk/lib/async-default", | |
| "//sdk/lib/async-loop:async-loop-cpp", | |
| "//sdk/lib/async-loop:async-loop-default", | |
| "//sdk/lib/fdio", | |
| "//sdk/lib/fit", | |
| "//zircon/system/ulib/zx", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| alwayslink = True, | |
| ) |