Now supports several compile and test directory sets.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114446 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol 2003-12-05 14:17:22 +00:00
parent 3f531866aa
commit 2b27d00da4
3 changed files with 34 additions and 8 deletions

View File

@ -83,24 +83,39 @@
<j:set var="maven.junit.fork" scope="parent" value="true"/>
<echo>Setting Clover compiler</echo>
<ant:property name="compileSrcSetString" refid="maven.compile.src.set"/>
<ant:property name="compileTestSetString" refid="maven.test.compile.src.set"/>
<!-- Transforming Ant path structure into a list of dirs that can be used
to define an Ant fileset. We're using <pathconvert> to automatically
separate dirs with a known delimiter independently of any platform -->
<ant:pathconvert property="compileSrcSetString" pathSep="||||"
refid="maven.compile.src.set"/>
<u:tokenize var="srcDirs" delim="||||">${compileSrcSetString}</u:tokenize>
<ant:pathconvert property="testSrcSetString" pathSep="||||"
refid="maven.test.compile.src.set"/>
<u:tokenize var="testDirs" delim="||||">${testSrcSetString}</u:tokenize>
<ant:clover-setup
initstring="${cloverDatabase}"
flushpolicy="interval"
flushinterval="500">
<!-- TODO: Support several paths in compileSrcSetString and compileTestSetString -->
<ant:fileset dir="${compileSrcSetString}">
<ant:include name="**/*.java"/>
</ant:fileset>
<j:if test="${context.getVariable('maven.clover.instrument.tests') == 'true'}">
<ant:fileset dir="${compileTestSetString}">
<j:forEach var="srcDir" items="${srcDirs}">
<ant:fileset dir="${srcDir}">
<ant:include name="**/*.java"/>
</ant:fileset>
</j:forEach>
<!-- Conditionally instrument test code -->
<j:if test="${context.getVariable('maven.clover.instrument.tests') == 'true'}">
<j:forEach var="testDir" items="${testDirs}">
<ant:fileset dir="${testDir}">
<ant:include name="**/*.java"/>
</ant:fileset>
</j:forEach>
</j:if>
</ant:clover-setup>
<echo>Now using primary build.compiler : ${build.compiler}</echo>
<j:set var="tmp" value="${maven.build.clover.classes}"/>

View File

@ -3,6 +3,7 @@
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:x="jelly:xml"
xmlns:maven="jelly:maven"
xmlns:assert="assert">
<goal name="testPlugin">
@ -10,6 +11,15 @@
<!-- Fixture -->
<attainGoal name="clean"/>
<!-- Make sure (to some extent) that we support multiple source and
test paths -->
<ant:mkdir dir="${maven.build.dir}/clovertestdir"/>
<ant:path id="test.classpath">
<ant:pathelement path="${maven.build.dir}/clovertestdir"/>
</ant:path>
<maven:addPath id="maven.compile.src.set" refid="test.classpath"/>
<maven:addPath id="maven.test.compile.src.set" refid="test.classpath"/>
<!-- Call goal to test -->
<attainGoal name="site"/>

View File

@ -1 +1,2 @@
maven.clover.report.xml = true
maven.clover.instrument.tests = true