ltheussl 7bf50e3ea3 PR: MPCHECKSTYLE-38
RSS file has incorrect links when used in multiproject build.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@375824 13f79535-47bb-0310-9956-ffa450edef68
2006-02-08 01:29:52 +00:00

114 lines
4.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
-->
<jsl:stylesheet
select="$doc"
xmlns:j="jelly:core"
xmlns:jsl="jelly:jsl"
xmlns:util="jelly:util"
xmlns:x="jelly:xml"
xmlns:doc="doc"
xmlns="dummy" trim="true">
<!-- This needs to be instantiated here to be available in the template matches -->
<j:useBean var="mavenTool" class="org.apache.maven.util.MavenTool"/>
<j:useBean var="htmlescape" class="org.apache.velocity.anakia.Escape"/>
<j:useBean var="fileutil" class="org.apache.velocity.texen.util.FileUtil"/>
<j:useBean var="pathtool" class="org.apache.maven.util.DVSLPathTool"/>
<jsl:template match="checkstyle">
<rss version="0.91">
<channel>
<title>Checkstyle report</title>
<j:set var="link" value="${baseurl}/index.html"/>
<link>${link}</link>
<description>Checkstyle report</description>
<language>en-us</language>
<copyright>Copyright ${currentYear} ${pom.organization.name}</copyright>
<item>
<j:set var="fileCount"><x:expr select="count(file)"/></j:set>
<j:set var="infoCount"><x:expr select="count(file/error[@severity='info'])"/></j:set>
<j:set var="warningCount"><x:expr select="count(file/error[@severity='warning'])"/></j:set>
<j:set var="errorCount"><x:expr select="count(file/error[@severity='error'])"/></j:set>
<title>File: ${fileCount}, Errors: ${errorCount}, Warnings: ${warningCount}, Infos: ${infoCount}</title>
<!-- If we don't go through a tmp variable Jelly inserts a space between ${baseurl}
and '/all.html'. Go figure... -->
<j:set var="link" value="${baseurl}/all.html"/>
<link>${link}</link>
<description>
<p>Click <a href="${baseurl}/index.html">here</a> for the full Checkstyle report.</p>
<table summary="Files" border="1">
<thead>
<tr>
<th>Files</th>
<th style="width:30px">I</th>
<th style="width:30px">W</th>
<th style="width:30px">E</th>
</tr>
</thead>
<tbody>
<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}"/>
<x:set var="files" select="file" sort="@name"/>
<!-- 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()))}"/>
<util:replace var="name" value="${name}" oldChar="\\" newChar="/"/>
<util:replace var="name" value="${name}" oldChar="/" newChar="_"/>
<util:replace var="name" value="${name}" oldChar="." newChar="_"/>
<!--- +1 is for the trailing slash above -->
<j:set var="infoCount"><x:expr select="count($file/error[@severity='info'])"/></j:set>
<j:set var="warningCount"><x:expr select="count($file/error[@severity='warning'])"/></j:set>
<j:set var="errorCount"><x:expr select="count($file/error[@severity='error'])"/></j:set>
<j:if test="${errorCount + warningCount + infoCount != 0}">
<tr>
<td>
<a href="${link}#${name}">${name}</a>
</td>
<td><doc:formatAsNumber string="${infoCount}" pattern="0"/></td>
<td><doc:formatAsNumber string="${warningCount}" pattern="0"/></td>
<td><doc:formatAsNumber string="${errorCount}" pattern="0"/></td>
</tr>
</j:if>
</j:forEach>
</tbody>
</table>
</description>
</item>
</channel>
</rss>
</jsl:template>
</jsl:stylesheet>