You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by vm...@apache.org on 2004/06/28 23:04:04 UTC

cvs commit: maven-plugins/checkstyle project.xml plugin.jelly

vmassol     2004/06/28 14:04:04

  Modified:    checkstyle/xdocs changes.xml
               checkstyle/src/plugin-resources checkstyle.jsl
               checkstyle project.xml plugin.jelly
  Added:       checkstyle/src/plugin-resources/images rss.png
               checkstyle/src/plugin-resources checkstyle2rss.jsl
  Log:
  Added first cut of a checkstyle RSS feed. There's lot to improve but I'd like to gather some feedback before working more on this feature. It relies on the fact that RSS readers cache feed data previously read thus keeping an history of the feed content over time.
  
  Revision  Changes    Path
  1.1                  maven-plugins/checkstyle/src/plugin-resources/images/rss.png
  
  	<<Binary file>>
  
  
  1.33      +4 -1      maven-plugins/checkstyle/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/checkstyle/xdocs/changes.xml,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- changes.xml	18 May 2004 21:50:24 -0000	1.32
  +++ changes.xml	28 Jun 2004 21:04:04 -0000	1.33
  @@ -25,7 +25,10 @@
       <author email="evenisse@ifrance.com">Emmanuel Venisse</author>
     </properties>
     <body> 
  -    <release version="2.4.2-SNAPSHOT" date="In CVS">
  +    <release version="2.5-SNAPSHOT" date="In CVS">
  +      <action dev="vmassol" type="add">
  +        Added generation of a Checkstyle RSS feed.
  +      </action>
         <action dev="aheritier" type="fix" issue="MPCHECKSTYLE-21">Fix : Build failed if target directory and License file didn't exist.</action>
       </release>  
       <release version="2.4.1" date="2004-05-18">
  
  
  
  1.14      +2 -1      maven-plugins/checkstyle/src/plugin-resources/checkstyle.jsl
  
  Index: checkstyle.jsl
  ===================================================================
  RCS file: /home/cvs/maven-plugins/checkstyle/src/plugin-resources/checkstyle.jsl,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- checkstyle.jsl	21 Apr 2004 00:55:43 -0000	1.13
  +++ checkstyle.jsl	28 Jun 2004 21:04:04 -0000	1.14
  @@ -46,7 +46,8 @@
           <section name="Checkstyle Results">
             <p>
               The following document contains the results of
  -            <a href="http://checkstyle.sourceforge.net/">Checkstyle</a>.
  +            <a href="http://checkstyle.sourceforge.net/">Checkstyle</a>
  +            <a href="checkstyle.rss"><img src="images/rss.png"/></a>.
             </p>
           </section>
   
  
  
  
  1.1                  maven-plugins/checkstyle/src/plugin-resources/checkstyle2rss.jsl
  
  Index: checkstyle2rss.jsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!--
   * ========================================================================
   * 
   * 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> 
          <link>${pom.url}</link> 
          <description>Checkstyle report</description>
          <language>en-us</language>
          <copyright>Copyright 2004 The Apache Software Foundation</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 ${pom.url} 
                 and '/checkstyle-report.html'. Go figure... -->
            <j:set var="link" value="${pom.url}/checkstyle-report.html"/>
            
            <link>${link}</link> 
            <description>
              <p>Click <a href="${pom.url}/checkstyle-report.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="/"/>
                  <!--- +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>
  
  
  
  1.51      +6 -1      maven-plugins/checkstyle/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/checkstyle/project.xml,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- project.xml	25 Jun 2004 15:24:27 -0000	1.50
  +++ project.xml	28 Jun 2004 21:04:04 -0000	1.51
  @@ -23,7 +23,7 @@
     <pomVersion>3</pomVersion>
     <id>maven-checkstyle-plugin</id>
     <name>Maven Checkstyle Plugin</name>
  -  <currentVersion>2.4.2-SNAPSHOT</currentVersion>
  +  <currentVersion>2.5-SNAPSHOT</currentVersion>
     <description/>
     <shortDescription>Produce Checkstyle report</shortDescription>
     <url>http://maven.apache.org/reference/plugins/checkstyle/</url>
  @@ -64,6 +64,11 @@
         <id>2.4.1</id>
         <name>2.4.1</name>
         <tag>MAVEN_CHECKSTYLE_2_4_1</tag>
  +    </version>
  +    <version>
  +      <id>2.5</id>
  +      <name>2.5</name>
  +      <tag>HEAD</tag>
       </version>
     </versions>
     <developers>
  
  
  
  1.27      +14 -1     maven-plugins/checkstyle/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/checkstyle/plugin.jelly,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- plugin.jelly	18 May 2004 21:50:24 -0000	1.26
  +++ plugin.jelly	28 Jun 2004 21:04:04 -0000	1.27
  @@ -1,4 +1,5 @@
   <?xml version="1.0"?>
  +
   <!-- 
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
  @@ -17,7 +18,6 @@
    */
    -->
   
  -
   <!--
     =============================================================================
       Checkstyle plugin for Maven.
  @@ -194,6 +194,19 @@
         encoding="${maven.docs.outputencoding}"
         outputMode="xml"
         prettyPrint="true"/>
  +
  +    <!-- Generate a RSS feed of the checktyle errors -->
  +    <doc:jsl
  +      input="${maven.build.dir}/checkstyle-raw-report.xml"
  +      output="checkstyle.rss"
  +      stylesheet="${plugin.resources}/checkstyle2rss.jsl"
  +      encoding="${maven.docs.outputencoding}"
  +      outputMode="xml"
  +      prettyPrint="true"/>
  +
  +    <!-- Copy the RSS XML logo -->
  +    <mkdir dir="${maven.docs.dest}"/>
  +    <copy todir="${maven.docs.dest}/images" file="${plugin.resources}/images/rss.png"/>
   
     </goal>
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org