ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Locke <>
Subject Re: Proposal: File translation task
Date Tue, 18 Apr 2000 23:08:10 GMT

need a nice posix/perl5 compatible regexp library for file processing?
i've got one...  then you could say <processFile replace="regexp"
with="whatever">.  it also might help with version tagging and other
things...  just a thought.



On Wed, 19 Apr 2000, Thomas Haas wrote:

> Hi all
> In our prject we needed to add some file processing (striping off headers and footers
of text files). The current copyfile does similar things. Functionality is spread across Project
and Copyfile. I feel translating or generally processing and copying files should be separated.
For me copying is copying withjout ANY modifications applied.
> Translate extends MatchingTask and currently supports therefor (probably) all MatchingTask
> The attached proposal allows the following definitions in your build.xml:
> <translate src="/from/dir" dest="/to/dir">
>     <include .../>
>     <exclude .../>
>     <strip header="HEADER-SEPARATOR" footer="FOOTER-SEPARATOR"/>
>     <convertCRLF format="DOS"/>
> </translate>
> Note:
> - This is the third implementation of CRLF conversion. This has been done, as the others
can not be combined with other file translation.
> - Adding token filtering is no big deal (note the current token filtering may converts
your eol)
> - Add your own file translation as you need it.
> - the strip shown aboev only prints text between HEADER-SEPARATOR and FOOTER-SEPARATOR
or end of file.
> How it works:
> The translation is done by objects extending FilterOutputStream. For each file to be
translated, the FilterOutputStreams are chainned together. The example above results in a
chain of:
> StripFilterOutputStream ---> ConvertCRLFFilterOutputStream ---> FileOutputStream
> Next step:
> - If considered a good thing, a real patch will be provided, including the token filtering.
> - strip may not be part of standard distribution
> - tom

View raw message