maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject cvs commit: jakarta-turbine-maven/src/java/org/apache/maven MavenUtils.java
Date Thu, 12 Dec 2002 11:37:11 GMT
jvanzyl     2002/12/12 03:37:11

  Modified:    src/java/org/apache/maven MavenUtils.java
  Log:
  o Adding excludes capabilities.
  
  Revision  Changes    Path
  1.77      +37 -13    jakarta-turbine-maven/src/java/org/apache/maven/MavenUtils.java
  
  Index: MavenUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/MavenUtils.java,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- MavenUtils.java	11 Dec 2002 22:30:07 -0000	1.76
  +++ MavenUtils.java	12 Dec 2002 11:37:11 -0000	1.77
  @@ -342,32 +342,41 @@
       /**
        * Get a set of files from a specifed directory with a set of includes.
        *
  -     * @param directory Directory to scan
  -     * @param includes Comma separated list of includes
  +     * @param directory Directory to scan.
  +     * @param includes Comma separated list of includes.
        * @return files
        */
  -    public static String[] getFiles( String directory, String includes )
  +    public static String[] getFiles( File directory, String includes )
       {
  -        return getFiles( new File( directory ), includes );
  +        return getFiles( directory, includes, null );
       }
   
       /**
        * Get a set of files from a specifed directory with a set of includes.
        *
  -     * @param directory Directory to scan
  -     * @param includes Comma separated list of includes
  +     * @param directory Directory to scan.
  +     * @param includes Comma separated list of includes.
  +     * @param excludes Comma separated list of excludes.
        * @return files
        */
  -    public static String[] getFiles( File directory, String includes )
  +    public static String[] getFiles( File directory, String includes, String excludes )
       {
           String[] includePatterns = null;
           if ( includes != null )
           {
               includePatterns = StringUtils.split( includes, "," );
           }
  +
  +        String[] excludePatterns = null;
  +        if ( excludes != null )
  +        {
  +            excludePatterns = StringUtils.split( excludes, "," );
  +        }
  +
           DirectoryScanner directoryScanner = new DirectoryScanner();
           directoryScanner.setBasedir( directory );
           directoryScanner.setIncludes( includePatterns );
  +        directoryScanner.setExcludes( excludePatterns );
           directoryScanner.scan();
           String[] files = directoryScanner.getIncludedFiles();
   
  @@ -390,7 +399,22 @@
       public static List getProjects( File directory, String includes )
           throws Exception
       {
  -        String[] files = getFiles( directory, includes );
  +        return getProjects( directory, includes, null );
  +    }
  +
  +    /**
  +     * This is currently used for the reactor but may be generally useful.
  +     *
  +     * @param directory the directory to scan for maven projects
  +     * @param includes Patterns to include.
  +     * @param excludes Patterns to exclude.
  +     * @return a {link List} of {@link Project}s
  +     * @throws Exception when anything goes wrong. FIXME this is bad
  +     */
  +    public static List getProjects( File directory, String includes, String excludes )
  +        throws Exception
  +    {
  +        String[] files = getFiles( directory, includes, excludes );
   
           List projects = new ArrayList();
   
  @@ -824,7 +848,7 @@
   
       /** Resource bundle with user messages. */
       private static ResourceBundle messages;
  -    
  +
       /**
        * Load Maven user messages from a resource bundle given the
        * user's locale.
  @@ -832,12 +856,12 @@
        */
       private static void loadMessages()
       {
  -        try 
  +        try
           {
               // Look for the message bundle corresponding to the user's locale.
               messages = ResourceBundle.getBundle( "org/apache/maven/messages/messages" );
  -        } 
  -        catch( MissingResourceException e ) 
  +        }
  +        catch( MissingResourceException e )
           {
               // If we can't find the appropriate message bundle for the locale then
               // we will fall back to English.
  
  
  

Mime
View raw message