apply plugin:'java' configurations{ emma } dependencies{ emma "emma:emma:2.1.5320" emma "emma:emma_ant:2.1.5320" } 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.reporting.baseDir.absolutePath}/emma" coverageFileName = "coverage" tmpDir = "${project.buildDir}/tmp/emma" instrDir = "${tmpDir}/instr" metaDataFilePath = "${tmpDir}/metadata.emma" } } 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" doFirst { println "Instrumenting the classes at " + sourceSets.main.output.classesDir.absolutePath // define the custom EMMA ant tasks ant.taskdef( resource:"emma_ant.properties", classpath: configurations.emma.asPath) 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") 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 ant.emma(enabled: 'true', verbosity:'info'){ instr(merge:"true", destdir: emmaInstDir.absolutePath, instrpathref:"run.classpath", metadatafile: new File(emmaInstDir, '/metadata.emma').absolutePath) { instrpath { fileset(dir:sourceSets.main.output.classesDir.absolutePath, includes:"**/*.class") } } } setClasspath(files("$buildDir/tmp/emma/instr") + configurations.emma + getClasspath()) } // The report should be generated directly after the tests are done. // 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] 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() report(sourcepath: srcDir){ fileset(dir: emmaInstDir.absolutePath){ include(name:"**/*.emma") } txt(outfile:"$buildDir/reports/emma/coverage.txt", encoding: "UTF-8") html(outfile:"$buildDir/reports/emma/coverage.html", encoding: "UTF-8") xml(outfile:"$buildDir/reports/emma/coverage.xml", encoding: "UTF-8") } } 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" } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 18494 | Paul Allen |
Fixed paths: search/search/... to search/... util/util/... to util/... Fixed permission bits +w for config and properties file that get touched during build/install Fixed INSTALL file and install dir (cause name clash on OS X) moved INSTALL to INSTALL.md |
||
//guest/perforce_software/p4search/main/search/search/test/gradle/emma.gradle | |||||
#1 | 16193 | perforce_software | Move p4search to main directory to match new branching path scheme. | ||
//guest/perforce_software/p4search/search/test/gradle/emma.gradle | |||||
#1 | 8975 | Matt Attaway | Populate official version of p4-search from the original Doug Scheirer source | ||
//guest/doug_scheirer/p4-search/search/test/gradle/emma.gradle | |||||
#1 | 8476 | Doug Scheirer | p4-search copy from //depot/main/p4-search |