Bazel

This method should also be used on Linux, in case your Bazel setup involves some server-side build cache.

Using beLow with Bazel requires to use an intermediate representation of the compilation, called Bazel acyclic query graph, which is a specific JSON representation of a Bazel build. beLow is then able to transform it into a compilation database.

To generate the requested file, use the aquery Bazel subcommand.

E.g, if your usual build command is:

bazel build //...

Then generating the JSON graph to standard output is done by running:

bazel aquery //...

This output must be output to a file called bazel_action_graph.json during project configuration for beLow to understand the context. In general, this can be done the following way:

bazel aquery //... > bazel_action_graph.json

However on Windows, the encoding of the output graph could be incompatible with beLow, because the output format depends on the system language. In this case, the best is to force the output encoding using PowerShell:

bazel aquery //... | Out-File -Encoding ASCII -FilePath ./bazel_action_graph.json

Therefore, to setup your Bazel project, use the following configuration.

For Configure section, enter:

  • Script content:

bazel aquery //... > bazel_action_graph.json
  • Script execution path: In the target directory

  • Shell: Bash

For Clean section, enter:

  • Script content:

bazel clean //...
  • Script execution path: In the target directory

  • Shell: Bash

For Build section, enter:

  • Script content:

bazel build //...
  • Script execution path: In the target directory

  • Shell: Bash

Last updated