|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Creating source reports across multiple packagesHi, I have a question for the experts. I am trying to create a coverage report that spans multiple packages and have not found any way to do it. If I don't specify every single package when generating the source report for each package, then I get html pages generated with the "source not found" message. A bit more background: Cobertura either allows you to specify one source directory, or, to
specify any number of filesets to be used to generate the instrumentation.
(This allows you to run the build separately on different packages and still
have correct coverage aggregation and source reports) This is the example given in the Cobertura / ANT documentation:
<fileset dir="${src.dir}">
<include name="**/*.java" />
<exclude name="**/*Stub.java" />
</fileset>
<fileset dir="${guisrc.dir}">
<include name="**/*.java" />
<exclude name="**/*RB.java" />
</fileset> </cobertura-report> The problem I face is that,
unlike the example where there are just two packages / source directories to
include, I have many (ie > 50) and more being added in the future. The question is: How
can I include an entire directory of packages as my fileset directories? What doesn’t work is to specify
wildcards in the fileset dir, and neither does specifying the fileset dir as
the folder that encompasses all of the packages. Also, you cannot use a
<dirset> as part of <cobertura-report>. I’m still trying to fully
understand why just using the directory containing all packages and then
including **/*.java doesn’t work but it seems to have something to do
with how Cobertura looks for the source files. To put it another way, My directories are structured like
so: -objects -SOURCE
--com
---something
----somethingelse
-----etc
-----foo.java When I say <fileset
dir="../Package1/SOURCE/"> it works fine. When I say <fileset
dir="../Package1/"> it does not. (even if I include **/*.java) Any ideas? I realize this is
kind of an obscure question but I would appreciate any thoughts. Thanks, Greg ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Cobertura-devel mailing list Cobertura-devel@... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
|
|
Re: Creating source reports across multiple packagesI would use the Groovy Ant task. http://groovy.codehaus.org/The+groovy+Ant+Task You can then embed groovy into your Ant script. Something
like: <project> <property name="cobertura.dir" value="c:/javastuff/cobertura" /> <path id="cobertura.classpath"> <fileset dir="${cobertura.dir}"> <include name="cobertura.jar" /> <include name="lib/**/*.jar" /> </fileset> </path> <taskdef classpathref="cobertura.classpath" resource="tasks.properties" /> <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"> <classpath> <pathelement location="/java/groovy-1.5.6/embeddable/groovy-all-1.5.6.jar" /> </classpath> </taskdef> <property name="src.dir" value="/my/source" /> <property name="coveragereport.dir" value="reports" /> <target name="report"> <groovy><![CDATA[ def srcDir = new
File(properties.'src.dir') ant.'cobertura-report'(format:'html',
destdir:properties.'coveragereport.dir') { srcDir.eachDirRecurse { dir
-> if (dir.name ==
"SOURCE") { fileset(dir:dir)
{ include(name:'**/*.java') } } } } ]]> </groovy> </target> </project> From:
cobertura-devel-bounces@...
[mailto:cobertura-devel-bounces@...] On Behalf Of Greg
Allen Hi, I have a question for the experts. I am trying to create a coverage report that spans multiple
packages and have not found any way to do it. If I don't specify every
single package when generating the source report for each package, then I get
html pages generated with the "source not found" message. A bit more background: Cobertura either allows you to specify one source
directory, or, to specify any number of filesets to be used to generate the
instrumentation. (This allows you to run the build separately on different
packages and still have correct coverage aggregation and source reports) This is the example given in the Cobertura / ANT documentation:
<fileset dir="${src.dir}">
<include name="**/*.java" />
<exclude name="**/*Stub.java" />
</fileset>
<fileset dir="${guisrc.dir}">
<include name="**/*.java" />
<exclude name="**/*RB.java" />
</fileset> </cobertura-report> The problem I face is that, unlike the example where
there are just two packages / source directories to include, I have many (ie
> 50) and more being added in the future. The question is: How can
I include an entire directory of packages as my fileset directories? What doesn’t work is to specify wildcards in the fileset
dir, and neither does specifying the fileset dir as the folder that encompasses
all of the packages. Also, you cannot use a <dirset> as part of
<cobertura-report>. I’m still trying to fully understand why just using
the directory containing all packages and then including **/*.java doesn’t
work but it seems to have something to do with how Cobertura looks for the
source files. To put it another way, My directories are structured like so: -objects -SOURCE --com ---something
----somethingelse
-----etc
-----foo.java When I say <fileset
dir="../Package1/SOURCE/"> it works fine. When I say <fileset
dir="../Package1/"> it does not. (even if I include **/*.java) Any ideas? I realize this is kind of an obscure
question but I would appreciate any thoughts. Thanks, Greg ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Cobertura-devel mailing list Cobertura-devel@... https://lists.sourceforge.net/lists/listinfo/cobertura-devel |
| Free Forum Powered by Nabble | Forum Help |