ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types ScannerUtil.java
Date Sun, 17 Feb 2002 10:01:03 GMT
donaldp     02/02/17 02:01:03

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/types
                        ScannerUtil.java
  Log:
  Add utility methods to deal with myrmidons filesets
  
  Revision  Changes    Path
  1.8       +56 -3     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/ScannerUtil.java
  
  Index: ScannerUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/ScannerUtil.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ScannerUtil.java	6 Feb 2002 13:37:28 -0000	1.7
  +++ ScannerUtil.java	17 Feb 2002 10:01:03 -0000	1.8
  @@ -23,7 +23,7 @@
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author Arnout J. Kuiper <a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>
    * @author <a href="mailto:umagesh@rediffmail.com">Magesh Umasankar</a>
  - * @version $Revision: 1.7 $ $Date: 2002/02/06 13:37:28 $
  + * @version $Revision: 1.8 $ $Date: 2002/02/17 10:01:03 $
    */
   public class ScannerUtil
   {
  @@ -531,6 +531,32 @@
           }
       }
   
  +    public static void setupDirectoryScanner( final org.apache.myrmidon.framework.FileSet
set,
  +                                              final FileScanner scanner,
  +                                              final TaskContext context )
  +        throws TaskException
  +    {
  +        if( null == scanner )
  +        {
  +            final String message = "ds cannot be null";
  +            throw new IllegalArgumentException( message );
  +        }
  +
  +        scanner.setBasedir( set.getDir() );
  +
  +        /*final String message = "FileSet: Setup file scanner in dir " +
  +            set.getDir() + " with " + set;
  +        getLogger().debug( message );*/
  +
  +        scanner.setIncludes( PatternUtil.getIncludePatterns( set, context ) );
  +        scanner.setExcludes( PatternUtil.getExcludePatterns( set, context ) );
  +        if( set.includeDefaultExcludes() )
  +        {
  +            scanner.addDefaultExcludes();
  +        }
  +        scanner.setCaseSensitive( true );
  +    }
  +
       public static void setupDirectoryScanner( final FileSet set,
                                                 final FileScanner scanner,
                                                 final TaskContext context )
  @@ -544,9 +570,9 @@
   
           scanner.setBasedir( set.getDir() );
   
  -        final String message = "FileSet: Setup file scanner in dir " +
  +        /*final String message = "FileSet: Setup file scanner in dir " +
               set.getDir() + " with " + set;
  -        //getLogger().debug( message );
  +        getLogger().debug( message );*/
   
           scanner.setIncludes( PatternUtil.getIncludePatterns( set, context ) );
           scanner.setExcludes( PatternUtil.getExcludePatterns( set, context ) );
  @@ -558,6 +584,33 @@
       }
   
       public static DirectoryScanner getDirectoryScanner( final FileSet set )
  +        throws TaskException
  +    {
  +        final File dir = set.getDir();
  +        if( null == dir )
  +        {
  +            final String message = "No directory specified for fileset.";
  +            throw new TaskException( message );
  +        }
  +
  +        if( !dir.exists() )
  +        {
  +            final String message = dir.getAbsolutePath() + " not found.";
  +            throw new TaskException( message );
  +        }
  +        if( !dir.isDirectory() )
  +        {
  +            final String message = dir.getAbsolutePath() + " is not a directory.";
  +            throw new TaskException( message );
  +        }
  +
  +        final DirectoryScanner scanner = new DirectoryScanner();
  +        setupDirectoryScanner( set, scanner, null );
  +        scanner.scan();
  +        return scanner;
  +    }
  +
  +    public static DirectoryScanner getDirectoryScanner( final org.apache.myrmidon.framework.FileSet
set )
           throws TaskException
       {
           final File dir = set.getDir();
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message