Bazel displays all compilation warnings during the clean compilation (java).
But - when we rerun bazel build - we lose all the warnings.
Is there any flag that would make it display the original warnings for cached targets?
Example repo: https://github.com/or-shachar/bazel-sample-repo/tree/warning (branch warning
)
First run output:
✗ bazel build //...
INFO: Found 1 target...
INFO: From Building src/main/java/com/example/libmy_warning_lib.jar (1 source file):
src/main/java/com/example/MyLib.java:12: warning: [static] static variable should be qualified by type name, MyLib, instead of by an expression
this.x = this.x + 2.1;
^
src/main/java/com/example/MyLib.java:12: warning: [static] static variable should be qualified by type name, MyLib, instead of by an expression
this.x = this.x + 2.1;
^
Target //src/main/java/com/example:my_warning_lib up-to-date:
bazel-bin/src/main/java/com/example/libmy_warning_lib.jar
INFO: Elapsed time: 3.286s, Critical Path: 1.03s
Next run:
✗ bazel build //...
INFO: Found 1 target...
Target //src/main/java/com/example:my_warning_lib up-to-date:
bazel-bin/src/main/java/com/example/libmy_warning_lib.jar
INFO: Elapsed time: 0.244s, Critical Path: 0.01s
As you can see - we're losing the warnings on cached run. If it's not available by some flag - it might worth to be added as a feature.
This is not possible because the error is coming from a tool as part of the execution of an action. If the action is unchanged then it will not be rerun (this is why your incremental builds are faster) and therefore the tool will not be reinvoked and you will not see the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With