Reputation: 10379
I build my project with Gradle 1.0 and I use the EMMA plugin for code coverage info. I would like to exclude certain files from the coverage report.
How can I achieve that?
Upvotes: 0
Views: 1101
Reputation: 88
This doesn't work with gradle 1.5. Emma takes a filter like so:
ant.emma(enabled: 'true', verbosity: $verbosityLevel) {
instr(merge: "true", destdir: emmaInstDir.absolutePath, instrpathref: "run.classpath",
metadatafile: new File(emmaInstDir, '/metadata.emma').absolutePath, filter: "-com.someclass.*" ) {
instrpath {
fileset(dir: sourceSets.main.output.classesDir.absolutePath, includes: "**/*.class" )
}
}
}
the filter follows the definition from this page: http://emma.sourceforge.net/reference/ch02s06s02.html
Upvotes: 0
Reputation: 33456
Are you including this Gradle script? I think you can exclude classes within your instrumentation definition (see example below). However, it doesn't look like you can set the exclude pattern by using a convention property.
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", excludes:"**/Some*.class")
}
}
}
If I were you I'd try to fork the plugin, add a new field to EmmaPluginConvention
that lets you set the exclude pattern and then use that variable in the instrpath
definition. After changing the code and verifying that it works send a pull request to the author. I am sure he will incorporate your change.
Upvotes: 1