Bazel在干净编译(Java)期间显示所有编译警告。
但是 - 当我们重新运行bazel build时 - 我们会失去所有警告。
是否有任何标志可以使其显示缓存目标的原始警告?
示例存储库: https://github.com/or-shachar/bazel-sample-repo/tree/warning (分支warning
)
第一次运行输出:
✗ 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
下一次运行:
✗ 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
正如您所看到的 - 我们在缓存运行时失去了警告。如果没有通过某些标志可用,那么将其作为一个功能添加可能是值得的。