You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Peter Donald <do...@apache.org> on 2000/12/12 05:09:54 UTC

Evaluation of Patterns

Hi,

I have just been kicking around some ideas with respect to evaluation of
Patterns. When do we want it to occur ? Should it occur when the
Pattern/PatternSet is bound to a name or should it be when a patternset is
applied to get a value (as in FileSet).

ie given the following sequence 

<property name="basepackage" value="com/biz/foo" />

<patternset id="mypattern" >
  <include name="${basepackage}/Meep.java" />
</patternset>

<property name="basepackage" value="com/biz/bar" />

<fileset dir="${client.src}" >
  <patternset refid="mypattern" />
</fileset>

What would you expect to be included. Would it be
"${client.src}/com/biz/foo/Meep.java" or
"${client.src}/com/biz/bar/Meep.java" ?

I used to think it was the first one but I think I have changed my mind. A
few people have wanted this on ant-user but I never thought it would be
useful. However I noticed that it is a common pattern to layour similar
directory structures within projects based on the same framework.

For example IIRC Turbine used to have this requirement (and still does?).
It used to layout a "module" as

<basepackage>.screens
<basepackage>.navigations
<basepackage>.actions
<basepackage>.pages

and it's architecture mandated that.

Now if we want to reuse patternsets then I believe that the best way to do
that would be to evaluate the patterns when they are applied to form a
fileset. Thus the same patternset could be used for multiple turbine
modules by changing value of basepackage and using the paternset in
multiple filesets.

Comments ?


Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Re: Evaluation of Patterns

Posted by Jason Rosenberg <ja...@squaretrade.com>.
If you can make the case for either approach,
why not offer both:

PatternSetImmediate
PatternSetDeferred

Jason

----- Original Message ----- 
From: "Peter Donald" <do...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Monday, December 11, 2000 11:09 PM
Subject: Evaluation of Patterns 


> Hi,
> 
> I have just been kicking around some ideas with respect to evaluation of
> Patterns. When do we want it to occur ? Should it occur when the
> Pattern/PatternSet is bound to a name or should it be when a patternset is
> applied to get a value (as in FileSet).
> 
> ie given the following sequence 
> 
> <property name="basepackage" value="com/biz/foo" />
> 
> <patternset id="mypattern" >
>   <include name="${basepackage}/Meep.java" />
> </patternset>
> 
> <property name="basepackage" value="com/biz/bar" />
> 
> <fileset dir="${client.src}" >
>   <patternset refid="mypattern" />
> </fileset>
> 
> What would you expect to be included. Would it be
> "${client.src}/com/biz/foo/Meep.java" or
> "${client.src}/com/biz/bar/Meep.java" ?
> 
> I used to think it was the first one but I think I have changed my mind. A
> few people have wanted this on ant-user but I never thought it would be
> useful. However I noticed that it is a common pattern to layour similar
> directory structures within projects based on the same framework.
> 
> For example IIRC Turbine used to have this requirement (and still does?).
> It used to layout a "module" as
> 
> <basepackage>.screens
> <basepackage>.navigations
> <basepackage>.actions
> <basepackage>.pages
> 
> and it's architecture mandated that.
> 
> Now if we want to reuse patternsets then I believe that the best way to do
> that would be to evaluate the patterns when they are applied to form a
> fileset. Thus the same patternset could be used for multiple turbine
> modules by changing value of basepackage and using the paternset in
> multiple filesets.
> 
> Comments ?
> 
> 
> Cheers,
> 
> Pete
> 
> *-----------------------------------------------------*
> | "Faced with the choice between changing one's mind, |
> | and proving that there is no need to do so - almost |
> | everyone gets busy on the proof."                   |
> |              - John Kenneth Galbraith               |
> *-----------------------------------------------------*
> 


Re: Evaluation of Patterns

Posted by James Duncan Davidson <du...@x180.net>.
On 12/11/00 8:09 PM, "Peter Donald" <do...@apache.org> wrote:

> <property name="basepackage" value="com/biz/foo" />
> 
> <patternset id="mypattern" >
> <include name="${basepackage}/Meep.java" />
> </patternset>
> 
> <property name="basepackage" value="com/biz/bar" />
> 
> <fileset dir="${client.src}" >
> <patternset refid="mypattern" />
> </fileset>
> 
> What would you expect to be included. Would it be
> "${client.src}/com/biz/foo/Meep.java" or
> "${client.src}/com/biz/bar/Meep.java" ?

It should be an error to have two properties with the same name defined in
the file.


-- 
James Duncan Davidson                                        duncan@x180.net
                                                                  !try; do()