spring-security/gradle/emma.gradle

63 lines
2.1 KiB
Groovy
Raw Normal View History

2010-08-21 10:58:59 -04:00
configurations{
emma
}
dependencies{
emma "emma:emma:2.0.5312"
emma "emma:emma_ant:2.0.5312"
}
def emmaMetaDataFile = "${rootProject.buildDir}/emma/metadata.emma"
task emmaInstrument {
dependsOn compileJava
2010-08-21 10:58:59 -04:00
doFirst {
ant.taskdef(resource:"emma_ant.properties", classpath: configurations.emma.asPath)
ant.path(id: "emmarun.classpath") {
pathelement(location: sourceSets.main.classesDir.absolutePath)
}
ant.emma(verbosity: "info") {
instr(merge: "true", destdir: "$buildDir/emma/classes", instrpathref: "emmarun.classpath", metadatafile: "$emmaMetaDataFile") {
2010-08-21 10:58:59 -04:00
instrpath {
fileset(dir: sourceSets.main.classesDir.absolutePath, includes: "*.class")
}
}
}
}
}
// Modify test tasks in the project to generate coverage data
afterEvaluate {
tasks.withType(Test.class).each { task ->
task.dependsOn emmaInstrument
task.configure() {
jvmArgs "-Demma.coverage.out.file=$emmaMetaDataFile", "-Demma.coverage.out.merge=true"
}
task.doFirst {
setClasspath(files("$buildDir/emma/classes") + configurations.emma + getClasspath())
}
2010-08-21 10:58:59 -04:00
}
}
if (rootProject.getTasksByName('coverageReport', false).isEmpty()) {
rootProject.task('coverageReport') << {
ant.taskdef(resource:"emma_ant.properties", classpath: configurations.emma.asPath)
ant.path(id: "src.path") {
coreModuleProjects.each {module->
module.sourceSets.main.java.srcDirs.each {
pathelement(location: it.absolutePath )
}
}
}
ant.emma(enabled: "true", verbosity: "info") { // use "verbose, trace1, trace2, trace3 for more info"
report(sourcepathref:"src.path") {
fileset(file: "$emmaMetaDataFile")
txt(outfile: "$rootProject.buildDir/emma/coverage.txt")
html(outfile: "$rootProject.buildDir/emma/coverage.html")
// xml(outfile: "$rootProject.buildDir/emma/coverage.xml")
}
}
}
}