From 5fe589e36074d51409c9ad5f87daf6564877534c Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Sun, 22 Aug 2010 14:29:31 +0100 Subject: [PATCH] Added project property to enable test coverage. --- gradle/emma.gradle | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gradle/emma.gradle b/gradle/emma.gradle index 2926092e3a..5fa1ee3c19 100644 --- a/gradle/emma.gradle +++ b/gradle/emma.gradle @@ -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()) + } } } }