Custom Check Not Effective in Bazel #4204
-
I'm trying to create a custom check using bazel. The following are my BUILD file:
When I include the
If I leave it out, the generated plugin.jar includes only MANIFEST file:
And the MANIFEST file's content:
The tests using What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The library that defines the custom check needs to depend on the 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",
],
exports = [
"@maven//:com_google_auto_service_auto_service_annotations",
],
)
java_plugin(
name = "auto_service_plugin",
processor_class = "com.google.auto.service.processor.AutoServiceProcessor",
deps = [
"@maven//:com_google_auto_service_auto_service",
],
)
|
Beta Was this translation helpful? Give feedback.
The library that defines the custom check needs to depend on the
java_plugin
for AutoService, and then there needs to be a separatejava_plugin
rule for the custom check.Here's a demo: