Bazel可以显示所有分析错误吗?

时间:2018-07-06 10:14:10

标签: bazel

当我调用Bazel命令并且有分析错误时,它仅显示其中之一。例如:

ERROR: /Users/oliver/src/github.com/monzo/wearedev/service.transaction-enrichment/handler/BUILD.bazel:3:1: target '//service.personal-account-signup/domain:go_default_library' is not visible from target '//service.transaction-enrichment/handler:go_default_library'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: /Users/oliver/src/github.com/monzo/wearedev/service.transaction-enrichment/handler/BUILD.bazel:3:1: target '//service.prepaid-bridge/domain:go_default_library' is not visible from target '//service.transaction-enrichment/handler:go_default_library'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: Analysis of target '//service.transaction-enrichment/handler:go_default_test' failed; build aborted: Analysis of target '//service.transaction-enrichment/handler:go_default_library' failed; build aborted
INFO: Elapsed time: 1.049s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

当我修复此特定的可见性问题并重新运行命令时,可能会看到一个新的分析错误。

Bazel在遇到错误时会停止分析吗?有没有一种方法可以显示所有分析错误,从而避免重复运行命令来依次清除每个错误?


需要明确的是,我正在运行的命令正在尝试构建多个目标,其中几个无法分析。即使每个目标只能输出一个错误,有没有办法让它分析所有目标?

1 个答案:

答案 0 :(得分:3)

这不是您要的东西吗?通过CLI帮助(bazel help --long build)。

  --[no]keep_going [-k] (a boolean; default: "false")
    Continue as much as possible after an error.  While the target that failed 
    and those that depend on it cannot be analyzed, other prerequisites of 
    these targets can be.
      Tags: eagerness_to_exit

不确定这是否适用于所有情况,但我已经调整了目标,而没有出错:

WARNING: errors encountered while analyzing target '//xxx:xxx': it will not be built

然后继续执行指定的其他目标。