You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by di...@apache.org on 2003/01/19 17:12:45 UTC

cvs commit: jakarta-turbine-maven/src/plugins-build/checkstyle plugin.jelly project.xml

dion        2003/01/19 08:12:45

  Modified:    src/plugins-build/checkstyle plugin.jelly project.xml
  Log:
  - Checkstyle license check is now based on the checkstyle.header.file setting
    specified in your checkstyle settings
  - If you don't specify a license file, checkstyle performs no license-related checks
  - If you do specify a license file, it must exist (and we fail with a message if it doesn't)
  - This is a fix for MAVEN-60
  
  Revision  Changes    Path
  1.16      +46 -35    jakarta-turbine-maven/src/plugins-build/checkstyle/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/checkstyle/plugin.jelly,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- plugin.jelly	11 Jan 2003 00:57:31 -0000	1.15
  +++ plugin.jelly	19 Jan 2003 16:12:45 -0000	1.16
  @@ -2,6 +2,7 @@
   
   <project
     xmlns:j="jelly:core"
  +  xmlns:util="jelly:util"
     xmlns:doc="doc">
   
     <!-- ================================================================== -->
  @@ -23,28 +24,7 @@
           classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
         </taskdef>
   
  -      <!--
  -       |
  -       | If an explicit properties file is set then use that. If one isn't then
  -       | we will look for the maven.checkstyle.type property as there aren't going
  -       | to be that many different formats: gnu, turbine, sun.
  -       |
  -      -->
  -
  -      <j:set var="checkstylePropertiesX" value="${maven.checkstyle.properties}X"/>
  -
  -      <j:choose>
  -        <j:when test="${checkstylePropertiesX != 'X'}">
  -          <j:set 
  -            var="checkstyleProperties" 
  -            value="${maven.checkstyle.properties}"/>
  -        </j:when>
  -        <j:otherwise>
  -          <j:set 
  -            var="checkstyleProperties" 
  -            value="${plugin.dir}/${maven.checkstyle.format}-checkstyle.properties"/>
  -        </j:otherwise>
  -      </j:choose>
  +      <attainGoal name="checkstyle:determine-properties" />
   
         <!-- Create the directory for the checkstyle cache in case it doesn't exist already -->
         <dirname property="maven.checkstyle.cache.dir" file="${maven.checkstyle.cache.file}"/>
  @@ -89,22 +69,28 @@
     <goal name="checkstyle:check-license-file"
       description="Checks the existence of the LICENSE.txt file">
   
  -    <available file="${basedir}/LICENSE.txt"
  -      property="maven.checkstyle.license.exists"/>
  -    <j:set var="licenseExists" value="${maven.checkstyle.license.exists}X"/>
  +    <attainGoal name="checkstyle:determine-properties" />
  +    
  +    <j:scope>
  +      <property file="${checkstyleProperties}" />
  +      <j:set var="headerFile" scope="parent">${checkstyle.header.file}</j:set>
  +    </j:scope>
   
  +    <util:file name="${headerFile}" var="header"/>
  +      
       <j:choose>
  -      <j:when test="${licenseExists == 'X'}">
  +      <j:when test="${not(header.exists()) and not(empty(headerFile))}">
           <echo>
  -          =======================================================================
  -          =                             W A R N I N G                           =
  -          =======================================================================
  -          =  Your project doesn't contain any LICENSE.txt file. Checkstyle needs=
  -          =  it to check the existence of the License in your source files. If  =
  -          =  it can't find this file, it throws an error.                       =
  -          =  A temporary solution is to create an empty LICENSE.txt file.       =
  -          =  Though, we recommend that you edit this License.                   =
  -          =======================================================================
  +          ======================================================================
  +          =                             W A R N I N G                          =
  +          ======================================================================
  +          =  Your project doesn't contain a header file specified as:          =
  +          =  ${header}
  +          =  Checkstyle needs it to check the existence of the License in your =
  +          =  source files. If it can't find this file, it throws an error.     =
  +          =  A temporary solution is to create an empty LICENSE.txt file.      =
  +          =  Though, we recommend that you edit this License.                  =
  +          ======================================================================
           </echo>
         </j:when>
         <j:otherwise>
  @@ -114,4 +100,29 @@
   
     </goal>
   
  +  <goal name="checkstyle:determine-properties">
  +      <!--
  +       |
  +       | If an explicit properties file is set then use that. If one isn't then
  +       | we will look for the maven.checkstyle.type property as there aren't going
  +       | to be that many different formats: gnu, turbine, sun.
  +       |
  +      -->
  +
  +      <j:set var="checkstylePropertiesX" value="${maven.checkstyle.properties}X"/>
  +
  +      <j:choose>
  +        <j:when test="${checkstylePropertiesX != 'X'}">
  +          <j:set 
  +            var="checkstyleProperties" 
  +            value="${maven.checkstyle.properties}"/>
  +        </j:when>
  +        <j:otherwise>
  +          <j:set 
  +            var="checkstyleProperties" 
  +            value="${plugin.dir}/${maven.checkstyle.format}-checkstyle.properties"/>
  +        </j:otherwise>
  +      </j:choose>
  +
  +  </goal>
   </project>
  
  
  
  1.22      +10 -0     jakarta-turbine-maven/src/plugins-build/checkstyle/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/checkstyle/project.xml,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- project.xml	16 Jan 2003 02:41:44 -0000	1.21
  +++ project.xml	19 Jan 2003 16:12:45 -0000	1.22
  @@ -116,6 +116,16 @@
       </dependency>
   
       <dependency>
  +      <groupId>commons-jelly</groupId>
  +      <artifactId>commons-jelly-tags-util</artifactId>
  +      <version>SNAPSHOT</version>
  +      <url>http://jakarta.apache.org/commons/sandbox/jelly/tags/util/</url>
  +      <properties>
  +        <classloader>root.maven</classloader>
  +      </properties>
  +    </dependency>
  +
  +    <dependency>
         <id>regexp</id>
         <version>1.2</version>
         <properties>