Building with Bazel

Code Sight Documentation

Version
2026.5.0

If you run Coverity 2024.3.0 or a newer version, you can use the Bazel build tool.

Before you begin to configure Bazel, please see the "requirements and limitations" for Coverity and Bazel.

To enable the Coverity-Bazel integration:

  1. Follow the steps in the Coverity documentation: See "Building with Bazel" in the Coverity Analysis User and Administrator Guide.

    You will need to modify the Bazel build file and either the workspace file or the module file. More steps are needed if you use Bazel 7 or a newer version.

  2. Add a configuration file to the root of your project (for coverity.conf) or your working directory (for a CLI-based configuration file) and configure it for Bazel support.

    Here is an example of such a configuration file, in JSON format:

    {
        "type": "Coverity configuration",
        "format_version": 1,
        "format_minor_version": 7,
        "settings": {
            "cov_run_desktop": {
                "build_options": [
                    "--bazel"
                ],
                "build_cmd": [
                    "bazel",
                    "build",
                    "--registry=file:///<myLocn>/../../cov-registry",
                    "--registry=http://<myURL>/../packages/bazel/central-registry",
                    ":coverity_build"
                ]
            },
            "ide": {
                "build_strategy": "CUSTOM"
            }
        }
    }

    If you already have a project-specific coverity.conf file, add the "settings" fields to it.