Skip to content

Custom Check Not Effective in Bazel #4204

Answered by cushon
xingyutangyuan asked this question in Q&A
Discussion options

You must be logged in to vote

The library that defines the custom check needs to depend on the java_plugin for AutoService, and then there needs to be a separate java_plugin rule for the custom check.

Here's a demo:

java_library(
    name = "demo",
    srcs = ["src/main/java/com/example/Demo.java"],
    plugins = [":my_custom_check"],
)

java_plugin(
    name = "my_custom_check",
    srcs = ["src/main/java/com/example/MyCustomCheck.java"],
    deps = [
        ":auto_service",
        "@maven//:com_google_errorprone_error_prone_annotation",
        "@maven//:com_google_errorprone_error_prone_check_api",
    ],
)

java_library(
    name = "auto_service",
    exported_plugins = [
        ":auto_service_plugin",
    ],
    

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@xingyutangyuan
Comment options

@cushon
Comment options

@xingyutangyuan
Comment options

Answer selected by cushon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants