From 21c0d2c9a77651cd99765794eefa21657dcbafd5 Mon Sep 17 00:00:00 2001 From: Jackson Bailey Date: Sun, 30 Jun 2024 20:34:40 -0400 Subject: [PATCH] Add jacoco --- ...iley.wheel.java-common-conventions.gradle.kts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/dev.jacksonbailey.wheel.java-common-conventions.gradle.kts b/buildSrc/src/main/kotlin/dev.jacksonbailey.wheel.java-common-conventions.gradle.kts index 58867c0..0b64926 100644 --- a/buildSrc/src/main/kotlin/dev.jacksonbailey.wheel.java-common-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/dev.jacksonbailey.wheel.java-common-conventions.gradle.kts @@ -1,5 +1,6 @@ plugins { id("dev.jacksonbailey.wheel.base-common-conventions") + jacoco java } @@ -11,16 +12,29 @@ java { withSourcesJar() } +jacoco { + toolVersion = "0.8.12" // https://www.jacoco.org/jacoco/ +} + tasks { withType { // TODO Check that -g is actually adding debug info because it seems like it's already there options.compilerArgs.addAll(listOf("-Xlint:all", "-g")) } - named("test") { + test { useJUnitPlatform() + finalizedBy(tasks.jacocoTestReport) + } + + jacocoTestReport { + dependsOn(tasks.test) } + /* + * Using jar { } will only apply to tasks named "jar" so the license would not end up in the + * javadoc jar nor source jar. + */ withType { metaInf { from(layout.projectDirectory.file("LICENSE"))