From b4f62462955ce7f526dd759e0152ef3fbf6d4652 Mon Sep 17 00:00:00 2001 From: perlauge Date: Fri, 29 Jun 2012 13:51:04 +0300 Subject: [PATCH 1/5] Update master --- emmaPlugin/emma.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emmaPlugin/emma.gradle b/emmaPlugin/emma.gradle index 40938dd..fbe47a2 100644 --- a/emmaPlugin/emma.gradle +++ b/emmaPlugin/emma.gradle @@ -65,7 +65,7 @@ test { // We create three types (txt, html, xml) of reports here. Running your build script now should // result in output like that: doLast { - def srcDir = sourceSets.main.java.srcDirs.toArray()[0] + def srcDir = sourceSets.main.java.srcDirs.toArray().join(',') println "Creating test coverage reports for classes " + srcDir def emmaInstDir = new File(sourceSets.main.output.classesDir.parentFile.parentFile, "tmp/emma") ant.emma(enabled:"true"){ From e6ef91a37089c6c016fd04c87153ca8f7b2d56c0 Mon Sep 17 00:00:00 2001 From: perlauge Date: Mon, 2 Jul 2012 10:42:39 +0300 Subject: [PATCH 2/5] no need to cast the list of source directories to an array before joining them. --- emmaPlugin/emma.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emmaPlugin/emma.gradle b/emmaPlugin/emma.gradle index fbe47a2..bbcba1d 100644 --- a/emmaPlugin/emma.gradle +++ b/emmaPlugin/emma.gradle @@ -65,7 +65,7 @@ test { // We create three types (txt, html, xml) of reports here. Running your build script now should // result in output like that: doLast { - def srcDir = sourceSets.main.java.srcDirs.toArray().join(',') + def srcDir = sourceSets.main.java.srcDirs.join(',') println "Creating test coverage reports for classes " + srcDir def emmaInstDir = new File(sourceSets.main.output.classesDir.parentFile.parentFile, "tmp/emma") ant.emma(enabled:"true"){ From aae747b44d047255acf260e9c6951289a9384482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lauge=20Bures=F8=20Holst?= Date: Mon, 2 Jul 2012 11:35:14 +0200 Subject: [PATCH 3/5] leverage usage of convention paths --- emmaPlugin/emma.gradle | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/emmaPlugin/emma.gradle b/emmaPlugin/emma.gradle index bbcba1d..39a4bcb 100644 --- a/emmaPlugin/emma.gradle +++ b/emmaPlugin/emma.gradle @@ -36,7 +36,7 @@ class EmmaPluginConvention{ test { // add EMMA related JVM args to our tests - jvmArgs "-XX:-UseSplitVerifier", "-Demma.coverage.out.file=$buildDir/tmp/emma/metadata.emma", "-Demma.coverage.out.merge=true" + jvmArgs "-XX:-UseSplitVerifier", "-Demma.coverage.out.file=$metaDataFilePath", "-Demma.coverage.out.merge=true" doFirst { println "Instrumenting the classes at " + sourceSets.main.output.classesDir.absolutePath @@ -46,7 +46,7 @@ test { ant.path(id:"run.classpath") { pathelement(location:sourceSets.main.output.classesDir.absolutePath) } - def emmaInstDir = new File(sourceSets.main.output.classesDir.parentFile.parentFile, "tmp/emma/instr") + def emmaInstDir = new File(instrDir) emmaInstDir.mkdirs() println "Creating $emmaInstDir to instrument from " + sourceSets.main.output.classesDir.absolutePath // instruct our compiled classes and store them at $buildDir/tmp/emma/instr @@ -58,7 +58,7 @@ test { } } } - setClasspath(files("$buildDir/tmp/emma/instr") + configurations.emma + getClasspath()) + setClasspath(files(instrDir) + configurations.emma + getClasspath()) } // The report should be generated directly after the tests are done. @@ -69,19 +69,19 @@ test { println "Creating test coverage reports for classes " + srcDir def emmaInstDir = new File(sourceSets.main.output.classesDir.parentFile.parentFile, "tmp/emma") ant.emma(enabled:"true"){ - new File("$buildDir/reports/emma").mkdirs() + new File(reportPath).mkdirs() report(sourcepath: srcDir){ fileset(dir: emmaInstDir.absolutePath){ include(name:"**/*.emma") } - txt(outfile:"$buildDir/reports/emma/coverage.txt") - html(outfile:"$buildDir/reports/emma/coverage.html") - xml(outfile:"$buildDir/reports/emma/coverage.xml") + txt(outfile:"$reportPath/coverage.txt") + html(outfile:"$reportPath/coverage.html") + xml(outfile:"$reportPath/coverage.xml") } } - println "Test coverage reports available at $buildDir/reports/emma." - println "txt: $buildDir/reports/emma/coverage.txt" - println "Test $buildDir/reports/emma/coverage.html" - println "Test $buildDir/reports/emma/coverage.xml" + println "Test coverage reports available at $reportPath." + println "txt: $reportPath/coverage.txt" + println "Test $reportPath/coverage.html" + println "Test $reportPath/coverage.xml" } } From 9c0fcde6ef365dc6f1dd5dc093d5531bfce40bdd Mon Sep 17 00:00:00 2001 From: perlauge Date: Fri, 6 Jul 2012 14:54:12 +0300 Subject: [PATCH 4/5] fixed the deprecated reportsDir reference --- emmaPlugin/emma.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emmaPlugin/emma.gradle b/emmaPlugin/emma.gradle index 39a4bcb..d13d27d 100644 --- a/emmaPlugin/emma.gradle +++ b/emmaPlugin/emma.gradle @@ -26,10 +26,10 @@ class EmmaPluginConvention{ } EmmaPluginConvention(Project project){ - reportPath = "${project.reportsDir.absolutePath}/emma" + reportPath = "${project.reporting.baseDir.absolutePath}/emma" coverageFileName = "coverage" - tmpDir = "${project.buildDir}/tmp/emma" - instrDir = "${tmpDir}/instr" + tmpDir = "${project.buildDir}/tmp/emma" + instrDir = "${tmpDir}/instr" metaDataFilePath = "${tmpDir}/metadata.emma" } } From 2f3312f5639ca2ee82859ad2136db24406caaab6 Mon Sep 17 00:00:00 2001 From: perlauge Date: Tue, 17 Jul 2012 11:21:28 +0300 Subject: [PATCH 5/5] created a test-task called emma as opposed to modifying the root test task itself - this should allow builds with both cobertura and emma. --- emmaPlugin/emma.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emmaPlugin/emma.gradle b/emmaPlugin/emma.gradle index d13d27d..4d95311 100644 --- a/emmaPlugin/emma.gradle +++ b/emmaPlugin/emma.gradle @@ -34,7 +34,7 @@ class EmmaPluginConvention{ } } -test { +task emma(type: Test) { // add EMMA related JVM args to our tests jvmArgs "-XX:-UseSplitVerifier", "-Demma.coverage.out.file=$metaDataFilePath", "-Demma.coverage.out.merge=true"