Change the test to see if the jxr plugin is used. The previous one worked only if the jxr plugin wass called before the pmd report.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@374762 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier 2006-02-03 22:18:29 +00:00
parent 9b897fbf7f
commit af140c09af

View File

@ -33,7 +33,7 @@
<j:useBean var="htmlescape" class="org.apache.velocity.anakia.Escape"/> <j:useBean var="htmlescape" class="org.apache.velocity.anakia.Escape"/>
<j:useBean var="fileutil" class="org.apache.velocity.texen.util.FileUtil"/> <j:useBean var="fileutil" class="org.apache.velocity.texen.util.FileUtil"/>
<j:useBean var="pathtool" class="org.apache.maven.util.DVSLPathTool"/> <j:useBean var="pathtool" class="org.apache.maven.util.DVSLPathTool"/>
<!-- Make sure the jxr plugin is loaded --> <!-- Force the jxr plugin to be loaded - even if it's not used in the project -->
<maven:set plugin="maven-jxr-plugin" property="foo" value="bar"/> <maven:set plugin="maven-jxr-plugin" property="foo" value="bar"/>
<jsl:template match="pmd"> <jsl:template match="pmd">
<document> <document>
@ -116,14 +116,20 @@
<!-- Where documentations are generated --> <!-- Where documentations are generated -->
<j:set var="docsDestDir" value="${maven.docs.dest}"/> <j:set var="docsDestDir" value="${maven.docs.dest}"/>
<util:replace var="docsDestDir" value="${docsDestDir}" oldChar="\\" newChar="/"/> <util:replace var="docsDestDir" value="${docsDestDir}" oldChar="\\" newChar="/"/>
<!-- JXR is activated ? -->
<j:set var="jxrActivated" value="false"/>
<j:forEach var="report" items="${pom.reports}">
<j:if test="${report.equals('maven-jxr-plugin')}">
<j:set var="jxrActivated" value="true"/>
</j:if>
</j:forEach>
<!-- I don't think this test is useful but .... in the case of.. --> <!-- I don't think this test is useful but .... in the case of.. -->
<j:if test="${pom.build.sourceDirectory != null}"> <j:if test="${pom.build.sourceDirectory != null}">
<!-- Where JXR files are generated for the code --> <!-- Where JXR files are generated for the code -->
<j:set var="jxrDestDir" value="${maven.jxr.destdir}"/> <j:set var="jxrDestDir" value="${maven.jxr.destdir}"/>
<util:replace var="jxrDestDir" value="${jxrDestDir}" oldChar="\\" newChar="/"/> <util:replace var="jxrDestDir" value="${jxrDestDir}" oldChar="\\" newChar="/"/>
<util:file var="jxrDestDirFile" name="${jxrDestDir}"/>
<j:choose> <j:choose>
<j:when test="${jxrDestDirFile.exists() and jxrDestDir.startsWith(docsDestDir)}"> <j:when test="${jxrActivated and jxrDestDir.startsWith(docsDestDir)}">
<!-- We create a relative path to the jxr files --> <!-- We create a relative path to the jxr files -->
<!-- ${maven.jxr.destdir} should be a subdirectory of ${maven.docs.dest} --> <!-- ${maven.jxr.destdir} should be a subdirectory of ${maven.docs.dest} -->
<j:set var="jxrDestDir" value="${jxrDestDir.substring(docsDestDir.length(),jxrDestDir.length())}"/> <j:set var="jxrDestDir" value="${jxrDestDir.substring(docsDestDir.length(),jxrDestDir.length())}"/>
@ -142,9 +148,9 @@
<!-- Where JXR files are generated for the tests --> <!-- Where JXR files are generated for the tests -->
<j:set var="jxrTestDestDir" value="${maven.jxr.destdir.test}"/> <j:set var="jxrTestDestDir" value="${maven.jxr.destdir.test}"/>
<util:replace var="jxrTestDestDir" value="${jxrTestDestDir}" oldChar="\\" newChar="/"/> <util:replace var="jxrTestDestDir" value="${jxrTestDestDir}" oldChar="\\" newChar="/"/>
<util:file var="jxrTestDestDirFile" name="${jxrTestDestDir}"/> <maven:get var="xrefGeneratedForTests" plugin="maven-jxr-plugin" property="maven.jxr.include.testXref"/>
<j:choose> <j:choose>
<j:when test="${jxrTestDestDirFile.exists()} and jxrTestDestDir.startsWith(docsDestDir)"> <j:when test="${jxrActivated and xrefGeneratedForTests and jxrTestDestDir.startsWith(docsDestDir)}">
<!-- We create a relative path to the jxr files for tests --> <!-- We create a relative path to the jxr files for tests -->
<!-- ${maven.jxr.destdir.test} should be a subdirectory of ${maven.docs.dest} --> <!-- ${maven.jxr.destdir.test} should be a subdirectory of ${maven.docs.dest} -->
<j:set var="jxrTestDestDir" value="${jxrTestDestDir.substring(docsDestDir.length(),jxrTestDestDir.length())}"/> <j:set var="jxrTestDestDir" value="${jxrTestDestDir.substring(docsDestDir.length(),jxrTestDestDir.length())}"/>