Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

see compilation warnings on cached bazel targets

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.

like image 306
orshachar Avatar asked Jul 02 '17 15:07

orshachar


1 Answers

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.

like image 133
Danna Kelmer Avatar answered Oct 19 '22 09:10

Danna Kelmer