Applied MAVEN-795
Fix files existing in the coverage report that don't exist in source git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113975 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
d02b5ef723
commit
86d99b4b8e
2 files changed
+30
-4
No files matched your search
+15
-2
@@ -95,6 +95,8 @@
|
||||
|
||||
<maven:addPath id="maven.dependency.classpath" refid="jcoverage.classpath"/>
|
||||
<maven:addPath id="maven.dependency.classpath" refid="${pom.getDependencyClasspath()}"/>
|
||||
|
||||
|
||||
|
||||
<instrument todir="${maven.jcoverage.instrumentation}">
|
||||
<ant:fileset dir="${maven.build.dest}">
|
||||
@@ -136,9 +138,19 @@
|
||||
<j:catch var="ex">
|
||||
|
||||
<j:set var="template" value="${maven.jcoverage.report.template}"/>
|
||||
|
||||
<ant:copy todir="${maven.jcoverage.sourceDirectory}">
|
||||
<ant:fileset dir="${pom.build.sourceDirectory}">
|
||||
<ant:include name="**/*.java" />
|
||||
</ant:fileset>
|
||||
<ant:fileset dir="${pom.build.unitTestSourceDirectory}">
|
||||
<ant:include name="**/*.java" />
|
||||
</ant:fileset>
|
||||
</ant:copy>
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${template == 'jcoverage'}">
|
||||
<report srcdir="${pom.build.sourceDirectory}" destdir="${maven.coverage.dir}">
|
||||
<report srcdir="${maven.jcoverage.sourceDirectory}" destdir="${maven.coverage.dir}">
|
||||
<ant:classpath>
|
||||
<ant:path refid="jcoverage.classpath"/>
|
||||
</ant:classpath>
|
||||
@@ -148,13 +160,14 @@
|
||||
<log:info>The HTML report is ${maven.build.coverage.dir}/index.html</log:info>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<report srcdir="${pom.build.sourceDirectory}" destdir="${maven.jcoverage.dir}"
|
||||
<report srcdir="${maven.jcoverage.sourceDirectory}" destdir="${maven.jcoverage.dir}"
|
||||
format="xml">
|
||||
<ant:classpath>
|
||||
<ant:path refid="jcoverage.classpath"/>
|
||||
</ant:classpath>
|
||||
</report>
|
||||
<ant:copy file="${plugin.resources}/style.css" todir="${maven.coverage.dir}"/>
|
||||
<ant:echo>jcoverage:report params : {dataFile, ouputDir}={${maven.jcoverage.dir}/coverage.xml, ${maven.coverage.dir}}</ant:echo>
|
||||
<jcoverage:report
|
||||
dataFile="${maven.jcoverage.dir}/coverage.xml"
|
||||
outputDir="${maven.coverage.dir}"/>
|
||||
|
||||
@@ -64,7 +64,7 @@ import org.apache.oro.text.perl.Perl5Util;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Venisse
|
||||
* @version $Id: CoverageReport.java,v 1.1 2003/09/03 16:27:14 evenisse Exp $
|
||||
* @version $Id: CoverageReport.java,v 1.2 2003/09/08 02:26:30 dion Exp $
|
||||
*/
|
||||
public class CoverageReport
|
||||
{
|
||||
@@ -185,6 +185,10 @@ public class CoverageReport
|
||||
urlDirectory = ".";
|
||||
}
|
||||
File fsFile = new File(dir, filename);
|
||||
if (!fsFile.exists())
|
||||
{
|
||||
return;
|
||||
}
|
||||
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(fsFile)));
|
||||
pw.println("<html>");
|
||||
pw.println("<head>");
|
||||
@@ -243,6 +247,10 @@ public class CoverageReport
|
||||
rootRef = "";
|
||||
}
|
||||
File fsFile = new File(dir, filename);
|
||||
if (!fsFile.exists())
|
||||
{
|
||||
return;
|
||||
}
|
||||
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(fsFile)));
|
||||
pw.println("<html>");
|
||||
pw.println("<head>");
|
||||
@@ -371,7 +379,12 @@ public class CoverageReport
|
||||
{
|
||||
for (Iterator iter = coverage.getClasses().iterator(); iter.hasNext(); )
|
||||
{
|
||||
generateSourceFile(dir, (Clazz) iter.next());
|
||||
Clazz theClass = (Clazz) iter.next();
|
||||
File file = new File(coverage.getSrcDirectory(), theClass.getFile());
|
||||
if (file.exists())
|
||||
{
|
||||
generateSourceFile(dir, theClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user