Wait:  I think Gilles has just given me the spark I
needed...  ProjectHelper2 simply uses instanceof
checks to see what it can read from.  What if we
accept a ResourceFactory as a source, and request
Main.DEFAULT_BUILD_FILENAME (build.xml) for the
Resource to parse.  Then it's the implementation's
responsiblity to know how to provide other resources
"relative to the buildfile."

-Matt

--- Gilles Scokart <[EMAIL PROTECTED]> wrote:

> But If you want to  pass an input stream as
> parameter, it is to allow to
> read build file from an other source than a file. 
> In those case, there is
> not necessarily a File basedir, but it can be
> something else.
> 
> Maybe passing an URL instead of a File would be more
> flexible?
> 
> Gilles
> 
> 2008/1/10, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]>:
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Stefan Bodewig [mailto:[EMAIL PROTECTED]
> > > Gesendet: Donnerstag, 10. Januar 2008 06:10
> > > An: dev@ant.apache.org
> > > Betreff: Re: ProjectHelper : parsing from
> InputStream
> > >
> > > "Benjamin de Dardel"
> <[EMAIL PROTECTED]> writes:
> > >
> > > > 1: Should I copy and rewrite ProjectHelperImpl
> for my personal use
> > > > ?
> > >
> > > You can do that, if you want to 8-)
> > >
> > > > Or is there another way
> > >
> > > No, there isn't.  See below.
> > >
> > > > 2: Do you need my contribution for refactoring
> helpers to accept
> > > > multiple sources ?
> > >
> > > We've started discussing this more than once but
> never came to a
> > > solution that ended up in svn.  If you want to
> help us not dropping
> > > the ball, you are welcome.
> > >
> > > 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?
> >
> >   /**
> >    * Parses the given buildfile.
> >    * @param is InputStream providing the content
> of the buildfile
> >    * @param basedir The (absolute) basedir for use
> in the project
> >    *        if the parsed buildfile doesnt specify
> an absolute
> >    *        path.
> >    */
> >   parse(InputStream is, File basedir);
> >
> >   is(<project>) + basedir="C:/temp" --> c:/temp
> >   is(<project basedir=".") + basedir="C:/temp" -->
> c:/temp
> >   is(<project basedir="/") + basedir="C:/temp" -->
> C:/
> >   is(<project basedir="D:">) + basedir="C:/temp"
> --> D:
> >
> >   is(<project basedir="D:">) + basedir=null --> D:
> >   is(<project basedir=".">) + basedir=null -->
> exception
> >   is(<project basedir="/">) + basedir=null -->
> >     on windows: root directory of the system drive
> >     on unix   : root directory '/'
> >   is(<project>) + basedir=null --> exception
> >
> >
> >
> > Jan
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> 



      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to