查看缓存的Bazel目标的编译警告

14

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

正如您所看到的 - 我们在缓存运行时失去了警告。如果没有通过某些标志可用,那么将其作为一个功能添加可能是值得的。


3
你好,就我所知目前还无法实现,除非你使用远程缓存,如果我没记错的话。我们希望在未来改变这种情况。 - Damien Martin-Guillerez
1个回答

2

这是不可能的,因为错误来自执行操作的工具的一部分。如果操作没有更改,则不会重新运行(这就是为什么增量构建更快),因此工具不会被重新调用,您将看不到错误。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接