Author: epunzalan
Date: Mon Mar 27 02:16:00 2006
New Revision: 389091

URL: http://svn.apache.org/viewcvs?rev=389091&view=rev
Log:
PR: MCHECKSTYLE-37

Created a new parameter, suppressionsFileExpression, which represents the 
expression used in checkstyle configuration file. When this expression is 
present, then the FilterSet will not be used anymore.

Modified:
    
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java

Modified: 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=389091&r1=389090&r2=389091&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
 (original)
+++ 
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
 Mon Mar 27 02:16:00 2006
@@ -295,6 +295,11 @@
     private String suppressionsLocation;
 
     /**
+     * @parameter expression="${checkstyle.suppression.expression}"
+     */
+    private String suppressionsFileExpression;
+
+    /**
      * Specifies the location of the supperssions XML file to use. The plugin 
defines a Checkstyle
      * property named <code>checkstyle.suppressions.file</code> with the value 
of this
      * property. This allows using the Checkstyle property your own custom 
checkstyle
@@ -327,7 +332,7 @@
      * Specifies the location of the package names XML to be used to configure
      * the Checkstyle <a 
href="http://checkstyle.sourceforge.net/config.html#Packages";>Packages</a>.
      * </p>
-     * 
+     *
      * <p>
      * This parameter is resolved as resource, URL, then file.
      * If resolved to a resource, or a URL, the contents of the package names
@@ -657,7 +662,7 @@
     private CheckstyleResults executeCheckstyle( Configuration config, 
ModuleFactory moduleFactory )
         throws MavenReportException, CheckstyleException
     {
-        File[] files = new File[0];
+        File[] files;
         try
         {
             files = getFilesToProcess( includes, excludes );
@@ -882,6 +887,13 @@
             throw new MavenReportException( "Failed to get overriding 
properties", e );
         }
 
+        if ( suppressionsFileExpression != null )
+        {
+            String suppresionFile = getSuppressionLocation();
+
+            p.setProperty( suppressionsFileExpression, suppresionFile );
+        }
+
         return p;
     }
 
@@ -929,9 +941,34 @@
         return moduleFactory;
     }
 
+    private String getSuppressionLocation()
+        throws MavenReportException
+    {
+        try
+        {
+            File suppressionsFile = locator.resolveLocation( 
suppressionsLocation, "checkstyle-suppressions.xml" );
+
+            if ( suppressionsFile == null )
+            {
+                return null;
+            }
+
+            return suppressionsFile.getAbsolutePath();
+        }
+        catch ( IOException e )
+        {
+            throw new MavenReportException( "Failed to process supressions 
location: " + suppressionsLocation, e );
+        }
+    }
+
     private FilterSet getSuppressions()
         throws MavenReportException
     {
+        if ( suppressionsFileExpression != null )
+        {
+            return null;
+        }
+
         try
         {
             File suppressionsFile = locator.resolveLocation( 
suppressionsLocation, "checkstyle-suppressions.xml" );


Reply via email to