Cake.OpenCppCoverage
1.0.0
dotnet add package Cake.OpenCppCoverage --version 1.0.0
NuGet\Install-Package Cake.OpenCppCoverage -Version 1.0.0
<PackageReference Include="Cake.OpenCppCoverage" Version="1.0.0" />
<PackageVersion Include="Cake.OpenCppCoverage" Version="1.0.0" />
<PackageReference Include="Cake.OpenCppCoverage" />
paket add Cake.OpenCppCoverage --version 1.0.0
#r "nuget: Cake.OpenCppCoverage, 1.0.0"
#:package Cake.OpenCppCoverage@1.0.0
#addin nuget:?package=Cake.OpenCppCoverage&version=1.0.0
Cake.OpenCppCoverage
A Cake build extension for collecting code coverage using OpenCppCoverage.
Installation
Cake.OpenCppCoverage can be installed from the package manager console:
Install-Package Cake.OpenCppCoverage
It can also be used via a reference in your Cake build script using the #addin
directive:
#addin nuget:?package=Cake.OpenCppCoverage
For this extension to work, OpenCppCoverage must be installed prior to execution. The releases for OpenCppCoverage can be found here: https://github.com/OpenCppCoverage/OpenCppCoverage/releases
Usage
To use this extension you create an OpenCppCoverage process runner, and use it to execute another process, which is typically the process running some tests. The OpenCppCoverage process runner executes OpenCppCoverage, passing it the path to your executable and any parameters you want to give to it.
Running the coverage process with default options will gather some coverage, but it will be incomplete without you providing more information. You will want to provide an output location for the coverage data, and the type of data you want it to output. You will also want to tell it what source files and modules to include in the data, for which wildcards are supported.
A typical usage may look like this:
var coverageOutputDirectory = DirectoryPath.FromString(coverageOutputPath);
var processRunner = GetOpenCppCoverageRunner(new OpenCppCoverageSettings
{
WorkingDirectory = coverageOutputDirectory,
Sources = [GetRootedPath("src/*"))],
Modules = ["*"],
ExportTypes = [new Cake.OpenCppCoverage.Export.HtmlExportType(coverageOutputDirectory)]
});
var result = GoogleTestRun(processRunner, GetRootedPath(executable), new GoogleTestSettings
{
Output = new XmlTestOutput(GetRootedPath(outputFile))
});
Settings
The available settings for OpenCppCoverage can be found here: https://github.com/OpenCppCoverage/OpenCppCoverage/wiki/Command-line-reference
All settings can be set using the OpenCppCoverageSettings
class, with the following associations:
Field | Setting |
---|---|
Verbose | --verbose |
Quiet | --quiet |
ConfigFile | --config_file |
Modules | --modules |
ExcludedModules | --excluded_modules |
Sources | --sources |
ExcludedSources | --excluded_sources |
InputCoverage | --input_coverage |
ExportTypes | --export_type |
CoverChildren | --cover_children |
NoAggregateByFile | --no_aggregate_by_file |
UnifiedDiffs | --unified_diff |
ContinueAfterCppException | --continue_after_cpp_exception |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Cake.Core (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 192 | 7/20/2025 |