ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet CSharp.java Ilasm.java
Date Sat, 07 Jul 2001 13:51:12 GMT
conor       01/07/07 06:51:12

  Modified:    src/main/org/apache/tools/ant AntClassLoader.java
                        Project.java
               src/main/org/apache/tools/ant/taskdefs GZip.java
                        KeySubst.java Rename.java Replace.java Untar.java
               src/main/org/apache/tools/ant/taskdefs/optional Javah.java
                        NetRexxC.java
               src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        CSharp.java Ilasm.java
  Log:
  Remove unnecessary use of Project.resolveFile by converting arguments to
  Files from Strings
  
  Revision  Changes    Path
  1.21      +16 -7     jakarta-ant/src/main/org/apache/tools/ant/AntClassLoader.java
  
  Index: AntClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/AntClassLoader.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- AntClassLoader.java	2001/07/02 09:55:41	1.20
  +++ AntClassLoader.java	2001/07/07 13:51:10	1.21
  @@ -152,14 +152,18 @@
               URL url = null;
               while ((this.pathElementsIndex < this.pathElements.length) &&
                      (url == null)) {
  -                File pathComponent = AntClassLoader.this.project.resolveFile(
  -                    (String)this.pathElements[this.pathElementsIndex]);
  -                url = getResourceURL(pathComponent, this.resourceName);
  -                this.pathElementsIndex++;
  +                try {                       
  +                    File pathComponent = AntClassLoader.this.project.resolveFile(
  +                        (String)this.pathElements[this.pathElementsIndex]);
  +                    url = getResourceURL(pathComponent, this.resourceName);
  +                    this.pathElementsIndex++;
  +                }
  +                catch (BuildException e) {
  +                    // ignore path elements which are not valid relative to the project
  +                }
               }
               this.nextResource = url;
           }
  -
       }
   
       /**
  @@ -386,8 +390,13 @@
    
           String[] pathElements = classpath.list();
           for (int i = 0; i < pathElements.length && stream == null; ++i) {
  -            File pathComponent = project.resolveFile((String)pathElements[i]);
  -            stream = getResourceStream(pathComponent, name);
  +            try {
  +                File pathComponent = project.resolveFile((String)pathElements[i]);
  +                stream = getResourceStream(pathComponent, name);
  +            }
  +            catch {BuildException e) {
  +                // ignore path elements which are invalid relative to the project
  +            }
           }
   
           return stream;
  
  
  
  1.62      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- Project.java	2001/07/07 10:19:29	1.61
  +++ Project.java	2001/07/07 13:51:10	1.62
  @@ -598,7 +598,7 @@
               if (part.equals("..")) {
                   String parentFile = file.getParent();
                   if (parentFile == null) {
  -                    throw new BuildException("The file or path you specified (" + fileName
+ ") is invalid releative to " + rootDir.getAbsolutePath());
  +                    throw new BuildException("The file or path you specified (" + fileName
+ ") is invalid relative to " + rootDir.getAbsolutePath());
                   }
                   file = new File(parentFile);
               } else if (part.equals(".")) {
  
  
  
  1.8       +4 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/GZip.java
  
  Index: GZip.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/GZip.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- GZip.java	2001/01/03 14:18:30	1.7
  +++ GZip.java	2001/07/07 13:51:11	1.8
  @@ -72,12 +72,12 @@
       private File zipFile;
       private File source;
       
  -    public void setZipfile(String zipFilename) {
  -        zipFile = project.resolveFile(zipFilename);
  +    public void setZipfile(File zipFilename) {
  +        zipFile = zipFilename;
       }
   
  -    public void setSrc(String src) {
  -        source = project.resolveFile(src);
  +    public void setSrc(File src) {
  +        source = src;
       }
   
       public void execute() throws BuildException {
  
  
  
  1.6       +4 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
  
  Index: KeySubst.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/KeySubst.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- KeySubst.java	2001/01/03 14:18:30	1.5
  +++ KeySubst.java	2001/07/07 13:51:11	1.6
  @@ -115,15 +115,15 @@
       /**
           Set the source file.
       */
  -    public void setSrc(String s) {
  -        this.source=project.resolveFile(s);
  +    public void setSrc(File s) {
  +        this.source = s;
       }
   
       /**
           Set the destination file.
       */
  -    public void setDest(String dest) {
  -        this.dest = project.resolveFile(dest);
  +    public void setDest(File dest) {
  +        this.dest = dest;
       }
   
       /**
  
  
  
  1.6       +4 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Rename.java
  
  Index: Rename.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Rename.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Rename.java	2001/01/03 14:18:31	1.5
  +++ Rename.java	2001/07/07 13:51:11	1.6
  @@ -77,16 +77,16 @@
        * Sets the file to be renamed.
        * @param src the file to rename
        */
  -    public void setSrc(String src) {
  -        this.src = project.resolveFile(src);
  +    public void setSrc(File src) {
  +        this.src = src;
       }
   
       /**
        * Sets the new name of the file.
        * @param dest the new name of the file.
        */
  -    public void setDest(String dest) {
  -        this.dest = project.resolveFile(dest);
  +    public void setDest(File dest) {
  +        this.dest = dest;
       }
   
       /**
  
  
  
  1.14      +2 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java
  
  Index: Replace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Replace.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Replace.java	2001/05/21 17:49:54	1.13
  +++ Replace.java	2001/07/07 13:51:11	1.14
  @@ -411,8 +411,8 @@
       /**
        * Sets a file to be searched for property values.
        */
  -    public void setPropertyFile(String filename) {
  -        propertyFile = project.resolveFile(filename);
  +    public void setPropertyFile(File filename) {
  +        propertyFile = filename;
       }
   
       /**
  
  
  
  1.12      +7 -7      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Untar.java
  
  Index: Untar.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Untar.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Untar.java	2001/05/23 16:57:40	1.11
  +++ Untar.java	2001/07/07 13:51:11	1.12
  @@ -66,8 +66,8 @@
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
    */
   public class Untar extends Task {
  -    private String dest; // req
  -    private String source; // req
  +    private File dest; // req
  +    private File source; // req
   
       /**
        * Do the work.
  @@ -81,7 +81,7 @@
           touch.setTaskName(getTaskName());
           touch.setLocation(getLocation());
                       
  -        File srcF=project.resolveFile(source);
  +        File srcF = source;
   
           TarInputStream tis = null;
           try {
  @@ -96,7 +96,7 @@
               if (dest == null) {
                   throw new BuildException("No destination specified", location);
               }
  -            File dir=project.resolveFile(dest);
  +            File dir = dest;
   
               log("Expanding: " + srcF + " into " + dir, Project.MSG_INFO);
               tis = new TarInputStream(new FileInputStream(srcF));
  @@ -154,8 +154,8 @@
        *
        * @param d Path to the directory.
        */
  -    public void setDest(String d) {
  -        this.dest=d;
  +    public void setDest(File d) {
  +        this.dest = d;
       }
   
       /**
  @@ -163,7 +163,7 @@
        *
        * @param s Path to tar-file.
        */
  -    public void setSrc(String s) {
  +    public void setSrc(File s) {
           this.source = s;
       }
   }
  
  
  
  1.4       +0 -30     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  
  Index: Javah.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Javah.java	2001/06/08 19:39:49	1.3
  +++ Javah.java	2001/07/07 13:51:12	1.4
  @@ -433,35 +433,5 @@
   
           log(prefix.toString() + niceClassList.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) {
  -    //    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.9       +4 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
  
  Index: NetRexxC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- NetRexxC.java	2001/01/03 14:18:35	1.8
  +++ NetRexxC.java	2001/07/07 13:51:12	1.9
  @@ -221,8 +221,8 @@
        * Set the destination directory into which the NetRexx source
        * files should be copied and then compiled.
        */
  -    public void setDestDir(String destDirName) {
  -        destDir = project.resolveFile(destDirName);
  +    public void setDestDir(File destDirName) {
  +        destDir = destDirName;
       }
   
       /**
  @@ -308,8 +308,8 @@
       /**
        * Set the source dir to find the source Java files.
        */
  -    public void setSrcDir(String srcDirName) {
  -        srcDir = project.resolveFile(srcDirName);
  +    public void setSrcDir(File srcDirName) {
  +        srcDir = srcDirName;
       }
   
       /**
  
  
  
  1.6       +13 -13    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
  
  Index: CSharp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CSharp.java	2001/01/03 14:18:38	1.5
  +++ CSharp.java	2001/07/07 13:51:12	1.6
  @@ -388,8 +388,8 @@
       /** file for generated XML documentation
        * @param f output file
        */
  -    public void setDocFile(String f) {
  -        _docFile=project.resolveFile(f);
  +    public void setDocFile(File f) {
  +        _docFile = f;
       }
               
       /** get the argument or null for no argument needed
  @@ -526,8 +526,8 @@
        * Set the source dir to find the files to be compiled
        * @param  srcDirName  The new SrcDir value 
        */
  -    public void setSrcDir(String srcDirName){
  -        _srcDir = project.resolveFile(srcDirName);
  +    public void setSrcDir(File srcDirName){
  +        _srcDir = srcDirName;
       }
       
       /** destination directory (null means use the source directory)
  @@ -539,8 +539,8 @@
        * Set the destination dir to find the files to be compiled
        * @param  dirName  The new DestDir value 
        */
  -    public void setDestDir(String dirName) {
  -        _destDir = project.resolveFile(dirName);
  +    public void setDestDir(File dirName) {
  +        _destDir = dirName;
       }
       
       /** type of target. Should be one of exe|library|module|winexe|(null)
  @@ -593,8 +593,8 @@
        * Set the win32 icon 
        * @param fileName path to the file. Can be relative, absolute, whatever.
        */
  -    public void setWin32Icon(String fileName) {
  -        _win32icon = project.resolveFile(fileName);
  +    public void setWin32Icon(File fileName) {
  +        _win32icon = fileName;
       }
       
       /**
  @@ -660,22 +660,22 @@
       /** output file. If not supplied this is derived from the
        *  source file
        */    
  -    protected String _outputFile;
  +    protected File _outputFile;
       
       /**
        * Set the definitions
        * @param list of definitions split by ; or , or even :
        */
  -    public void setOutputFile(String params) {
  -        _outputFile=params;
  +    public void setOutputFile(File params) {
  +        _outputFile = params;
       }
       
       /** get the argument or null for no argument needed
       * @return    The OutputFile Parameter to CSC 
       */
       protected String getOutputFileParameter() {
  -        if (notEmpty(_outputFile)) {
  -            File f=project.resolveFile(_outputFile);
  +        if (_outputFile != null) {
  +            File f = _outputFile;
               return "/out:"+f.toString();
           }
           else            
  
  
  
  1.6       +8 -9      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java
  
  Index: Ilasm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Ilasm.java	2001/01/03 14:18:38	1.5
  +++ Ilasm.java	2001/07/07 13:51:12	1.6
  @@ -160,8 +160,8 @@
        * Set the source dir to find the files to be compiled
        * @param  srcDirName  The new SrcDir value 
        */
  -    public void setSrcDir(String srcDirName){
  -        _srcDir = project.resolveFile(srcDirName);
  +    public void setSrcDir(File srcDirName){
  +        _srcDir = srcDirName;
       }
       
   
  @@ -293,15 +293,14 @@
        * output file. If not supplied this is derived from the
        *  source file
        */
  -     
  -    protected String _outputFile;
  +    protected File _outputFile;
       
       /**
        * Set the definitions
        * @param list of definitions split by ; or , or even :
        */
  -    public void setOutputFile(String params) {
  -        _outputFile=params;
  +    public void setOutputFile(File params) {
  +        _outputFile = params;
       }
       
       /**
  @@ -311,7 +310,7 @@
       protected String getOutputFileParameter() {
           if (_outputFile==null || _outputFile.length()==0)
               return null;
  -        File f=project.resolveFile(_outputFile);
  +        File f = _outputFile;
           return "/output="+f.toString();
       }
       
  @@ -322,8 +321,8 @@
       /**
        * Set the resource file 
        * @param fileName path to the file. Can be relative, absolute, whatever.
  -     */public void setResourceFile(String fileName) {
  -        _resourceFile = project.resolveFile(fileName);
  +     */public void setResourceFile(File fileName) {
  +        _resourceFile = fileName;
       }
           
       protected String getResourceFileParameter() {
  
  
  

Mime
View raw message