| # 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/components:fx_component.bzl", |
| "fx_component_manifest", |
| "fx_test_component", |
| ) |
| load("//build/bazel/rules/packages:fx_package.bzl", "fx_package") |
| load("//build/bazel/rules/packages:fx_packaged_binary.bzl", "fx_packaged_binary") |
| load("//build/bazel/rules/rust:defs.bzl", "rustc_library", "rustc_test") |
| load("//build/bazel/rules/testing:fx_test.bzl", "fx_test") |
| |
| package(default_applicable_licenses = ["//:license"]) |
| |
| # Use in BUILD as `//src/lib/mapped-clock:lib`. |
| # Use in rust code as `use mapped_clock::...` |
| rustc_library( |
| name = "lib", |
| srcs = ["src/lib.rs"], |
| crate_name = "mapped_clock", |
| edition = "2024", |
| visibility = [ |
| "//src/lib/mapped-clock/benchmarks:__pkg__", |
| "//src/starnix/kernel/core:__pkg__", |
| ], |
| deps = [ |
| "//sdk/rust/zx", |
| "//sdk/rust/zx-status", |
| "//third_party/rust_crates/vendor:log", |
| ], |
| ) |
| |
| # @bazel2gn:skip |
| rustc_test( |
| name = "lib_test", |
| crate = ":lib", |
| edition = "2024", |
| visibility = ["//visibility:private"], |
| deps = ["//src/lib/fuchsia-runtime"], |
| ) |
| |
| # @bazel2gn:skip |
| fx_packaged_binary( |
| name = "lib_test_packaged_bin", |
| testonly = True, |
| binary = ":lib_test", |
| binary_name = "mapped_clock_lib_test", |
| visibility = ["//visibility:private"], |
| ) |
| |
| # @bazel2gn:skip |
| fx_component_manifest( |
| name = "mapped-clock-tests-manifest", |
| testonly = True, |
| component_name = "mapped-clock-tests", |
| includes = [ |
| "//sdk/lib/syslog:use.shard.cml", |
| "//src/sys/test_runners/rust:default.shard.cml", |
| ], |
| manifest = "meta/mapped-clock-tests.cml", |
| visibility = ["//visibility:private"], |
| ) |
| |
| # @bazel2gn:skip |
| fx_test_component( |
| name = "mapped-clock-tests-component", |
| compiled_manifest = ":mapped-clock-tests-manifest", |
| component_name = "mapped-clock-tests", |
| visibility = ["//visibility:private"], |
| deps = [":lib_test_packaged_bin"], |
| ) |
| |
| # @bazel2gn:skip |
| fx_package( |
| name = "mapped-clock-tests-package", |
| package_name = "mapped-clock-tests", |
| test_components = [":mapped-clock-tests-component"], |
| visibility = ["//visibility:private"], |
| ) |
| |
| # @bazel2gn:skip |
| fx_test( |
| name = "mapped-clock-tests", |
| package = ":mapped-clock-tests-package", |
| visibility = ["//visibility:public"], |
| ) |