# 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 an intermediate representation of the compilation, called Bazel acyclic query graph, which is a specific JSON representation of a Bazel build. beLow transforms this representation into a compilation database.

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

If your usual build command is:

```bash
bazel build //...
```

Generating the JSON graph to standard output is done by running:

```bash
bazel aquery //...
```

This output must be written to a file called `bazel_action_graph.json` during project configuration for beLow to understand the context. For example:

```bash
bazel aquery //... > bazel_action_graph.json
```

Note: On Windows, the encoding of the output graph could be incompatible with beLow because the output format depends on the system language. To force the output encoding using PowerShell:

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

{% hint style="warning" %}
If your Bazel setup uses a server-side build cache, make sure to run the `aquery` generation step as part of project configuration so beLow has the full context.
{% endhint %}

### Configuration for beLow

Configure

{% tabs %}
{% tab title="Linux" %}

* Script content:

```bash
bazel aquery //... > bazel_action_graph.json
```

* Script execution path: In the target directory
* Shell: Bash
* Direct link to tab: <https://docs.wedolow.com/below-technical-documentation/compatibility-guide/bazel#tab-linux>
  {% endtab %}

{% tab title="Windows" %}

* Script content:

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

* Script execution path: In the target directory
* Shell: Pwsh
* Direct link to tab: <https://docs.wedolow.com/below-technical-documentation/compatibility-guide/bazel#tab-windows>
  {% endtab %}
  {% endtabs %}

Clean

{% tabs %}
{% tab title="Linux" %}

* Script content:

```bash
bazel clean //...
```

* Script execution path: In the target directory
* Shell: Bash
* Direct link to tab: <https://docs.wedolow.com/below-technical-documentation/compatibility-guide/bazel#tab-linux-1>
  {% endtab %}

{% tab title="Windows" %}

* Script content:

```powershell
bazel clean //...
```

* Script execution path: In the target directory
* Shell: Pwsh
* Direct link to tab: <https://docs.wedolow.com/below-technical-documentation/compatibility-guide/bazel#tab-windows-1>
  {% endtab %}
  {% endtabs %}

Build

{% tabs %}
{% tab title="Linux" %}

* Script content:

```bash
bazel build //...
```

* Script execution path: In the target directory
* Shell: Bash
* Direct link to tab: <https://docs.wedolow.com/below-technical-documentation/compatibility-guide/bazel#tab-linux-2>
  {% endtab %}

{% tab title="Windows" %}

* Script content:

```powershell
bazel build //...
```

* Script execution path: In the target directory
* Shell: Pwsh
* Direct link to tab: <https://docs.wedolow.com/below-technical-documentation/compatibility-guide/bazel#tab-windows-2>
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wedolow.com/documentation/ressources/compatibility-guide/bazel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
