Skip to content

Commit

Permalink
Gradle: add an optional JaCoCo testCodeCoverageReport task to the b…
Browse files Browse the repository at this point in the history
…uild
  • Loading branch information
carlosame committed Sep 20, 2024
1 parent de2c66a commit 9b7eeb5
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ Note that several of those tests are failing (a few being unfinished).

<br/>

#### Code coverage

Generate a JaCoCo code coverage report with:
```shell
./gradlew testCodeCoverageReport
```
The XML and HTML reports can be found under the `echosvg-all/build/reports/jacoco/testCodeCoverageReport`
directory, with the index file for the HTML report being at
```
echosvg-all/build/reports/jacoco/testCodeCoverageReport/html/index.html
```
Pull Requests aimed to increase the code coverage would be welcome.

<br/>

### Benchmarks

This project uses [JMH](https://github.com/openjdk/jmh) for benchmarking. To run
Expand Down
6 changes: 6 additions & 0 deletions buildSrc/src/main/groovy/echosvg.java-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'maven-publish'
id 'org.owasp.dependencycheck'
id 'checkstyle'
id 'jacoco'
id 'com.github.jk1.dependency-license-report'
}

Expand Down Expand Up @@ -184,6 +185,11 @@ tasks.withType(AbstractArchiveTask).configureEach {
}
}

// jacoco
jacocoTestReport {
dependsOn test
}

// Check licenses
licenseReport {
allowedLicensesFile = new File("$rootDir/buildSrc/allowed-licenses.json")
Expand Down
28 changes: 28 additions & 0 deletions echosvg-all/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'org.ajoberstar.grgit'
id 'jacoco-report-aggregation'
id 'echosvg.java-conventions'
}

Expand All @@ -15,6 +16,33 @@ dependencies {
api project(':echosvg-svgpp')
api project(':echosvg-ttf2svg')
api project(':echosvg-svgrasterizer')

// JaCoCo
jacocoAggregation project(':echosvg-anim')
jacocoAggregation project(':echosvg-awt-util')
jacocoAggregation project(':echosvg-bridge')
jacocoAggregation project(':echosvg-codec')
jacocoAggregation project(':echosvg-constants')
jacocoAggregation project(':echosvg-css')
jacocoAggregation project(':echosvg-dom')
jacocoAggregation project(':echosvg-ext')
jacocoAggregation project(':echosvg-extension')
jacocoAggregation project(':echosvg-gui-util')
jacocoAggregation project(':echosvg-gvt')
jacocoAggregation project(':echosvg-i18n')
jacocoAggregation project(':echosvg-parser')
jacocoAggregation project(':echosvg-script')
jacocoAggregation project(':echosvg-slideshow')
jacocoAggregation project(':echosvg-svg-dom')
jacocoAggregation project(':echosvg-svggen')
jacocoAggregation project(':echosvg-svgpp')
jacocoAggregation project(':echosvg-svgrasterizer')
jacocoAggregation project(':echosvg-swing')
jacocoAggregation project(':echosvg-test')
jacocoAggregation project(':echosvg-transcoder')
jacocoAggregation project(':echosvg-ttf2svg')
jacocoAggregation project(':echosvg-util')
jacocoAggregation project(':echosvg-xml')
}

publishing.publications.maven(MavenPublication).pom {
Expand Down

0 comments on commit 9b7eeb5

Please sign in to comment.