I'm using cobertura to calculate test coverage. I want my ant script to echo coverage information about specific packages.
So far, I have:
<target name="coverage-check">
<loadfile property="coveragexml" srcFile="${coverage.report.dir}/coverage.xml">
<filterchain>
<linecontains negate="true">
<contains value="!DOCTYPE"/>
</linecontains>
</filterchain>
</loadfile>
<xmlproperty validate="false">
<string value="${coveragexml}"/>
</xmlproperty>
</target>
This works to load the various cobertura information into ant variables like: coverage.packages.package(name)=lots,of,package,names
.
I'd like to find a way to appropriate a specific package name (from one variable) to coverage metrics stored in other variables. If I were using python, lisp, or the like, I'd zip them together, then search. I don't know how to do zipping or searching in ant.
I made an example with use of xmltask
The snipped copied from the source xml can unfortunately not echoed by default, but written to another file.
It's not a solution but an example that may be helps.
I think it would be less work to write a custom ant task your self.