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 // Modify test tasks in the project to generate coverage data
afterEvaluate { afterEvaluate {
tasks.withType(Test.class).each { task -> if (project.hasProperty('coverage') && ['on','true'].contains(project.properties.coverage)) {
task.dependsOn emmaInstrument tasks.withType(Test.class).each { task ->
task.configure() { task.dependsOn emmaInstrument
jvmArgs "-Demma.coverage.out.file=$emmaMetaDataFile", "-Demma.coverage.out.merge=true" task.configure() {
} jvmArgs "-Demma.coverage.out.file=$emmaMetaDataFile", "-Demma.coverage.out.merge=true"
task.doFirst { }
setClasspath(files("$buildDir/emma/classes") + configurations.emma + getClasspath()) task.doFirst {
setClasspath(files("$buildDir/emma/classes") + configurations.emma + getClasspath())
}
} }
} }
} }