Created
June 13, 2011 16:49
-
-
Save bluepapa32/1023156 to your computer and use it in GitHub Desktop.
Gradle で EMMA してみる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configurations { | |
emma | |
} | |
dependencies { | |
emma "emma:emma:2.1.5320" | |
emma "emma:emma_ant:2.1.5320" | |
} | |
tmpDir = new File(buildDir, "tmp") | |
emmaReportDirName = "emma" | |
emmaReportDir = new File(reportsDir, emmaReportDirName) | |
emmaTmpDirName = "emma" | |
emmaTmpDir = new File(tmpDir, emmaTmpDirName) | |
emmaInstrDirName = "instr" | |
emmaInstrDir = new File(emmaTmpDir, emmaInstrDirName) | |
emmaMetaDataFileName = "metadata.em" | |
emmaMetaDataFile = new File(emmaTmpDir, emmaMetaDataFileName) | |
test{ | |
jvmArgs "-Demma.coverage.out.file=${emmaMetaDataFile}", | |
"-Demma.coverage.out.merge=true", | |
"-Demma.rt.control=false" | |
doFirst { | |
ant.taskdef(resource: "emma_ant.properties", | |
classpath: configurations.emma.asPath) | |
ant.emma { | |
instr(instrpath: "${sourceSets.main.classesDir}", | |
destdir: "${emmaInstrDir}", | |
metadatafile: "${emmaMetaDataFile}", | |
merge: "true") | |
} | |
classpath = files(emmaInstrDir) + configurations.emma + classpath | |
} | |
doLast { | |
ant.emma { | |
report { | |
infileset(file: "${emmaMetaDataFile}") | |
sourcepath { | |
sourceSets.main.java.srcDirs.each { pathelement(location: "${it}") } | |
} | |
txt(outfile: "${emmaReportDir}/coverage.txt") | |
html(outfile: "${emmaReportDir}/coverage.html") | |
xml(outfile: "${emmaReportDir}/coverage.xml") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment