load("@prelude//platforms:defs.bzl", "host_configuration")
load("//build:bench.bzl", "rust_benchmark")
load("//build:fuzz.bzl", "rust_fuzz")

rust_library(
    name = "range-tree",
    srcs = glob(["src/**/*.rs"]),
    deps = [
        "//third-party:cfg-if",
        "//third-party:tracing",
    ],
    visibility = ["PUBLIC"],
    tests = [":range-tree_unittests", ":range-tree_benchmarks", ":range-tree_fuzz"],
)

rust_test(
    name = "range-tree_unittests",
    srcs = glob(["**/*.rs"]),
    deps = [
        "//third-party:cfg-if",
        "//third-party:tracing",
        "//third-party:proptest",
        "//third-party:rand",
        "//third-party:tracing-subscriber",
        "//third-party:nonmax",
    ],
    target_compatible_with = [host_configuration.os, host_configuration.cpu],
    visibility = ["PUBLIC"],
)

rust_benchmark(
    name = "range-tree_benchmarks",
    srcs = ["./benches/comparisons.rs"],
    crate_root = "./benches/comparisons.rs",
    deps = [
        ":range-tree",
        "//third-party:cfg-if",
        "//third-party:tracing",
        "//third-party:proptest",
        "//third-party:rand",
        "//third-party:tracing-subscriber",
        "//third-party:nonmax",

        "//third-party:criterion",
        "//third-party:brie-tree",
        "//third-party:pin-project",
        "//lib/wavltree:wavltree",
    ],
    visibility = ["PUBLIC"],
)

rust_fuzz(
    name = "range-tree_fuzz",
    srcs = ["./fuzz/range_tree.rs"],
    crate_root = "./fuzz/range_tree.rs",
    deps = [
        ":range-tree",
        "//third-party:libfuzzer-sys",
        "//third-party:arbitrary",
    ],
    visibility = ["PUBLIC"],
)
