load("@prelude//platforms:defs.bzl", "host_configuration")
load("//build:loom.bzl", "rust_loom_test")

rust_library(
    name = "spin",
    srcs = glob(["src/**/*.rs"]),
    deps = [
        "//lib/util:util",
        "//third-party:cfg-if",
        "//third-party:lock_api",
        "//third-party:critical-section"
    ],
    visibility = ["PUBLIC"],
    tests = [":spin_unittests", ":spin_loom_tests"]
)

rust_test(
    name = "spin_unittests",
    srcs = glob(["src/**/*.rs"]),
    deps = [
        "//lib/util:util",
        "//third-party:cfg-if",
        "//third-party:lock_api",
        "//third-party:lazy_static",
        "//third-party:critical-section",
        "//lib/fastrand:fastrand",
    ],
    target_compatible_with = [host_configuration.os, host_configuration.cpu],
    visibility = ["PUBLIC"],
)

rust_loom_test(
    name = "spin_loom_tests",
    srcs = glob(["src/**/*.rs"]),
    crate = "spin",
    deps = [
        "//lib/util:util",
        "//third-party:cfg-if",
        "//third-party:lock_api",
        "//third-party:lazy_static",
        "//third-party:critical-section",
        "//lib/fastrand:fastrand",
        "//third-party:loom",
    ],
)
