From: Carlos S. <car...@us...> - 2005-07-14 05:12:35
|
carlossg 05/07/13 22:12:29 Modified: cobertura plugin.jelly Added: cobertura/src/plugin-resources check.jsl Log: Create check report from xml instead of text Revision Changes Path 1.10 +9 -7 maven-plugins/cobertura/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/cobertura/plugin.jelly,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- plugin.jelly 12 Jul 2005 23:28:10 -0000 1.9 +++ plugin.jelly 14 Jul 2005 05:12:28 -0000 1.10 @@ -215,18 +215,20 @@ <!-- ======================================================================== - Make a xdoc report from the text report + Create a xdoc report with classes not meeting the test coverage requirements ======================================================================== --> - <goal name="cobertura:check-report" prereqs="cobertura:check-report-text" + <goal name="cobertura:check-report" description="Create a xdoc report with classes not meeting the test coverage requirements"> <mkdir dir="${maven.gen.docs}/cobertura"/> - <doc:text-xdoc - title="Cobertura Check Report" - section="Cobertura Report" - inputText="${checkFailedLines}" - output="${maven.gen.docs}/cobertura/cobertura-check.xml"/> + <doc:jsl + input="${coberturaDocs}/coverage.xml" + output="cobertura/cobertura-check.xml" + stylesheet="${plugin.resources}/check.jsl" + encoding="${maven.docs.outputencoding}" + outputMode="xml" + prettyPrint="true"/> </goal> 1.1 maven-plugins/cobertura/src/plugin-resources/check.jsl Index: check.jsl =================================================================== <?xml version="1.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. * * ======================================================================== --> <jsl:stylesheet select="$doc" xmlns:j="jelly:core" xmlns:jsl="jelly:jsl" xmlns:x="jelly:xml" xmlns:doc="doc" xmlns:u="jelly:util" xmlns:ant="jelly:ant" xmlns="dummy" trim="false"> <jsl:template match="coverage"> <document> <head> <title>Cobertura check results</title> <style type="text/css"> .normal { } .failed { color: red; } </style> </head> <body> <table> <tr> <th>Class</th> <th>Line rate</th> <th>Branch rate</th> </tr> <jsl:applyTemplates select="//class"/> </table> </body> </document> </jsl:template> <jsl:template match="class" trim="false"> <j:set var="lineRate"><x:expr select="@line-rate"/></j:set> <j:set var="branchRate"><x:expr select="@branch-rate"/></j:set> <j:set var="lineRateFails" value="${(lineRate*100) lt maven.cobertura.check.line}"/> <j:set var="branchRateFails" value="${(branchRate*100) lt maven.cobertura.check.branch}"/> <j:set var="lineClass" value="normal"/> <j:set var="branchClass" value="normal"/> <j:if test="${lineRateFails}"><j:set var="lineClass" value="failed"/></j:if> <j:if test="${branchRateFails}"><j:set var="branchClass" value="failed"/></j:if> <j:choose> <j:when test="${lineRateFails or branchRateFails}"> <tr> <j:set var="name"><x:expr select="@name"/></j:set> <td><a href="${name}.html"><x:expr select="@name"/></a></td> <td class="${lineClass}"> <doc:formatAsNumber string="${lineRate}" pattern="0.00%"/> </td> <td class="${branchClass}"> <doc:formatAsNumber string="${branchRate}" pattern="0.00%"/> </td> </tr> </j:when> <j:otherwise> </j:otherwise> </j:choose> </jsl:template> <jsl:template match="*"> <jsl:copy trim="false"> <jsl:applyTemplates trim="false"/> </jsl:copy> </jsl:template> <!-- element values don't pass through as text --> <jsl:template match="@*"/> <!-- CDATA and text nodes pass-thru --> <jsl:template match="text()"> <x:expr select="."/> </jsl:template> </jsl:stylesheet> |