Created
January 22, 2012 17:32
-
-
Save stevendick/1657770 to your computer and use it in GitHub Desktop.
Gradle & JaCoCo
This file contains hidden or 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
task generateCoverageReport << { | |
ant { | |
taskdef(name:'jacocoreport', classname: 'org.jacoco.ant.ReportTask') { | |
classpath path: "${rootProject.projectDir.path}/lib/jacocoant.jar" | |
} | |
mkdir dir: "${buildDirName}/reports/coverage" | |
jacocoreport { | |
executiondata { | |
fileset(dir: "${buildDirName}/coverage-results") { | |
ant.file file: 'jacoco.exec' | |
} | |
} | |
structure(name: project.name) { | |
classfiles { | |
fileset dir: "${project.buildDir.path}/classes/main" | |
} | |
// this is for Windows | |
sourcefiles(encoding: 'CP1252') { | |
fileset dir: "${project.projectDir.path}/src/main/java" | |
} | |
} | |
xml destfile: "${buildDirName}/reports/coverage/jacoco.xml" | |
html destdir: "${buildDirName}/reports/coverage" | |
} | |
} | |
} |
This file contains hidden or 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
dependencies { | |
codeCoverage files("${rootProject.projectDir.path}/lib/jacocoagent.jar") | |
} | |
test { | |
jvmArgs "-javaagent:${configurations.codeCoverage.singleFile}=destfile=${buildDirName}/coverage-results/jacoco.exec,sessionid=HSServ,append=false", | |
'Djacoco=true', | |
'-Xms128m', | |
'-Xmx512m', | |
'-XX:MaxPermSize=128m' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how does this compare to https://github.com/gschmidl/jacoco-gradle ?