ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: LoadFile task
Date Fri, 15 Feb 2002 05:34:04 GMT

----- Original Message -----
From: "Magesh Umasankar" <umagesh@apache.org>
To: "Ant Developers List" <ant-dev@jakarta.apache.org>
Sent: Thursday, February 14, 2002 5:42 PM
Subject: Re: LoadFile task


> From: Stefan Bodewig <bodewig@apache.org>
>
> > On Mon, 11 Feb 2002, Steve Loughran <steve_l@iseran.com> wrote:
> > > From: "Jason van Zyl" <jvanzyl@zenplex.com>
> >
> > >> 1) I would like to be able to filter out comment, so would it be >
> > >> acceptable to add a property that sets comment line
> > >> characteristics:
> > >>
> > >> <loadfile comments="#,--"/>
> >
> > +1
>
> I am working on creating this in a more generic
> way and I don't like comments="#,-" approach very
> much...
>
> <loadfile property="t" srcFile="d:\temp\build4.xml">
>     <filterreaderset>
>         <filterrdr
> classname="org.apache.tools.ant.filters.ZapCommentsFilterReader"/>
>         <filterrdr
> classname="org.apache.tools.ant.filters.StripLineBreaksFilterReader"/>
>     </filterreaderset>
> </loadfile>
>

slick

I'd request that there is a filterreader interface that they are all derived
of, and that that if you spec a short name 'ZapLineCommentsFilterReader'
then there is no need to give the full path.
I actually did the first pass of the crlf filter as a StreamReader, but it
didnt work, there were nulls appearing at the end of the string, one for
every char stripped. So I went to a string to string postprocessor instead.

One issue: how do you pass parameters to the filters. Something like a strip
line breaks filter needs to know the char to replace it by; the comment
filter needs them too. Perhaps a
<param name value> pair is needed there.


> We can then do away with makeoneline attribute as well.
>
> In the above example, the file contents would
> be passed through the ZapCommentsFIlterReader
> to remove all the commented lines and then that will
> be passed to the StripLineBreaksFilterReader
> which will convert that into a single line.  User can then
> be able to attach a multitude of filters.  Moreover,
> we can look at introducing similar things to <copy>,
> <move>, etc.

Its a new perspective on filtering; says that a filter is just another plug
in.
filters, crlf, even property expansion is a form of filtering.




--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message