Use a jsl transform instead of ant's style task, bypassing some jdk specific issues of the latter.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@378776 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl committed 2006-02-18 21:04:35 +00:00
1 parent a0a0b4e39e
commit 9329c2c354
6 files changed
+133 -119

No files matched your search

+15 -11
View File
@@ -232,18 +232,22 @@
<mkdir dir="${maven.gen.docs}/checkstyle"/>
<!-- Make sure xalan is used for ant's style task -->
${systemScope.setProperty('javax.xml.transform.TransformerFactory','org.apache.xalan.processor.TransformerFactoryImpl')}
<doc:jsl
input="${maven.checkstyle.output.xml}"
output="checkstyle-summary-report.xml"
outputDirectory="${maven.checkstyle.dir}"
stylesheet="${plugin.resources}/checkstyle-summary.jsl"
encoding="${maven.docs.outputencoding}"
outputMode="xml"
prettyPrint="true"/>
<style
in="${maven.checkstyle.output.xml}"
out="${maven.checkstyle.output.summary.xml}"
style="${plugin.resources}/checkstyle-summary.xsl"/>
<style
in="${maven.checkstyle.output.summary.xml}"
out="${maven.gen.docs}/checkstyle/index.xml"
style="${plugin.resources}/checkstyle.xsl"/>
<doc:jsl
input="${maven.checkstyle.output.summary.xml}"
output="checkstyle/index.xml"
stylesheet="${plugin.resources}/checkstyle.jsl"
encoding="${maven.docs.outputencoding}"
outputMode="xml"
prettyPrint="true"/>
<doc:jsl
input="${maven.checkstyle.output.xml}"
-9
View File
@@ -172,14 +172,5 @@
<classloader>root</classloader>
</properties>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.4.1</version>
<url>http://xml.apache.org/xalan-j/</url>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* ========================================================================
*
* Copyright 2006 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:x="jelly:xml"
xmlns="dummy" trim="true">
<jsl:template match="/">
<errors>
<x:forEach select="//error" sort="@message">
<j:set var="group-by"><x:expr select="./@message"/></j:set>
<x:set var="grstring" select="string(./@message)"/>
<j:if test="${!grstring.equals(oldgrstring)}">
<x:element name="error">
<x:attribute name="severity">
<x:expr select="./@severity"/>
</x:attribute>
<x:attribute name="message">
<x:expr select="$group-by"/>
</x:attribute>
<x:attribute name="count">
<x:expr select="count(//error[@message=$group-by])"/>
</x:attribute>
</x:element>
<x:set var="oldgrstring" select="string(./@message)"/>
</j:if>
</x:forEach>
</errors>
</jsl:template>
<jsl:template match="text()"/>
</jsl:stylesheet>
@@ -1,49 +0,0 @@
<!--
* ========================================================================
*
* 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.
*
* ========================================================================
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:key name="errors-by-message" match="//error" use="@message"/>
<xsl:template match="/">
<errors>
<xsl:for-each select="//error">
<xsl:variable name="group-by">
<xsl:value-of select="./@message"/>
</xsl:variable>
<xsl:if test="generate-id(.) = generate-id(key('errors-by-message',$group-by)[1])">
<xsl:element name="error">
<xsl:attribute name="severity">
<xsl:value-of select="./@severity"/>
</xsl:attribute>
<xsl:attribute name="message">
<xsl:value-of select="$group-by"/>
</xsl:attribute>
<xsl:attribute name="count">
<xsl:value-of select="count(key('errors-by-message',$group-by))"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:for-each>
</errors>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
* Copyright 2006 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.
@@ -18,10 +20,14 @@
* ========================================================================
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:key name="errors-by-message" match="//error" use="@message" />
<xsl:template match="/">
<jsl:stylesheet
select="$doc"
xmlns:j="jelly:core"
xmlns:jsl="jelly:jsl"
xmlns:x="jelly:xml"
xmlns="dummy" trim="true">
<jsl:template match="/">
<document>
@@ -62,57 +68,64 @@
</thead>
<tbody>
<tr>
<td><xsl:value-of select="count(//error)" /></td>
<td><xsl:value-of select="count(//error[@severity='info'])" /></td>
<td><xsl:value-of select="count(//error[@severity='warning'])" /></td>
<td><xsl:value-of select="count(//error[@severity='error'])" /></td>
<td><x:expr select="count(//error)" /></td>
<td><x:expr select="count(//error[@severity='info'])" /></td>
<td><x:expr select="count(//error[@severity='warning'])" /></td>
<td><x:expr select="count(//error[@severity='error'])" /></td>
</tr>
</tbody>
</table>
</section>
<xsl:apply-templates select="." mode="display">
<xsl:with-param name="severity">error</xsl:with-param>
</xsl:apply-templates>
<xsl:apply-templates select="." mode="display">
<xsl:with-param name="severity">warning</xsl:with-param>
</xsl:apply-templates>
<xsl:apply-templates select="." mode="display">
<xsl:with-param name="severity">info</xsl:with-param>
</xsl:apply-templates>
<section name="Checkstyle error summary">
<table>
<tr>
<th>Error</th>
<th>Count</th>
</tr>
<x:forEach select="//error[@severity='error']" sort="@count" descending="true">
<tr>
<td><x:expr select="@message" /></td>
<td><x:expr select="@count" /></td>
</tr>
</x:forEach>
</table>
</section>
<section name="Checkstyle warning summary">
<table>
<tr>
<th>Error</th>
<th>Count</th>
</tr>
<x:forEach select="//error[@severity='warning']" sort="@count" descending="true">
<tr>
<td><x:expr select="@message" /></td>
<td><x:expr select="@count" /></td>
</tr>
</x:forEach>
</table>
</section>
<section name="Checkstyle info summary">
<table>
<tr>
<th>Error</th>
<th>Count</th>
</tr>
<x:forEach select="//error[@severity='info']" sort="@count" descending="true">
<tr>
<td><x:expr select="@message" /></td>
<td><x:expr select="@count" /></td>
</tr>
</x:forEach>
</table>
</section>
</body>
</document>
</xsl:template>
</jsl:template>
<xsl:template match="/" mode="display">
<xsl:param name="severity"/>
<xsl:element name="section">
<xsl:attribute name="name">Checkstyle <xsl:value-of select="$severity"/> summary</xsl:attribute>
<table>
<tr>
<th>Error</th>
<th>Count</th>
</tr>
<xsl:for-each select="//error[@severity=$severity]" >
<xsl:sort select="@count" data-type="number" order="descending"/>
<xsl:sort select="@message"/>
<tr>
<td><xsl:value-of select="@message" /></td>
<td><xsl:value-of select="@count" /></td>
</tr>
</xsl:for-each>
</table>
</xsl:element>
</xsl:template>
<xsl:template match="text()" />
</xsl:stylesheet>
<jsl:template match="text()" />
</jsl:stylesheet>
+1 -1
View File
@@ -28,7 +28,7 @@
<action dev="ltheussl" type="fix" issue="MPCHECKSTYLE-52">The links to source xref files does not honor <code>maven.jxr.destdir</code> and <code>maven.jxr.destdir.test</code>.</action>
<action dev="ltheussl" type="fix" issue="MPCHECKSTYLE-38">RSS file has incorrect links when used in multiproject build.</action>
<action dev="ltheussl" type="fix" issue="MPCHECKSTYLE-9"><code>maven.checkstyle.header.file</code> now defaults to <code>${maven.license.licenseFile}</code>.</action>
<action dev="ltheussl" type="fix" issue="MPCHECKSTYLE-53" due-to="Bernard Durfee">ClassCastException when moving from 2.5 to 3.0. Xalan is used for ant's style task.</action>
<action dev="ltheussl" type="fix" issue="MPCHECKSTYLE-53" due-to="Bernard Durfee">ClassCastException when moving from 2.5 to 3.0. Use a jsl transform instead of ant's style task.</action>
</release>
<release version="3.0" date="2006-02-05">
<action dev="ltheussl" type="update">Upgraded to checkstyle 4.1.</action>