| # 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/rust:rustc_library.bzl", "rustc_library") | |
| load("//build/bazel/rules/rust:rustc_test.bzl", "rustc_test") | |
| load("//build/bazel/rules/testing:fx_unittest_package.bzl", "fx_unittest_package") | |
| package(default_applicable_licenses = ["//:license"]) | |
| alias( | |
| name = "rust", | |
| actual = ":lib", | |
| visibility = [ | |
| "//src/diagnostics/archivist:__subpackages__", | |
| "//src/lib/diagnostics/fake-log-sink/rust:__pkg__", | |
| "//src/lib/diagnostics/log/message/rust/cpp-log-decoder:__pkg__", | |
| "//src/lib/diagnostics/reader/rust:__pkg__", | |
| "//src/starnix/kernel/core:__pkg__", | |
| ], | |
| ) | |
| rustc_library( | |
| name = "lib", | |
| srcs = [ | |
| "src/constants.rs", | |
| "src/error.rs", | |
| "src/ffi.rs", | |
| "src/lib.rs", | |
| "src/test.rs", | |
| ], | |
| crate_name = "diagnostics_message", | |
| edition = "2024", | |
| lint_config = "//build/config/rust/lints:clippy_warn_all", | |
| visibility = [ | |
| "//src/diagnostics/lib/log-command:__pkg__", | |
| ], | |
| deps = [ | |
| "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_rust", | |
| "//sdk/fidl/fuchsia.logger:fuchsia.logger_rust", | |
| "//src/lib/diagnostics/data/rust", | |
| "//src/lib/diagnostics/log/encoding/rust", | |
| "//src/sys/lib/moniker", | |
| "//third_party/rust_crates/vendor:bumpalo", | |
| "//third_party/rust_crates/vendor:byteorder", | |
| "//third_party/rust_crates/vendor:flyweights", | |
| "//third_party/rust_crates/vendor:libc", | |
| "//third_party/rust_crates/vendor:static_assertions", | |
| "//third_party/rust_crates/vendor:thiserror", | |
| ], # @bazel2gn:raw_overwrite:[ "//sdk/fidl/fuchsia.logger:fuchsia.logger_rust", "//src/lib/diagnostics/data/rust", "//src/lib/diagnostics/log/encoding/rust", "//src/sys/lib/moniker", "//third_party/rust_crates:bumpalo", "//third_party/rust_crates:byteorder", "//third_party/rust_crates:flyweights", "//third_party/rust_crates:libc", "//third_party/rust_crates:static_assertions", "//third_party/rust_crates:thiserror" ] if (current_build_target_api_level == "HEAD" || current_build_target_api_level == "PLATFORM") { deps += [ "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_rust" ] } | |
| ) | |
| # Standalone rustc_test rather than with_unit_tests on rustc_library because | |
| # Bazel Rust rules require explicit rustc_test targets instead of implicit | |
| # with_unit_tests generation. | |
| # @bazel2gn:skip | |
| rustc_test( | |
| name = "diagnostics_message_lib_test", | |
| crate = ":lib", | |
| edition = "2024", | |
| lint_config = "//build/config/rust/lints:clippy_warn_all", | |
| deps = [ | |
| "//sdk/fidl/fuchsia.diagnostics.types:fuchsia.diagnostics.types_rust", | |
| "//src/lib/fuchsia", | |
| "//third_party/rust_crates/vendor:assert_matches", | |
| ], | |
| ) | |
| # TODO(https://fxbug.dev/574121341): Run in GN too. | |
| # @bazel2gn:skip | |
| fx_unittest_package( | |
| name = "diagnostics-message-tests", | |
| unit_tests = [":diagnostics_message_lib_test"], | |
| ) |