Prevent Bazel from running errorprone without -XepDisableAllChecks

229 visualizações
Pular para a primeira mensagem não lida

Christopher Kilian

não lida,
8 de abr. de 2022, 17:52:3208/04/2022
para bazel-discuss
Hey all,

We're currently in the process of migrating a repository to Bazel. The previous build system did not run errorprone by default, so we added a plugin that runs it. However, the version of the plugin is slightly different than the errorprone version Bazel is running, so some build targets are failing due to errorprone in Bazel that are not failing in the previous build system.

It looks like there used to be an '-extra_checks' flag that could be used to turn off errorprone, but it seems that flag was deprecated with the guidance to use -XepDisableAllChecks instead. Using this flag would prevent errorprone from running in Bazel, but it would also prevent all checks in our plugin as well.

One option certainly is to stop using the plugin and just depend on Bazel running errorpone, and add fixes or turn off flags for errors Bazel is catching that the current plugin is not. However, I wanted to double check whether there is a way to prevent Bazel from running errorpone before going down this route.

Thank you!

Chris

Alex Humesky

não lida,
8 de abr. de 2022, 18:18:1508/04/2022
para Christopher Kilian, bazel-discuss
I'm a little confused on how adding "-XepDisableAllChecks" would disable error prone both in bazel and in the other plugin.
But for the bazel build, you could add the flag --javacopt="-XepDisableAllChecks" and that would be added to every java target in the build.

And, as it sounds you may already know, you can disable individual checks in the whole build like this for example:

 --javacopt="-Xep:ReturnValueIgnored:WARN"


and you can disable individual checks on individual targets with

java_library(
  ...,
  javacopts = ["-Xep:ReturnValueIgnored:WARN"],
  ...,
)

So if bazel's errorprone is checking something that the other plugin isn't, you could disable that check at a pretty high granularity in bazel

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/f76d5ad8-7691-4277-8857-82c830e6c317n%40googlegroups.com.

Christopher Kilian

não lida,
8 de abr. de 2022, 18:43:4508/04/2022
para bazel-discuss
Thanks for the reply Alex!

Right now the plugin is picking up the flags through the javacopts. If we add "-XepDisableAllChecks" to the buildrc, would that cause an implicit "-XepDisableAllChecks" to be added to each javacopt in every target? I believe that would essentially disable errorprone for our plugin as well.

Alex Humesky

não lida,
8 de abr. de 2022, 19:09:5408/04/2022
para Christopher Kilian, bazel-discuss
I guess I'm confused on how things are connected --

> The previous build system did not run errorprone by default, so we added a plugin that runs it

so the previous build system is reading bazel's --javacopts? (or the previous build system and bazel are reading / deriving their flags from another shared source?)

Christopher Kilian

não lida,
8 de abr. de 2022, 19:24:4508/04/2022
para bazel-discuss
In the previous build system, we passed the flags as arguments to the plugin through a mechanism that the previous build system had. In Bazel, we're passing the flags to the plugin by passing the flags through javacopts. Both the plugin and Bazel's built-in erroprone are picking up the flags passed through javacopts.

Alex Humesky

não lida,
8 de abr. de 2022, 19:31:5208/04/2022
para Christopher Kilian, bazel-discuss
Oh I see, so the plugin for the previous build system is also being used in bazel, in addition to the errorprone that bazel already uses, right?

I think we're full circle then -- I'm not sure offhand of another way to turn off errorprone (would have to do some investigating), and if there isn't a way, then the next option is to disable the plugin and the specific checks that are failing in errorprone

Christopher Kilian

não lida,
8 de abr. de 2022, 19:36:0508/04/2022
para bazel-discuss
Yes, exactly. We're using the plugin in Bazel in hopes of having parity between what is checked in the previous build system and what is checked in Bazel.
Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem