You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Chris Brown <br...@reflexe.fr> on 2002/12/26 16:34:31 UTC

Understanding directory-based tasks referred to by ID

Hello,

Hopefully someone can provide a clear answer about some issues concerning
directory-based tasks (FileSet, etc.) that are -- for me -- ambiguous.

When using embedded filesets, in tasks such as <javac>, <javadoc>, <jar>,
etc., it's all clear what's happenning.  Nevertheless, my build files
sometimes repeat the definitions of these elements, and I'd like to switch
to defining filesets (etc.) using ID references instead of embedding them.
I like to be aware of what's going on, and what should happen in all build
scenarios, so many thanks in advance to anyone who can tell me:

1./ When is the collection of files in a fileset "built"?
  (a) when the fileset element (with "id" attr) is parsed?
  (b) when the fileset element is first referred to?
  (c) each time the fileset is referred to?

2./ Once the fileset's contents are obtained?
  (a) are they fixed for the remainder of the script?
  (b) do they reflect changes (additions/deletions) made to the filesystem
during the build?

3./ If any of the fileset's attributes are based on expanded properties,
such as dir="${build}/lib/*.jar", when is this expansion performed?  For
example, what happens if the fileset elements are defined outwith any task
or target, containing an expandable property, only defined in the "init"
target, where the fileset is referred to by a later "compile" target that
depends on "init"...?

Thanks
Chris B




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Understanding directory-based tasks referred to by ID

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
On Friday, December 27, 2002, at 11:58  AM, Chris Brown wrote:

>
>>> 3./ If any of the fileset's attributes are based on expanded
>>> properties,
>>> such as dir="${build}/lib/*.jar", when is this expansion performed?
>>> For
>>> example, what happens if the fileset elements are defined outwith any
>>> task
>>> or target, containing an expandable property, only defined in the
>>> "init"
>>> target, where the fileset is referred to by a later "compile" target
>>> that
>>> depends on "init"...?
>>
>> This is an easy one.... properties are expanded as soon as the fileset
>> is constructed, so the properties must be set before the fileset
>> definition occurs during the build process.
>
> By "constructed", do you mean at the time the build script is 
> "parsed", or
> do you mean when some underlying objects (or whatever) are constructed 
> the
> first time it's referenced ?
>

When the build script is run, is what I mean here.  When that line is 
encountered during execution, properties are expanded and handed to the 
datatype.  The fileset datatype has no knowledge that properties are 
being used, its just receiving a String (or perhaps another datatype 
that can be constructed from a string representation).

	Erik


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Understanding directory-based tasks referred to by ID

Posted by Chris Brown <br...@reflexe.fr>.
> > 3./ If any of the fileset's attributes are based on expanded
> > properties,
> > such as dir="${build}/lib/*.jar", when is this expansion performed?
> > For
> > example, what happens if the fileset elements are defined outwith any
> > task
> > or target, containing an expandable property, only defined in the
> > "init"
> > target, where the fileset is referred to by a later "compile" target
> > that
> > depends on "init"...?
>
> This is an easy one.... properties are expanded as soon as the fileset
> is constructed, so the properties must be set before the fileset
> definition occurs during the build process.

By "constructed", do you mean at the time the build script is "parsed", or
do you mean when some underlying objects (or whatever) are constructed the
first time it's referenced ?

Thanks
Chris



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Understanding directory-based tasks referred to by ID

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
I'll have a crack at answering this, although its possible I'll get 
something incorrect somewhere along the lines and others can correct...


On Thursday, December 26, 2002, at 10:34  AM, Chris Brown wrote:
>
> 1./ When is the collection of files in a fileset "built"?
>   (a) when the fileset element (with "id" attr) is parsed?
>   (b) when the fileset element is first referred to?
>   (c) each time the fileset is referred to?

(about to foot in mouth) I believe the answer is (c) as each task will 
do a getDirectoryScanner and re-navigate the directory specified.

>
> 2./ Once the fileset's contents are obtained?
>   (a) are they fixed for the remainder of the script?
>   (b) do they reflect changes (additions/deletions) made to the 
> filesystem
> during the build?

Based on my understanding, I think (b).  Both this question and the 
first one should be easy enough to test though, but I have not done so.

> 3./ If any of the fileset's attributes are based on expanded 
> properties,
> such as dir="${build}/lib/*.jar", when is this expansion performed?  
> For
> example, what happens if the fileset elements are defined outwith any 
> task
> or target, containing an expandable property, only defined in the 
> "init"
> target, where the fileset is referred to by a later "compile" target 
> that
> depends on "init"...?

This is an easy one.... properties are expanded as soon as the fileset 
is constructed, so the properties must be set before the fileset 
definition occurs during the build process.

	Erik


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>