A fast, drop-in replacement for Bazel's CoverageOutputGenerator written in Rust.
This tool merges and processes coverage data from multiple formats (LCOV, gcov text, gcov JSON) into a unified LCOV output format. It's designed to be a high-performance alternative to the Java-based CoverageOutputGenerator used in Bazel builds.
- Multiple Format Support: LCOV, gcov text format, and gcov JSON format
- High Performance: Parallel processing with Rayon for fast merging of large coverage datasets
- 100% Java Compatibility: Produces identical output to the original Java implementation
- GZIP Support: Automatic detection and decompression of compressed coverage files
- Robust Error Handling: Comprehensive validation and clear error messages
- CLI Compatible: Drop-in replacement with identical command-line interface
- Dropped Features:
- Serial processing (this version uses parallel processing only)
- BA line records (not valid LCOV format)
- LCOV: Standard Linux Test Project format
- gcov Text: Traditional gcov intermediate format
- gcov JSON: Modern JSON-based gcov format
- Compressed Files: Automatic GZIP decompression
- LCOV: Industry-standard format compatible with all major coverage tools
For quick testing, add this to your root MODULE.bazel
and create an alias in your build file. Then run bazel coverage with --coverage_report_generator=//:coverage_report_generator
:
MODULE.bazel
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rusty_coverage_output_generator",
sha256 = "21625bed96e0c3856dd12d2ea6d0cf5d7c459fb66024cab3bc6bfdffe0e782f2",
urls = [
"https://github.com/orbl/rusty_coverage_output_generator/releases/download/v1.0/coverage_output_generator_release.tar",
],
)
BUILD
alias(
name = "coverage_report_generator",
actual = "@rusty_coverage_output_generator//:cog",
tags = ["manual"],
)
If you wish to make your own version, create the release tar by running:
bazel build coverage_output_generator_release
You can serve the file on localhost for quick testing:
#!/usr/bin/env python3
from flask import Flask, send_file
app = Flask(__name__)
FILE_PATH = "bazel-bin/coverage_output_generator_release.tar"
@app.route('/bazel-bin/coverage_output_generator_release.tar')
def serve_file():
return send_file(FILE_PATH)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8000)
- Platform Support: This has only been tested on Linux
- Development: Built with ChatGPT 4.1 and Claude Sonnet 4 with human intervention and oversight
- Error Handling: The original Java version allowed errors to pass with no warnings. This implementation is less forgiving, which should save you hours of debugging to find out why your coverage looks weird.
Contributions are welcome! Please feel free to submit a Pull Request.