evenisse    2004/05/28 03:27:27

  Modified:    jcoverage plugin.jelly
               jcoverage/xdocs changes.xml
  Log:
  MPJCOVERAGE-8. Fixed report generation fails when no java source present.
  
  Revision  Changes    Path
  1.13      +60 -53    maven-plugins/jcoverage/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/jcoverage/plugin.jelly,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- plugin.jelly      27 May 2004 01:14:12 -0000      1.12
  +++ plugin.jelly      28 May 2004 10:27:27 -0000      1.13
  @@ -159,60 +159,67 @@
           description="Generate HTML test coverage reports with JCoverage"
           prereqs="jcoverage:on,test:test">
   
  -    <j:catch var="ex">
  -
  -      <j:set var="sourceDir" 
value="${context.getAntProject().getReferences().get('maven.compile.src.set')}" />
  -      <u:tokenize var="sourceDirList" 
delim="${path.separator}">${sourceDir}</u:tokenize>
  -      <j:if test="${size(sourceDirList) != 1}">
  -        <!-- Copy multiple source directories to one: jcoverage doesn't handle 
multiple source directories -->
  -        <echo>Copying ${size(sourceDirList)} source directories into one for 
jcoverage</echo>
  -        <j:set var="sourceDir" value="${maven.jcoverage.dir}/sources" />
  -        <ant:copy todir="${sourceDir}">
  -          <j:forEach var="dir" items="${sourceDirList}">
  -            <ant:fileset dir="${dir}" />
  -          </j:forEach>
  -        </ant:copy>
  -      </j:if>
  -          
  -      <j:set var="template" value="${maven.jcoverage.report.template}"/>
  -      <j:choose>
  -        <j:when test="${template == 'jcoverage'}">
  -          <report srcdir="${sourceDir}" destdir="${maven.coverage.dir}">
  -            <ant:classpath>
  -              <ant:path refid="jcoverage.classpath"/>
  -            </ant:classpath>
  -          </report>
  +    <j:choose>
  +      <j:when test="${unitTestSourcesPresent == 'true'}">
  +        <j:catch var="ex">
       
  -          <log:info>jcoverage reports have been generated.</log:info>
  -          <log:info>The HTML report is 
${maven.build.coverage.dir}/index.html</log:info>
  -        </j:when>
  -        <j:otherwise>
  -          <report srcdir="${sourceDir}" destdir="${maven.jcoverage.dir}" 
format="xml">
  -            <ant:classpath>
  -              <ant:path refid="jcoverage.classpath"/>
  -            </ant:classpath>
  -          </report>
  -          <j:set var="stylesheet" value="${maven.jcoverage.report.stylesheet}"/> 
  -          <ant:copy file="${stylesheet}" tofile="${maven.coverage.dir}/style.css"/> 
  -          <jcoverage:report
  -              dataFile="${maven.jcoverage.dir}/coverage.xml"
  -              outputDir="${maven.coverage.dir}"/>
  -        </j:otherwise>
  -      </j:choose>
  -
  -      <!--
  -        restore the maven.junit.fork property
  -      -->
  -      ${pom.getPluginContext('maven-test-plugin').setVariable('maven.junit.fork', 
oldfork)}
  -      <!--
  -        restore the maven.build.dest property
  -      -->
  -      ${pom.getPluginContext('maven-test-plugin').setVariable('maven.build.dest', 
oldBuildDest)}
  -    </j:catch>
  -    <j:if test="${ex != null}">
  -      <log:error>${ex}</log:error>
  -      <ant:fail message="${ex}" />
  -    </j:if>
  +          <j:set var="sourceDir" 
value="${context.getAntProject().getReferences().get('maven.compile.src.set')}" />
  +          <u:tokenize var="sourceDirList" 
delim="${path.separator}">${sourceDir}</u:tokenize>
  +          <j:if test="${size(sourceDirList) != 1}">
  +            <!-- Copy multiple source directories to one: jcoverage doesn't handle 
multiple source directories -->
  +            <echo>Copying ${size(sourceDirList)} source directories into one for 
jcoverage</echo>
  +            <j:set var="sourceDir" value="${maven.jcoverage.dir}/sources" />
  +            <ant:copy todir="${sourceDir}">
  +              <j:forEach var="dir" items="${sourceDirList}">
  +                <ant:fileset dir="${dir}" />
  +              </j:forEach>
  +            </ant:copy>
  +          </j:if>
  +              
  +          <j:set var="template" value="${maven.jcoverage.report.template}"/>
  +          <j:choose>
  +            <j:when test="${template == 'jcoverage'}">
  +              <report srcdir="${sourceDir}" destdir="${maven.coverage.dir}">
  +                <ant:classpath>
  +                  <ant:path refid="jcoverage.classpath"/>
  +                </ant:classpath>
  +              </report>
  +        
  +              <log:info>jcoverage reports have been generated.</log:info>
  +              <log:info>The HTML report is 
${maven.build.coverage.dir}/index.html</log:info>
  +            </j:when>
  +            <j:otherwise>
  +              <report srcdir="${sourceDir}" destdir="${maven.jcoverage.dir}" 
format="xml">
  +                <ant:classpath>
  +                  <ant:path refid="jcoverage.classpath"/>
  +                </ant:classpath>
  +              </report>
  +              <j:set var="stylesheet" 
value="${maven.jcoverage.report.stylesheet}"/> 
  +              <ant:copy file="${stylesheet}" 
tofile="${maven.coverage.dir}/style.css"/> 
  +              <jcoverage:report
  +                  dataFile="${maven.jcoverage.dir}/coverage.xml"
  +                  outputDir="${maven.coverage.dir}"/>
  +            </j:otherwise>
  +          </j:choose>
  +    
  +          <!--
  +            restore the maven.junit.fork property
  +          -->
  +          
${pom.getPluginContext('maven-test-plugin').setVariable('maven.junit.fork', oldfork)}
  +          <!--
  +            restore the maven.build.dest property
  +          -->
  +          
${pom.getPluginContext('maven-test-plugin').setVariable('maven.build.dest', 
oldBuildDest)}
  +        </j:catch>
  +        <j:if test="${ex != null}">
  +          <log:error>${ex}</log:error>
  +          <ant:fail message="${ex}" />
  +        </j:if>
  +      </j:when>
  +      <j:otherwise>
  +        <ant:echo>No tests to run JCoverage on.</ant:echo>
  +      </j:otherwise>
  +    </j:choose>
   
     </goal>
     
  
  
  
  1.16      +1 -0      maven-plugins/jcoverage/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/jcoverage/xdocs/changes.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- changes.xml       27 May 2004 01:14:12 -0000      1.15
  +++ changes.xml       28 May 2004 10:27:27 -0000      1.16
  @@ -25,6 +25,7 @@
     </properties>
     <body>
       <release version="1.0.5-SNAPSHOT" date="in CVS">
  +      <action dev="evenisse" type="fix" issue="MPJCOVERAGE-8">Fixed report 
generation fails when no java source present.</action>
         <action dev="brett" type="fix" issue="MPJCOVERAGE-1">Handle multiple source 
directories correctly</action>
         <action dev="brett" type="fix">Copy all of maven.build.dest, excluding the 
class files, into the instrumentation directory, as some people hook into the 
resources copying themselves without adding them to the POM</action>
       </release>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to