Created
January 19, 2016 01:57
-
-
Save ksperling/57b81ea723e319967d24 to your computer and use it in GitHub Desktop.
Multi-module JaCoCo report
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Runs a combined JaCoCo report across all modules in the reactor | |
// Output is placed in the root project's output directory | |
def root = session.topLevelProject | |
def modules = session.projectDependencyGraph.sortedProjects | |
.findAll { it != project && it.packaging != 'pom' } | |
if (!modules.empty) { | |
def jacoco = groovy.xml.NamespaceBuilder.newInstance(ant, 'antlib:org.jacoco.ant') | |
jacoco.report { | |
executiondata { | |
modules.collect { ant.fileset(file: new File(it.build.directory, "jacoco.exec")) } | |
} | |
structure(name: "Combined coverage") { | |
classfiles { | |
modules.collect { ant.fileset(dir: it.build.outputDirectory) } | |
} | |
sourcefiles { | |
modules.collectMany { it.compileSourceRoots.collect { ant.fileset(dir: it) } } | |
} | |
} | |
html(destdir: new File(root.build.directory, "jacoco")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment