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, 27 Jan 2002 09:42:07 GMT
donaldp     02/01/27 01:42:07

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/types
                        ScannerUtil.java
  Log:
  Move scanning out of ZipFileSet into this class
  
  Revision  Changes    Path
  1.4       +32 -5     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ScannerUtil.java	26 Jan 2002 02:07:36 -0000	1.3
  +++ ScannerUtil.java	27 Jan 2002 09:42:07 -0000	1.4
  @@ -13,6 +13,7 @@
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.framework.PatternUtil;
  +import org.apache.myrmidon.framework.PatternSet;
   
   /**
    *
  @@ -20,7 +21,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.3 $ $Date: 2002/01/26 02:07:36 $
  + * @version $Revision: 1.4 $ $Date: 2002/01/27 09:42:07 $
    */
   public class ScannerUtil
   {
  @@ -542,12 +543,12 @@
           scanner.setBasedir( set.getDir() );
   
           final String message = "FileSet: Setup file scanner in dir " +
  -            set.getDir() + " with " + set.getPatternSet();
  +            set.getDir() + " with " + set;
           //getLogger().debug( message );
   
  -        scanner.setIncludes( PatternUtil.getIncludePatterns( set.getPatternSet(), context
) );
  -        scanner.setExcludes( PatternUtil.getExcludePatterns( set.getPatternSet(), context
) );
  -        if( set.useDefaultExcludes() )
  +        scanner.setIncludes( PatternUtil.getIncludePatterns( set, context ) );
  +        scanner.setExcludes( PatternUtil.getExcludePatterns( set, context ) );
  +        if( set.includeDefaultExcludes() )
           {
               scanner.addDefaultExcludes();
           }
  @@ -579,5 +580,31 @@
           setupDirectoryScanner( set, scanner, null );
           scanner.scan();
           return scanner;
  +    }
  +
  +    public static DirectoryScanner getZipScanner( final ZipFileSet set )
  +        throws TaskException
  +    {
  +        final File dir = set.getDir();
  +        final File src = set.getSrc();
  +
  +        if( null != dir && null != src )
  +        {
  +            throw new TaskException( "Cannot set both dir and src attributes" );
  +        }
  +
  +        if( null != src )
  +        {
  +            final ZipScanner scanner = new ZipScanner();
  +            scanner.setSrc( src );
  +            set.setDir( null  );
  +            setupDirectoryScanner( set, scanner, null );
  +            scanner.init();
  +            return scanner;
  +        }
  +        else
  +        {
  +            return getDirectoryScanner( set );
  +        }
       }
   }
  
  
  

--
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