load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("//build_defs:cpp_opts.bzl", "COPTS")

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

cc_library(
    name = "allowlist",
    hdrs = ["allowlist.h"],
    copts = COPTS,
    include_prefix = "google/protobuf/compiler/allowlists",
    deps = [
        "//src/google/protobuf/stubs",
        "@com_google_absl//absl/algorithm:container",
        "@com_google_absl//absl/base:core_headers",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/types:span",
    ],
)

cc_library(
    name = "allowlists",
    srcs = [
        "editions.cc",
        "empty_package.cc",
        "open_enum.cc",
        "unused_imports.cc",
        "weak_imports.cc",
    ],
    hdrs = ["allowlists.h"],
    copts = COPTS,
    include_prefix = "google/protobuf/compiler/allowlists",
    visibility = ["//src/google/protobuf:__subpackages__"],
    deps = [
        ":allowlist",
        "@com_google_absl//absl/strings",
    ],
)

cc_test(
    name = "allowlist_test",
    srcs = ["allowlist_test.cc"],
    copts = COPTS,
    deps = [
        ":allowlist",
        "@com_google_googletest//:gtest",
        "@com_google_googletest//:gtest_main",
    ],
)

filegroup(
    name = "test_srcs",
    srcs = glob(
        [
            "*_test.cc",
            "*unittest.cc",
        ],
        allow_empty = True,
    ),
    visibility = ["//src/google/protobuf/compiler:__pkg__"],
)
