代码之家  ›  专栏  ›  技术社区  ›  obeattie

bazel能显示所有的分析错误吗?

  •  1
  • obeattie  · 技术社区  · 6 年前

    当我调用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 回复  |  直到 6 年前
        1
  •  3
  •   Ondrej K.    6 年前

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

    然后去了其他指定的目标。