【问题标题】:Can Bazel show all analysis errors?Bazel 可以显示所有分析错误吗?
【发布时间】:2018-07-06 10:14:09
【问题描述】:

当我调用 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 遇到错误时会停止分析吗?有没有办法让它显示所有分析错误,以避免需要重复运行命令来连续清除每个错误?


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

【问题讨论】:

    标签: bazel


    【解决方案1】:

    这不是你要找的吗?来自 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
    

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

    【讨论】:

    • 我扫描了--help,但完全错过了。谢谢。
    • 那里有很多输出/容易错过的东西......我只是不确定答案是否那么微不足道。 :) 祝你好运。
    • 此外,您可以将--nobuild 传递给bazel build --keep_going 以跳过执行阶段并仅显示分析阶段错误。
    猜你喜欢
    • 2013-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-02
    • 2023-03-24
    • 2016-09-13
    • 1970-01-01
    相关资源
    最近更新 更多