tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dun...@hyperreal.org
Subject cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs Copydir.java Javac.java
Date Fri, 15 Oct 1999 19:28:06 GMT
duncan      99/10/15 12:28:01

  Modified:    ant/src/main/org/apache/tools/ant Task.java
               ant/src/main/org/apache/tools/ant/taskdefs Copydir.java
                        Javac.java
  Added:       ant/src/main/org/apache/tools/ant DesirableFilter.java
  Log:
  Replaced isFileDesirable() logic with DesirableFilter class
  that implements java.io.FilenameFilter.  Gives smarter filtering
  that ignores CVS files only under a CVS directory.
  
  Submitted by:	Jason Hunter, jch@eng.sun.com
  
  Revision  Changes    Path
  1.3       +0 -58     jakarta-tools/ant/src/main/org/apache/tools/ant/Task.java
  
  Index: Task.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/Task.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Task.java	1999/10/15 01:48:45	1.2
  +++ Task.java	1999/10/15 19:27:44	1.3
  @@ -85,63 +85,5 @@
   	    out.close();
   	}
       }
  -
  -    /**
  -     * Test the given filename to determine whether or not it's desirable.
  -     * This helps tasks filter temp files and files used by CVS.
  -     */
  -
  -    protected boolean isFileDesirable(String filename) {
  -
  -	// emacs save file
  -	if (filename.endsWith("~")) {
  -	    return false;
  -	}
  -
  -	// emacs autosave file
  -	if (filename.startsWith("#") && filename.endsWith("#")) {
  -	    return false;
  -	}
  -
  -	// openwindows text editor does this I think
  -	if (filename.startsWith("%") && filename.endsWith("%")) {
  -	    return false;
  -	}
  -
  -	// cvs file
  -	if (filename.equalsIgnoreCase("root")) {
  -	    return false;
  -	}
  -
  -	// cvs file
  -	if (filename.equalsIgnoreCase("entries")) {
  -	    return false;
  -	}
  -
  -	// cvs file
  -	if (filename.equalsIgnoreCase("entries.log")) {
  -	    return false;
  -	}
  -
  -	// cvs file
  -	if (filename.equalsIgnoreCase("repository")) {
  -	    return false;
  -	}
  -
  -	// cvs file
  -	if (filename.equalsIgnoreCase("template")) {
  -	    return false;
  -	}
  -
  -	// default
  -	return true;
  -    }
   }
  -
  -
  -
  -
  -
  -
  -
   
  
  
  
  1.1                  jakarta-tools/ant/src/main/org/apache/tools/ant/DesirableFilter.java
  
  Index: DesirableFilter.java
  ===================================================================
  package org.apache.tools.ant;
  
  import java.io.File;
  import java.io.IOException;
  import java.io.FilenameFilter;
  
  /**
   * Filters filenames to determine whether or not the file is desirable.
   *
   * @author Jason Hunter [jhunter@servlets.com]
   * @author james@x180.com
   */
  
  public class DesirableFilter implements FilenameFilter {
  
      /**
       * Test the given filename to determine whether or not it's desirable.
       * This helps tasks filter temp files and files used by CVS.
       */
  
      public boolean accept(File dir, String name) {
  
  	// emacs save file
  	if (name.endsWith("~")) {
  	    return false;
  	}
  
  	// emacs autosave file
  	if (name.startsWith("#") && name.endsWith("#")) {
  	    return false;
  	}
  
  	// openwindows text editor does this I think
  	if (name.startsWith("%") && name.endsWith("%")) {
  	    return false;
  	}
  
  	// cvs file
  	if (dir.getName().equalsIgnoreCase("CVS") && 
                  name.equalsIgnoreCase("root")) {
  	    return false;
  	}
  
  	// cvs file
  	if (dir.getName().equalsIgnoreCase("CVS") && 
                  name.equalsIgnoreCase("entries")) {
  	    return false;
  	}
  
  	// cvs file
  	if (dir.getName().equalsIgnoreCase("CVS") && 
                  name.equalsIgnoreCase("entries.log")) {
  	    return false;
  	}
  
  	// cvs file
  	if (dir.getName().equalsIgnoreCase("CVS") && 
                  name.equalsIgnoreCase("repository")) {
  	    return false;
  	}
  
  	// cvs file
  	if (dir.getName().equalsIgnoreCase("CVS") && 
                  name.equalsIgnoreCase("template")) {
  	    return false;
  	}
  
  	// default
  	return true;
      }
  }
  
  
  
  
  
  
  
  
  
  
  
  1.2       +2 -3      jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java
  
  Index: Copydir.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Copydir.java	1999/10/09 00:06:06	1.1
  +++ Copydir.java	1999/10/15 19:27:54	1.2
  @@ -47,7 +47,7 @@
       }
   
       private void scanDir(File from, File to) {
  -	String[] list = from.list();
  +	String[] list = from.list(new DesirableFilter());
   	for (int i = 0; i < list.length; i++) {
   	    String filename = list[i];
   	    File srcFile = new File(from, filename);
  @@ -55,8 +55,7 @@
   	    if (srcFile.isDirectory()) {
   		scanDir(srcFile, destFile);
   	    } else {
  -		if (isFileDesirable(filename) &&
  -		    srcFile.lastModified() > destFile.lastModified()) {
  +		if (srcFile.lastModified() > destFile.lastModified()) {
   		    filecopyList.put(srcFile.getAbsolutePath(),
   				     destFile.getAbsolutePath());
   		}
  
  
  
  1.5       +2 -3      jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Javac.java	1999/10/15 02:24:08	1.4
  +++ Javac.java	1999/10/15 19:27:56	1.5
  @@ -121,7 +121,7 @@
   
       private void scanDir(File srcDir, File destDir) {
   
  -	String[] list = srcDir.list();
  +	String[] list = srcDir.list(new DesirableFilter());
   	for (int i = 0; i < list.length; i++) {
   	    String filename = list[i];
   	    File srcFile = new File(srcDir, filename);
  @@ -141,8 +141,7 @@
   			compileList.addElement(srcFile.getAbsolutePath());
   		    }
   		} else {
  -		    if (isFileDesirable(filename) &&
  -			srcFile.lastModified() > destFile.lastModified()) {
  +		    if (srcFile.lastModified() > destFile.lastModified()) {
   			filecopyList.put(srcFile.getAbsolutePath(),
   					 destFile.getAbsolutePath());
   		    }
  
  
  

Mime
View raw message