ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: AW: Ant+Ivy BOF at ApacheCon tonight
Date Fri, 04 May 2007 07:37:49 GMT
Jan.Materne@rzf.fin-nrw.de wrote:
>> Xavier convinced me to slot us in at 9pm in room 3.  If we should be
>> only very few people, we might turn the BOF into a dinner, who knows.
> 
> Some news from the BOF?

I have a hangover.

Actually, during the day I've been starting to factor out file access 
from FileResource. A lot of tasks only work with files, but right now 
they have hard coded expectations that files come from FileResource 
instances. Really, files should come from anything that is a FileProvider

public interface FileProvider {
     /**
      * Get the file represented by this Resource.
      * @return the file.
      */
     File getFile();
}


Having looked at the tasks, I am not going to do any major reworks 
without talking to Stefan (who is chairing the maven talk, I am in the 
tomcat 6 talk right now). A lot of uses have phrases like (Pack.java):


         if (src instanceof FileResource) {
             source = ((FileResource) src).getFile();
         } else if (!supportsNonFileResources()) {
             throw new BuildException("Only FileSystem resources are"
                                      + " supported.");
         }

which should go to FileProvider. Easy


But other tasks (Tar) seem to contain their own basedir resolution:

                 FileResource r = (FileResource) iter.next();
                 File f = r.getFile();
                 if (f == null) {
                     f = new File(r.getBaseDir(), r.getName());
                 }

or this stuff in Copy
                         String name = r.getName();
                         if (r instanceof FileResource) {
                             FileResource fr = (FileResource) r;
                             baseDir = getKeyFile(fr.getBaseDir());
                             if (fr.getBaseDir() == null) {
                                 name = fr.getFile().getAbsolutePath();
                             }
                         }

I think we may need to pull a lof of this check for null and make 
basedir-relative  resolution something inside the FileProvider 
implementations. With a method

String getAbsolutePath()

then that could be used whenever you want an absolute path.

Does this make sense?

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message