blob: ea8c13eb8b58b56150cd31086eb06704c8932c9c [file]
# 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.
import("//build/components.gni")
import("//build/rust/rustc_library.gni")
import("//build/rust/rustc_macro.gni")
import("//zircon/kernel/params.gni")
rustc_macro("ksync-macro") {
edition = "2024"
source_root = "macro/src/lib.rs"
sources = [ "macro/src/lib.rs" ]
deps = [
"//third_party/rust_crates:proc-macro2",
"//third_party/rust_crates:quote",
"//third_party/rust_crates:syn",
]
}
rustc_library("ksync") {
edition = "2024"
sources = [
"src/kcell.rs",
"src/kmutex.rs",
"src/lib.rs",
"src/lock_token.rs",
"src/raw_kernel_mutex.rs",
"src/raw_lock.rs",
"src/raw_userspace_mutex.rs",
]
with_unit_tests = !is_kernel
deps = [
":ksync-macro",
"//src/lib/kstring",
"//src/lib/lockdep/rust:lockdep",
"//third_party/rust_crates:pin-init",
]
if (is_kernel) {
features = [ "kernel" ]
_cfgs = []
if (enable_lock_dep) {
_cfgs += [ "lock_dep" ]
} else if (enable_lock_dep_metadata_only) {
_cfgs += [ "lock_metadata_only" ]
}
if (lock_name_tracing_enabled || scheduler_lock_spin_tracing_enabled) {
_cfgs += [ "lock_name_tracing" ]
}
if (_cfgs != []) {
cfgs = _cfgs
}
deps += [
"//src/lib/zr",
"//zircon/kernel/lib/ksync",
]
} else {
deps += [
"//src/lib/fuchsia-sync",
"//third_party/rust_crates:lock_api",
]
}
}
fuchsia_unittest_package("ksync-tests") {
deps = [ ":ksync_test" ]
}
group("tests") {
testonly = true
deps = [ ":ksync-tests" ]
}