ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types Path.java
Date Tue, 06 Nov 2001 10:47:34 GMT
bodewig     01/11/06 02:47:34

  Modified:    src/main/org/apache/tools/ant/taskdefs/compilers
                        DefaultCompilerAdapter.java Gcj.java Jikes.java
                        Jvc.java Kjc.java
               src/main/org/apache/tools/ant/taskdefs/rmic
                        DefaultRmicAdapter.java
               src/main/org/apache/tools/ant/types Path.java
  Log:
  Only add directories as extdirs that actually exist.
  
  Submitted by:	Constantine P Sapuntzakis <csapuntz@stanford.edu>
  
  push addExtdirs to Path.
  
  Revision  Changes    Path
  1.16      +1 -31     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  
  Index: DefaultCompilerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DefaultCompilerAdapter.java	2001/11/05 15:19:20	1.15
  +++ DefaultCompilerAdapter.java	2001/11/06 10:47:33	1.16
  @@ -229,7 +229,7 @@
                   cp.append(bootclasspath);
               }
               if (extdirs != null) {
  -                addExtdirsToClasspath(cp);
  +                cp.addExtdirs(extdirs);
               }
               cp.append(classpath);
               cp.append(src);
  @@ -404,36 +404,6 @@
               if (tmpFile != null) {
                   tmpFile.delete();
               }
  -        }
  -    }
  -
  -    /**
  -     * Emulation of extdirs feature in java >= 1.2.
  -     * This method adds all files in the given
  -     * directories (but not in sub-directories!) to the classpath,
  -     * so that you don't have to specify them all one by one.
  -     * @param classpath - Path to append files to
  -     */
  -    protected void addExtdirsToClasspath(Path classpath) {
  -        if (extdirs == null) {
  -            String extProp = System.getProperty("java.ext.dirs");
  -            if (extProp != null) {
  -                extdirs = new Path(project, extProp);
  -            } else {
  -                return;
  -            }
  -        }
  -
  -        String[] dirs = extdirs.list();
  -        for (int i=0; i<dirs.length; i++) {
  -            if (!dirs[i].endsWith(File.separator)) {
  -                dirs[i] += File.separator;
  -            }
  -            File dir = project.resolveFile(dirs[i]);
  -            FileSet fs = new FileSet();
  -            fs.setDir(dir);
  -            fs.setIncludes("*");
  -            classpath.addFileset(fs);
           }
       }
   
  
  
  
  1.6       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java
  
  Index: Gcj.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Gcj.java	2001/11/05 15:19:20	1.5
  +++ Gcj.java	2001/11/06 10:47:33	1.6
  @@ -96,7 +96,7 @@
   
           // gcj doesn't support an extension dir (-extdir)
           // so we'll emulate it for compatibility and convenience.
  -        addExtdirsToClasspath(classpath);
  +        classpath.addExtdirs(extdirs);
   
           if ( (bootclasspath == null) || (bootclasspath.size() == 0) ) {
               // no bootclasspath, therefore, get one from the java runtime
  
  
  
  1.5       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java
  
  Index: Jikes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Jikes.java	2001/11/05 15:19:20	1.4
  +++ Jikes.java	2001/11/06 10:47:33	1.5
  @@ -96,7 +96,7 @@
   
           // Jikes doesn't support an extension dir (-extdir)
           // so we'll emulate it for compatibility and convenience.
  -        addExtdirsToClasspath(classpath);
  +        classpath.addExtdirs(extdirs);
   
           if ( (bootclasspath == null) || (bootclasspath.size() == 0) ) {
               // no bootclasspath, therefore, get one from the java runtime
  
  
  
  1.5       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java
  
  Index: Jvc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Jvc.java	2001/11/05 15:19:20	1.4
  +++ Jvc.java	2001/11/06 10:47:33	1.5
  @@ -84,7 +84,7 @@
   
           // jvc doesn't support an extension dir (-extdir)
           // so we'll emulate it for compatibility and convenience.
  -        addExtdirsToClasspath(classpath);
  +        classpath.addExtdirs(extdirs);
   
           if ( (bootclasspath == null) || (bootclasspath.size() == 0) ) {
               // no bootclasspath, therefore, get one from the java runtime
  
  
  
  1.4       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java
  
  Index: Kjc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Kjc.java	2001/11/05 15:19:20	1.3
  +++ Kjc.java	2001/11/06 10:47:33	1.4
  @@ -129,7 +129,7 @@
   	}
   
   	if (extdirs != null) {
  -            addExtdirsToClasspath(cp);
  +            cp.addExtdirs(extdirs);
   	}
   
   	cp.append(classpath);
  
  
  
  1.10      +1 -32     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  
  Index: DefaultRmicAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultRmicAdapter.java	2001/10/31 11:01:24	1.9
  +++ DefaultRmicAdapter.java	2001/11/06 10:47:34	1.10
  @@ -182,7 +182,7 @@
                   /*
                    * XXX - This doesn't mix very well with build.systemclasspath,
                    */
  -                addExtdirsToClasspath(classpath);
  +                classpath.addExtdirs(attributes.getExtdirs());
               } else {
                   cmd.createArgument().setValue("-extdirs");
                   cmd.createArgument().setPath(attributes.getExtdirs());
  @@ -257,37 +257,6 @@
           }
   
           attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE);
  -    }
  -
  -    /**
  -     * Emulation of extdirs feature in java >= 1.2.
  -     * This method adds all files in the given
  -     * directories (but not in sub-directories!) to the classpath,
  -     * so that you don't have to specify them all one by one.
  -     * @param classpath - Path to append files to
  -     */
  -    protected void addExtdirsToClasspath(Path classpath) {
  -        Path extdirs = attributes.getExtdirs();
  -        if (extdirs == null) {
  -            String extProp = System.getProperty("java.ext.dirs");
  -            if (extProp != null) {
  -                extdirs = new Path(attributes.getProject(), extProp);
  -            } else {
  -                return;
  -            }
  -        }
  -
  -        String[] dirs = extdirs.list();
  -        for (int i=0; i<dirs.length; i++) {
  -            if (!dirs[i].endsWith(File.separator)) {
  -                dirs[i] += File.separator;
  -            }
  -            File dir = attributes.getProject().resolveFile(dirs[i]);
  -            FileSet fs = new FileSet();
  -            fs.setDir(dir);
  -            fs.setIncludes("*");
  -            classpath.addFileset(fs);
  -        }
       }
   
       private final static Random rand = new Random();
  
  
  
  1.25      +29 -0     jakarta-ant/src/main/org/apache/tools/ant/types/Path.java
  
  Index: Path.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Path.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Path.java	2001/11/02 14:37:33	1.24
  +++ Path.java	2001/11/06 10:47:34	1.25
  @@ -571,4 +571,33 @@
           }
       }
   
  +    /**
  +     * Emulation of extdirs feature in java >= 1.2.
  +     * This method adds all files in the given
  +     * directories (but not in sub-directories!) to the classpath,
  +     * so that you don't have to specify them all one by one.
  +     * @param classpath - Path to append files to
  +     */
  +    public void addExtdirs(Path extdirs) {
  +        if (extdirs == null) {
  +            String extProp = System.getProperty("java.ext.dirs");
  +            if (extProp != null) {
  +                extdirs = new Path(project, extProp);
  +            } else {
  +                return;
  +            }
  +        }
  +
  +        String[] dirs = extdirs.list();
  +        for (int i=0; i<dirs.length; i++) {
  +            File dir = project.resolveFile(dirs[i]);
  +            if (dir.exists() && dir.isDirectory()) {
  +                FileSet fs = new FileSet();
  +                fs.setDir(dir);
  +                fs.setIncludes("*");
  +                addFileset(fs);
  +            }
  +        }
  +    }
  +
   }
  
  
  

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