# Enzyme tests.
# Placeholder: load sh_binary
load("@llvm-project//llvm:lit_test.bzl", "package_path")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")

# Generates lit config input file by applying path placeholder substitutions
# similar to the configure_lit_site_cfg CMake macro.
expand_template(
    name = "lit_site_cfg_py",
    testonly = True,
    out = "lit.site.cfg.py",
    substitutions = {
        "@LLVM_VERSION_MAJOR@": "18",
        "@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.",
        "@LLVM_BINARY_DIR@": package_path("@llvm-project//llvm:BUILD"),
        "@LLVM_TOOLS_BINARY_DIR@": package_path("@llvm-project//llvm:BUILD"),
        "@LLVM_LIBS_DIR@": package_path("@llvm-project//llvm:BUILD"),
        "@ENZYME_SOURCE_DIR@": "",
        "@ENZYME_BINARY_DIR@": "",
        "@TARGET_TRIPLE@": "",
        "@TARGETS_TO_BUILD@": "ALL",
        "@LLVM_SHLIBEXT@": ".so",
    },
    template = "lit.site.cfg.py.in",
    visibility = [":__subpackages__"],
)

exports_files(
    ["lit.cfg.py"],
    visibility = [":__subpackages__"],
)
