| # Copyright 2023 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("//src/lib/fuchsia-sync/build/args.gni") |
| |
| rustc_library("fuchsia-sync") { |
| name = "fuchsia_sync" |
| edition = "2024" |
| version = "0.1.0" |
| with_unit_tests = true |
| |
| deps = [ "//third_party/rust_crates:lock_api" ] |
| non_rust_deps = [] |
| test_deps = [] |
| |
| if (is_fuchsia) { |
| deps += [ "//sdk/rust/zx" ] |
| non_rust_deps += [ "//zircon/system/ulib/sync" ] |
| } else { |
| deps += [ |
| "//third_party/rust_crates:parking_lot", |
| "//third_party/rust_crates:parking_lot_core", |
| ] |
| } |
| |
| test_deps += [ "//third_party/rust_crates:crossbeam" ] |
| |
| if (fuchsia_sync_detect_lock_cycles) { |
| deps += [ "//third_party/rust_crates:tracing-mutex" ] |
| configs += [ ":detect_lock_cycles" ] |
| } |
| |
| sources = [ |
| "src/condvar.rs", |
| "src/lib.rs", |
| "src/mutex.rs", |
| "src/rwlock.rs", |
| ] |
| } |
| |
| config("detect_lock_cycles") { |
| rustflags = [ "--cfg=detect_lock_cycles" ] |
| } |
| |
| fuchsia_unittest_package("fuchsia-sync-tests") { |
| deps = [ ":fuchsia-sync_test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fuchsia-sync-tests", |
| ":fuchsia-sync_test($host_toolchain)", |
| ] |
| } |