Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel1

Introduction

This section explains describes how to register integrate C/C++test as a local repository in a Bazel repositorywith a Bazel build for running static analysis and code coverage.

Note
Collecting code coverage for Bazel is currently not fully supported and remains an experimental feature.

Prerequisites

  • C/C++test installed
  • Bazel version 4.0+
  • Linux only

...

  1. Include the Bazel integration code from C/C++test. To do this, add the following to the project BUILD file:

    Code Block
    load("@cpptest//:integration/bazel/cpptest.bzl", "cpptest_generate_bdf")
  2. Create a list of targets which will be part of the BDF:

    Code Block
    targets = [ "hello-world" ]
  3. Register the targets with a new BDF generation rule by adding the following rule declaration after targets:

    Code Block
    cpptest_generate_bdf(
        name = "make_bdf",
        deps = targets,
    )

    The cpptest_generate_bdf rule has now been registered in the BUILD file.

  4. Save the BUILD file.

...