Skip to content

Commit a9a7215

Browse files
committed
Add README.md
1 parent 537597a commit a9a7215

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## JaCoCo Aggregate Coverage Plugin
2+
The plugin streamlines the generation of a unified code coverage report across multi-module Android projects. It collects and combines coverage data generated by [JaCoCo](https://github.com/jacoco/jacoco) from all subprojects, providing a detailed and comprehensive view of your project's test coverage.
3+
4+
## Features
5+
- Aggregates JaCoCo coverage reports from multiple modules.
6+
- Generates a unified report for overall test coverage visualization.
7+
- Ideal for multi-module Android projects.
8+
- Easy to apply.
9+
10+
> Note: This plugin does not configure the JaCoCo plugin automatically. You must configure the JaCoCo plugin manually within your project. The JaCoCo Aggregate Coverage Plugin requires the JaCoCo report task to be set up since it utilizes these tasks to aggregate reports.
11+
12+
# 1) Getting started
13+
Integrate the JaCoCo Aggregate Coverage Plugin into your project with these steps:
14+
15+
### Step 1: Update the root `build.gradle[.kts]` file
16+
In your root `build.gradle[.kts]` file, add the following plugin configuration:
17+
18+
```gradle
19+
plugins {
20+
...
21+
id "com.azizutku.jacocoaggregatecoverageplugin" version "[write the latest version]" apply true
22+
}
23+
```
24+
25+
### Step 2: Configure the plugin in the root `build.gradle[.kts]` file
26+
```kotlin
27+
configure<JacocoAggregateCoveragePluginExtension> {
28+
jacocoTestReportTask.set("YOUR_JACOCO_TEST_REPORT_TASK")
29+
// Other optional configurations
30+
}
31+
```
32+
33+
# 2) Usage
34+
After applying and configuring the plugin, you can generate the aggregated report by running the following command:
35+
36+
```bash
37+
./gradlew aggregateJacocoReports
38+
```
39+
The unified report will be generated at **`build/reports/jacocoAggregated/index.html`** in the root project.
40+
41+
# Configuration
42+
Configure the plugin in your root-level `build.gradle[.kts]` file:
43+
```kotlin
44+
configure<JacocoAggregateCoveragePluginExtension> {
45+
jacocoTestReportTask.set("jacocoTestDebugUnitTestReport")
46+
// Add the report directory only if you have a custom directory set
47+
configuredCustomReportsDirectory.set("customJacocoReportDir")
48+
// Specify the HTML output location if you have a custom one
49+
configuredCustomHtmlOutputLocation.set("jacocoCustomHtmlFolder")
50+
}
51+
```
52+
- **jacocoTestReportTask**: Required. Specify the task used to generate the JaCoCo report.
53+
- **configuredCustomReportsDirectory**: Optional. Set this if you have a custom reports directory.
54+
- **configuredCustomHtmlOutputLocation**: Optional. Set this if you have a custom directory for the HTML report output.
55+
56+
## Example Aggregated Report
57+
![Example Aggregated Report](images/example_aggregated_report.png)
58+
59+
# Contribution
60+
Contributions are welcome! Please feel free to submit a pull request or open an issue on the GitHub repository.
61+
62+
# License
63+
This project is licensed under the MIT License, allowing modification, distribution, and use in your own projects. Additionally, it incorporates resources and code from JaCoCo, which is covered by the Eclipse Public License v2.0. For detailed license terms, please refer to the [LICENSE](https://github.com/azizutku/jacoco-aggregate-coverage-plugin/blob/main/LICENSE) file.

images/example_aggregated_report.png

150 KB
Loading

0 commit comments

Comments
 (0)