Added project property to enable test coverage.

This commit is contained in:
Luke Taylor 2010-08-22 14:29:31 +01:00
parent 2c219f7a66
commit 5fe589e360
1 changed files with 9 additions and 7 deletions

View File

@ -29,13 +29,15 @@ task emmaInstrument {
// 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())
if (project.hasProperty('coverage') && ['on','true'].contains(project.properties.coverage)) {
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())
}
}
}
}