You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Nicolas Lalevée <ni...@hibnet.org> on 2010/07/13 17:12:24 UTC

Loading a list of filtered files

Since I discovered the "powerfullness" of resource and resource collection in 
Ant, I have been able all sort of manipulation on files whithout to have 
tempory files. Until.

I would like to have in one ant property some infos extracted from sevral ivy 
files. Basically I would want to write this:

<loadresource property="@{property}">
    <concat>
        <fileset dir="${fetchdir}" includes="ivy-*.xml">
            <filterchain>
                <tokenfilter>
                    <filetokenizer />
                    <replaceregex pattern="^.*&lt;dependencies&gt;
(.*)&lt;/dependencies&gt;.*$$" replace="&lt;!-- ${module.name} 
dependencies --&gt;\1" flags="si" />
                </tokenfilter>
            </filterchain>
        </fileset>
    </concat>
</loadresource>

Unfortunaltely I cannot apply a filterchain on a fileset.

Maybe there are some other way to do that with resources ?
Or should I use copy and have some temporary files ?

Nicolas

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


Re: Loading a list of filtered files

Posted by Nicolas Lalevée <ni...@hibnet.org>.
On Tuesday 13 July 2010 17:38:57 Stefan Bodewig wrote:
> On 2010-07-13, Nicolas Lalevée wrote:
> > <loadresource property="@{property}">
> >     <concat>
> >         <fileset dir="${fetchdir}" includes="ivy-*.xml">
> >             <filterchain>
> >                 <tokenfilter>
> >                     <filetokenizer />
> >                     <replaceregex pattern="^.*&lt;dependencies&gt;
> > (.*)&lt;/dependencies&gt;.*$$" replace="&lt;!-- ${module.name}
> > dependencies --&gt;\1" flags="si" />
> >                 </tokenfilter>
> >             </filterchain>
> >         </fileset>
> >     </concat>
> > </loadresource>
> >
> > Unfortunaltely I cannot apply a filterchain on a fileset.
>
> Any reason you can't move the filterchain to the level of loadresource
> or concat rather than the indiviual files?

ha, thanks, obviously... I was too focus on some requirement I actually 
dropped.
I wanted to have the name of the file being filtered added as a header of each 
extracted part of the ivy.xml (see some residue of my attempt in the regexp 
as ${module.name}), which I quickly realized it was not feasable.

thanks both of you for your quick replies.

Nicolas

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


Re: Loading a list of filtered files

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-07-13, Nicolas Lalevée wrote:

> <loadresource property="@{property}">
>     <concat>
>         <fileset dir="${fetchdir}" includes="ivy-*.xml">
>             <filterchain>
>                 <tokenfilter>
>                     <filetokenizer />
>                     <replaceregex pattern="^.*&lt;dependencies&gt;
> (.*)&lt;/dependencies&gt;.*$$" replace="&lt;!-- ${module.name}
> dependencies --&gt;\1" flags="si" />
>                 </tokenfilter>
>             </filterchain>
>         </fileset>
>     </concat>
> </loadresource>

> Unfortunaltely I cannot apply a filterchain on a fileset.

Any reason you can't move the filterchain to the level of loadresource
or concat rather than the indiviual files?

Stefan

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


Re: Loading a list of filtered files

Posted by Matt Benson <gu...@gmail.com>.
On Jul 13, 2010, at 10:12 AM, Nicolas Lalevée wrote:

> Since I discovered the "powerfullness" of resource and resource collection in 
> Ant, I have been able all sort of manipulation on files whithout to have 
> tempory files. Until.
> 
> I would like to have in one ant property some infos extracted from sevral ivy 
> files. Basically I would want to write this:
> 
> <loadresource property="@{property}">
>    <concat>
>        <fileset dir="${fetchdir}" includes="ivy-*.xml">
>            <filterchain>
>                <tokenfilter>
>                    <filetokenizer />
>                    <replaceregex pattern="^.*&lt;dependencies&gt;
> (.*)&lt;/dependencies&gt;.*$$" replace="&lt;!-- ${module.name} 
> dependencies --&gt;\1" flags="si" />
>                </tokenfilter>
>            </filterchain>
>        </fileset>
>    </concat>
> </loadresource>
> 
> Unfortunaltely I cannot apply a filterchain on a fileset.
> 

Why don't you apply the filterchain to the concat?  -Matt

> Maybe there are some other way to do that with resources ?
> Or should I use copy and have some temporary files ?
> 
> Nicolas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


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