From 9b68ee67d972f87c60b136ef7960b5e51ea23ce1 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Tue, 24 Jul 2018 13:00:57 +0200 Subject: [PATCH] Add jacoco --- build.gradle | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/build.gradle b/build.gradle index 2a001f46..c6d15747 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,7 @@ allprojects { apply plugin: 'java' apply plugin: 'idea' apply plugin: 'eclipse' + apply plugin: 'jacoco' apply plugin: 'checkstyle' // animalsniffer @@ -75,6 +76,19 @@ allprojects { 'git tag --points-at HEAD'.execute().text.trim()) } + jacoco { + toolVersion = "0.8.1" + } + + jacocoTestReport { + dependsOn test + sourceDirectories = project.files(sourceSets.main.allSource.srcDirs) + classDirectories = project.files(sourceSets.main.output) + reports { + xml.enabled true + } + } + } subprojects { @@ -199,6 +213,20 @@ def getGitCommit() { gitCommit } +/* +task jacocoRootReport(type: JacocoReport) { + reports { + xml.enabled true + xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml") + } + // We could remove the following setOnlyIf line, but then + // jacocoRootReport would silently be SKIPPED if something with + // the projectsWithUnitTests is wrong (e.g. a project is missing + // in there). + setOnlyIf { true } +} +*/ + task javadocAll(type: Javadoc) { source subprojects.collect {project -> project.sourceSets.main.allJava }