From 969f0ebe5111ebeafa643fb1f55b974d00f2f34f Mon Sep 17 00:00:00 2001 From: John Gasper Date: Wed, 29 Jan 2025 19:09:17 -0800 Subject: [PATCH] Adding code coverage --- gradle.properties | 2 +- lib/build.gradle | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0f99672..b2a9ee8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -version=0.0.5-SNAPSHOT +version=0.0.6-SNAPSHOT diff --git a/lib/build.gradle b/lib/build.gradle index 8c98f8f..6dfe427 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -9,6 +9,7 @@ plugins { // Apply the java-library plugin for API and implementation separation. id 'java-library' + id 'jacoco' id 'maven-publish' } @@ -16,6 +17,10 @@ repositories { mavenCentral() } +jacoco { + toolVersion = "0.8.12" +} + sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -48,15 +53,29 @@ dependencies { testImplementation 'org.json:json:20211205' } -test { - useJUnitPlatform() -} - java { withSourcesJar() withJavadocJar() } +tasks.withType(JavaCompile) { + options.debug = true + options.debugOptions.debugLevel = 'lines,vars,source' +} + +jacocoTestReport { + reports { + xml.required = false + csv.required = false + html.outputLocation = file("${buildDir}/jacocoHtml") + } +} + +test { + useJUnitPlatform() + finalizedBy jacocoTestReport +} + publishing { publications { maven(MavenPublication) {