You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Tim Stephenson <ti...@sybase.com> on 2001/02/08 17:40:15 UTC
[PROPOSAL] Passing pattern sets into an 'Ant' task
hi there ,
i am using an Ant task to build subprojects , and it would be really
handy to be able to define all my pattern sets in the main project and
use them from within the subprojects. something like this is what i am
after
<patternset id="test">
<include name="mylib/myclass.class" />
</patternset>
<ant antfile="${build}/subproject.xml" dir="${basedir}" target="main">
<patternset refid="test"/>
</ant>
i know ant accepts nested properties which may have a refid to a path
like structure, but i can't quite seem to achieve what i need with that
(unless i missed something)
is there any reason why i shouldn't do this? is it likely to be included
into the codeline?
thanx, tim
[SUBMISSION] Re: [PROPOSAL] Passing pattern sets into an 'Ant' task
Posted by Tim Stephenson <ti...@sybase.com>.
committers,
okay well the change i have made is very limited and does allow the subproject
spawned by the ant task to set its parent's patternsets. since patternsets are
just one of the 'references' kept i have restricted the pass thru to just allow
patternsets. In the Ant.java immediately after
// set user-define properties
Hashtable prop1 = project.getProperties();
e = prop1.keys();
while (e.hasMoreElements()) {
String arg = (String) e.nextElement();
String value = (String) prop1.get(arg);
p1.setProperty(arg, value);
}
i added this piece
/*
* set user-define patternsets
* patternset is _one_ of the object types held as references
*/
Hashtable refs1 = project.getReferences();
e = refs1.keys();
while (e.hasMoreElements()) {
String arg = (String) e.nextElement();
Object value = (Object) refs1.get(arg);
if (value.getClass().getName().indexOf("PatternSet")!=-1) {
p1.addReference(arg, value);
}
}
hope this makes the grade !
rgds, tim
Peter Donald wrote:
> At 04:40 8/2/01 +0000, Tim Stephenson wrote:
> > <ant antfile="${build}/subproject.xml" dir="${basedir}" target="main">
> >
> > <patternset refid="test"/>
> > </ant>
> >
> >i know ant accepts nested properties which may have a refid to a path
> >like structure, but i can't quite seem to achieve what i need with that
> >(unless i missed something)
> >
> >is there any reason why i shouldn't do this? is it likely to be included
> >into the codeline?
>
> In Ant2.x we will be allowing such things. It would be nice to have them in
> Ant1.x but we have to make sure that it is either un-documented or we
> document it as being incompatable with Ant2.x. The reason is that Ant2.x
> will most likely unify the namespace for patternsets and properties.
>
> 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 |
> *-----------------------------------------------------*
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-dev-help@jakarta.apache.org
Re: [PROPOSAL] Passing pattern sets into an 'Ant' task
Posted by Peter Donald <do...@apache.org>.
At 04:40 8/2/01 +0000, Tim Stephenson wrote:
> <ant antfile="${build}/subproject.xml" dir="${basedir}" target="main">
>
> <patternset refid="test"/>
> </ant>
>
>i know ant accepts nested properties which may have a refid to a path
>like structure, but i can't quite seem to achieve what i need with that
>(unless i missed something)
>
>is there any reason why i shouldn't do this? is it likely to be included
>into the codeline?
In Ant2.x we will be allowing such things. It would be nice to have them in
Ant1.x but we have to make sure that it is either un-documented or we
document it as being incompatable with Ant2.x. The reason is that Ant2.x
will most likely unify the namespace for patternsets and properties.
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 |
*-----------------------------------------------------*