"""Build file for psmatcher."""

load("@crates//:defs.bzl", "aliases", "all_crate_deps")
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

package(default_visibility = ["//visibility:public"])

# Export Cargo.toml for crate_universe
exports_files(["Cargo.toml"])

rust_library(
    name = "psmatcher",
    srcs = glob(["src/**/*.rs"]),
    aliases = aliases(),
    compile_data = ["README.md"],
    crate_features = ["testing"],
    crate_name = "psmatcher",
    edition = "2021",
    proc_macro_deps = all_crate_deps(proc_macro = True),
    deps = all_crate_deps(normal = True),
)

rust_test(
    name = "psmatcher-test",
    aliases = aliases(),
    crate = ":psmatcher",
    crate_features = ["testing"],
    edition = "2021",
    proc_macro_deps = all_crate_deps(
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = all_crate_deps(
        normal = True,
        normal_dev = True,
    ),
)

# Integration tests in tests/*.rs — one rust_test target per file.

rust_test(
    name = "psmatcher-matcher_test-itest",
    srcs = ["tests/matcher_test.rs"],
    aliases = aliases(),
    crate_root = "tests/matcher_test.rs",
    edition = "2021",
    proc_macro_deps = all_crate_deps(
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [":psmatcher"] + all_crate_deps(
        normal = True,
        normal_dev = True,
    ),
)

