ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: AW: ProjectHelper : parsing from InputStream
Date Fri, 11 Jan 2008 15:11:51 GMT

--- Stefan Bodewig <bodewig@apache.org> wrote:

> <Jan.Materne@rzf.fin-nrw.de> writes:
> 
> >> -----Urspr√ľngliche Nachricht-----
> >> Von: Stefan Bodewig [mailto:bodewig@apache.org] 
> 
> >> The problem is a bit more complex than just
> allowing a different
> >> source.  The main problem are build files that do
> not specify a
> >> basedir attribute on the project tag since Ant
> then uses the directory
> >> holding the build file to resolve relative file
> references - which
> >> certainly doesn't work if it doesn't have a File
> reference pointing to
> >> the input.
> >
> >
> > Could the API require specifying the basedir?
> 
> It could.  Or instead require a ResourceFactory
> returning Resources
> that map to Files (like Matt suggests).
> 
> I really like the ResourceFactory idea but it can't
> be as generic as
> it sounds unless we change a lot of Ant tasks.
> 

True, I didn't think it through as far as you go
below.  :)

> Right now we need the basedir attribute to resolve
> relative file names
> for attribute setters that use the setFoo(File a)
> signature.
> 

Right, but all such _should_ be delegated to the
Project instance.  If not, sorry, can't help ya...

> If my build file doesn't contain any relative path
> at all, then there
> is no reason to set (or require) a basedir or a
> ResourceFactory at
> all.
> 

So would that be an error condition? 
IllegalStateException?

> If it does, then the resolved Resources must be
> Resources that can be
> turned into Files or I can't give the tasks what
> they are asking for.
> 
> The ResourceFactory approach would work great for
> setFoo(Resource a)
> attribute setters, but we don't haven them at all
> and we'd need to
> retrofit it into all existing tasks.
> 

One concept that I had discussed with someone here
(Kev?  Alexey?) was some kind of resource that would
deliver a tempfile for another resource.  This might
work in simple situations.  It also occurs to me that
certain resources might themselves implement
ResourceFactory, e.g. files and urls, which can pretty
easily return a relative file.  A buildfile specifying
no basedir would, IMHO, seem to be fairly well
represented by a FileResource that, as a
ResourceFactory, would resolve relative paths against
".".  So that might provide some opportunities as
well.

-Matt

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



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

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


Mime
View raw message