load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library")
load("@fbcode_macros//build_defs:rust_unittest.bzl", "rust_unittest")
oncall("sapling")
rust_library(
name = "indexedlog",
srcs = glob(["src/**/*.rs"]),
autocargo = {"cargo_toml_config": {
"bench": [
{
"harness": False,
"name": "index",
},
{
"harness": False,
"name": "misc",
},
{
"harness": False,
"name": "log",
},
],
"extra_buck_dependencies": {"dev-dependencies": [
"fbsource//third-party/rust:rand_chacha",
"//eden/scm/lib/minibench:minibench",
]},
"features": {
"configurable": ["sapling-configmodel"],
"sigbus-handler": [],
},
"lib": {"name": "indexedlog"},
"package": {
"authors": ["Meta Source Control Team <sourcecontrol-dev@meta.com>"],
"description": "Append-only on-disk storage with integrity checks and radix tree indexing.",
"homepage": "https://sapling-scm.com/",
"license": "MIT",
"name": "sapling-indexedlog",
"repository": "https://github.com/facebook/sapling",
},
}},
crate_root = "src/lib.rs",
features = [
"configurable",
"sigbus-handler",
],
os_deps = [
(
"linux",
[
"fbsource//third-party/rust:hex",
"fbsource//third-party/rust:libc",
],
),
(
"macos",
[
"fbsource//third-party/rust:hex",
"fbsource//third-party/rust:libc",
],
),
(
"windows",
[
"fbsource//third-party/rust:winapi",
],
),
],
test_deps = [
"fbsource//third-party/rust:quickcheck",
"//eden/scm/lib/dev-logger:dev-logger",
],
# A test inside this target is using #[should_panic], setting the backtrace
# to false here, otherwise the test binary will try to extract the backtrace
# and the test will fail with leak sanatizer.
test_env = {"RUST_BACKTRACE": "0"},
test_labels = ["tpx-rust-no-backtrace-workaround"],
deps = [
"fbsource//third-party/rust:byteorder",
"fbsource//third-party/rust:fs2",
"fbsource//third-party/rust:memmap2",
"fbsource//third-party/rust:once_cell",
"fbsource//third-party/rust:rand",
"fbsource//third-party/rust:tempfile",
"fbsource//third-party/rust:tracing",
"fbsource//third-party/rust:twox-hash",
"//eden/scm/lib/atomicfile:atomicfile",
"//eden/scm/lib/config/model:configmodel",
"//eden/scm/lib/minibytes:minibytes",
"//eden/scm/lib/vlqencoding:vlqencoding",
],
)
rust_unittest(
name = "low_fileno_limit_test",
srcs = ["tests/low_fileno_limit.rs"],
crate_root = "tests/low_fileno_limit.rs",
os_deps = [
(
"linux",
[
"fbsource//third-party/rust:libc",
"fbsource//third-party/rust:tempfile",
":indexedlog",
],
),
(
"macos",
[
"fbsource//third-party/rust:libc",
"fbsource//third-party/rust:tempfile",
":indexedlog",
],
),
],
)