load("@contrib_rules_jvm//java:defs.bzl", "spotbugs_binary", "spotbugs_config")
load(":defs.bzl", "artifact")

exports_files(
    srcs = [
        "CHANGELOG",
        "empty_test_template.txt",
        "java_stub_template.txt",
    ],
    visibility = [
        "//visibility:public",
    ],
)

java_plugin(
    name = "auto-service-plugin",
    processor_class = "com.google.auto.service.processor.AutoServiceProcessor",
    visibility = ["//visibility:private"],
    deps = [
        artifact("com.google.auto.service:auto-service"),
    ],
)

java_library(
    name = "auto-service",
    exported_plugins = [
        ":auto-service-plugin",
    ],
    visibility = [
        "//java:__subpackages__",
    ],
    exports = [
        artifact("com.google.auto.service:auto-service-annotations"),
    ],
)

spotbugs_binary(
    name = "spotbugs-cli",
    runtime_deps = [
        artifact("com.github.spotbugs:spotbugs"),
        artifact("org.slf4j:slf4j-jdk14"),
    ],
)

spotbugs_config(
    name = "spotbugs-config",
    effort = "default",
    exclude_filter = "spotbugs-excludes.xml",
    fail_on_warning = True,
    spotbugs_binary = ":spotbugs-cli",
    visibility = [
        "//visibility:public",
    ],
)
