Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make emma config paths configurable

  • Loading branch information...
commit dac91de04b6876c9f918d6c3d23a5135dcbbce5f 1 parent 5d87e50
Rene Groeschke authored
Showing with 45 additions and 15 deletions.
  1. +39 −14 emmaPlugin/emma.gradle
  2. +6 −1 emmaPlugin/sample/build.gradle
View
53 emmaPlugin/emma.gradle
@@ -1,19 +1,44 @@
apply plugin:'java'
-String EMMA_REPORT_PATH = "${reportsDir.absolutePath}/emma"
-String EMMA_COVERAGE_FILE_NAME_PATH = "coverage"
-String EMMA_TMP_DIR = "$buildDir/tmp/emma"
-String EMMA_INSTR_DIR = EMMA_TMP_DIR + "/instr"
-String EMMA_META_DATA_FILEPATH = EMMA_TMP_DIR + "/metadata.emma"
-String EMMA_VERBOSITY_LEVEL = "info"
+//def EMMA_REPORT_PATH = "${reportsDir.absolutePath}/emma"
+//def EMMA_COVERAGE_FILE_NAME_PATH = "coverage"
+//def EMMA_TMP_DIR = "$buildDir/tmp/emma"
+//def EMMA_INSTR_DIR = "${EMMA_TMP_DIR}/instr"
+//def EMMA_META_DATA_FILEPATH = "${EMMA_TMP_DIR}/metadata.emma"
+//def EMMA_VERBOSITY_LEVEL = "info"
configurations{
emma
}
+def emmaConvention = new EmmaPluginConvention(project)
+project.convention.plugins.emma = emmaConvention
+
+class EmmaPluginConvention{
+ def verbosityLevel = "info"
+ def reportPath;
+ def coverageFileName;
+ def tmpDir;
+ def instrDir;
+ def metaDataFilePath;
+
+ def emma(Closure close){
+ close.delegate = this;
+ close.run()
+ }
+
+ EmmaPluginConvention(Project project){
+ reportPath = "${project.reportsDir.absolutePath}/emma"
+ coverageFileName = "coverage"
+ tmpDir = "${project.buildDir}/tmp/emma"
+ instrDir = "${tmpDir}/instr"
+ metaDataFilePath = "${tmpDir}/metadata.emma"
+ }
+}
+
test{
//setup JVM Arguments for emma coverage
- jvmArgs "-Demma.coverage.out.file=$EMMA_META_DATA_FILEPATH", "-Demma.coverage.out.merge=true"
+ jvmArgs "-Demma.coverage.out.file=${emmaConvention.metaDataFilePath}", "-Demma.coverage.out.merge=true"
//add
doFirst{
@@ -21,25 +46,25 @@ test{
ant.path(id:"run.classpath"){
pathelement(location:sourceSets.main.classesDir.absolutePath )
}
- ant.emma(verbosity:EMMA_VERBOSITY_LEVEL){
- instr(merge:"true", destdir:EMMA_INSTR_DIR, instrpathref:"run.classpath", metadatafile:EMMA_META_DATA_FILEPATH){
+ ant.emma(verbosity:"${emmaConvention.verbosityLevel}"){
+ instr(merge:"true", destdir:"${emmaConvention.instrDir}", instrpathref:"run.classpath", metadatafile:"${emmaConvention.metaDataFilePath}"){
instrpath{
fileset(dir:sourceSets.main.classesDir.absolutePath, includes:"*.class")
}
}
}
- setClasspath(files(EMMA_INSTR_DIR) + configurations.emma + getClasspath())
+ setClasspath(files("${emmaConvention.instrDir}") + configurations.emma + getClasspath())
}
doLast{
ant.emma(enabled:"true"){
report(sourcepath:"src/main/java"){
- fileset(dir:EMMA_TMP_DIR){
+ fileset(dir:"${emmaConvention.tmpDir}"){
include(name:"*.emma")
}
- txt(outfile:"$EMMA_REPORT_PATH/coverage.txt")
- html(outfile:"$EMMA_REPORT_PATH/coverage.html")
- xml(outfile:"$EMMA_REPORT_PATH/coverage.xml")
+ txt(outfile:"${emmaConvention.reportPath}/coverage.txt")
+ html(outfile:"${emmaConvention.reportPath}/coverage.html")
+ xml(outfile:"${emmaConvention.reportPath}/coverage.xml")
}
}
}
View
7 emmaPlugin/sample/build.gradle
@@ -1,5 +1,6 @@
apply plugin:'java'
-apply from:'http://github.com/breskeby/gradleplugins/raw/master/emmaPlugin/emma.gradle'
+//apply from:'http://github.com/breskeby/gradleplugins/raw/master/emmaPlugin/emma.gradle'
+apply from:"file:../emma.gradle"
repositories{
mavenCentral()
@@ -11,3 +12,7 @@ dependencies{
testCompile "junit:junit:4.7"
}
+
+emma{
+ reportPath = "blubb"
+}
Please sign in to comment.
Something went wrong with that request. Please try again.