Fix links generated for jxr test files
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@371741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
b174debc26
commit
1a78ab23f5
1 file changed
+27
-4
@@ -75,12 +75,22 @@
|
||||
<j:set var="fullSrcDir" value="${pom.build.sourceDirectory}"/>
|
||||
<j:set var="srcDir" value="${fileutil.file(fullSrcDir).getCanonicalPath()}"/>
|
||||
<j:set var="srcDirLength" value="${srcDir.length() + 1}"/>
|
||||
<j:set var="fullTstDir" value="${pom.build.unitTestSourceDirectory}"/>
|
||||
<j:set var="tstDir" value="${fileutil.file(fullTstDir).getCanonicalPath()}"/>
|
||||
<j:set var="tstDirLength" value="${tstDir.length() + 1}"/>
|
||||
<x:set var="files" select="file"/>
|
||||
<!-- x:forEach is busted -->
|
||||
<j:forEach var="file" items="${files}">
|
||||
<!-- Type coercion doesn't work worth a fuck in jexl. -->
|
||||
<j:set var="name" value="${file.attribute('name').getValue()}"/>
|
||||
<j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/>
|
||||
<j:set var="srcRelPathLen" value="${pathtool.getRelativePath(srcDir,name).length()}"/>
|
||||
<j:set var="tstRelPathLen" value="${pathtool.getRelativePath(tstDir,name).length()}"/>
|
||||
<j:if test="${srcRelPathLen > 0}">
|
||||
<j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/>
|
||||
</j:if>
|
||||
<j:if test="${tstRelPathLen > 0}">
|
||||
<j:set var="name" value="${name.substring(mavenTool.toInteger(tstDirLength.toString()))}"/>
|
||||
</j:if>
|
||||
<util:replace var="name" value="${name}" oldChar="\\" newChar="/"/>
|
||||
<!--- +1 is for the trailing slash above -->
|
||||
<j:set var="errorCount"><x:expr select="count($file/violation)"/></j:set>
|
||||
@@ -100,7 +110,19 @@
|
||||
<x:set var="errorCount" select="count($file/violation)"/>
|
||||
<j:if test="${errorCount != 0}">
|
||||
<j:set var="name" value="${file.attribute('name').getValue()}"/>
|
||||
<j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/>
|
||||
<j:set var="srcRelPathLen" value="${pathtool.getRelativePath(srcDir,name).length()}"/>
|
||||
<j:set var="tstRelPathLen" value="${pathtool.getRelativePath(tstDir,name).length()}"/>
|
||||
<j:set var="jxrPath" value=""/>
|
||||
<j:if test="${srcRelPathLen > 0}">
|
||||
<j:set var="name" value="${name.substring(mavenTool.toInteger(srcDirLength.toString()))}"/>
|
||||
<!-- FIXME: this should be determined by ${maven.jxr.destdir} -->
|
||||
<j:set var="jxrPath" value="xref"/>
|
||||
</j:if>
|
||||
<j:if test="${tstRelPathLen > 0}">
|
||||
<j:set var="name" value="${name.substring(mavenTool.toInteger(tstDirLength.toString()))}"/>
|
||||
<!-- FIXME: this should be determined by ${maven.jxr.destdir.test} -->
|
||||
<j:set var="jxrPath" value="xref-test"/>
|
||||
</j:if>
|
||||
<util:replace var="name" value="${name}" oldChar="\\" newChar="/"/>
|
||||
|
||||
<subsection name="${name}">
|
||||
@@ -119,12 +141,13 @@
|
||||
<td>
|
||||
<j:set var="line" value="${error.attribute('line').getValue()}"/>
|
||||
<j:set var="lastIndex" value="${name.lastIndexOf('.java')}"/>
|
||||
<j:set var="jxrPathLen" value="${jxrPath.length()}"/>
|
||||
<j:choose>
|
||||
<j:when test="${lastIndex > 0}">
|
||||
<j:when test="${lastIndex > 0 and jxrPathLen > 0}">
|
||||
<j:set var="index" value="${mavenTool.toInteger(lastIndex.toString())}"/>
|
||||
<j:set var="nameWithoutJavaExtension" value="${name.substring(0, index)}"/>
|
||||
<util:replace var="nameWithoutJavaExtension" value="${nameWithoutJavaExtension}" oldChar="\\" newChar="/"/>
|
||||
<a href="xref/${nameWithoutJavaExtension}.html#${line}">${line}</a>
|
||||
<a href="${jxrPath}/${nameWithoutJavaExtension}.html#${line}">${line}</a>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
${line}
|
||||
|
||||
Reference in new issue
Block a user