Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Bazel show all analysis errors?

Tags:

bazel

When I invoke a Bazel command and there are analysis errors, it only displays one of them. For example:

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)

When I go and fix this specific visibility problem and re-run the command, I might see a new analysis error.

Does Bazel stop analysing when it encounters an error? Is there a way to get it to display all analysis errors to avoid needing to repeatedly run a command to flush out each error serially?


To be clear, the command I'm running is trying to build multiple targets, several of which fail to analyse. Even if it's only possible to output a single error per-target, is there a way to get it to at analyse all targets?

like image 658
obeattie Avatar asked Sep 16 '25 10:09

obeattie


1 Answers

Isn't this what you are looking for? From CLI help (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

Not sure this applies to all scenarios, but I've mangled a target and instead of error got:

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

And went on to the other targets specified.

like image 159
Ondrej K. Avatar answered Sep 19 '25 07:09

Ondrej K.