ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Perl filter task vs. filter/filterset/copy task
Date Mon, 26 Nov 2001 18:12:42 GMT

I must admit this work motivated by trying to create some build.xml files to
run some
automatic tests (instead of building a product), which might not be the
primary purpose of Ant.
I looked at Junit and extensions, the only problem I have with those
environments is the way the test is marked
as failed or passed (by asserts or exceptions thrown by the test code). I'd
like much better the output of the test compared
to a reference output with may be some filtering. It makes the test simpler
to write (no code to write to check if test is
ok) and it is more suitable for integration type of tests (tests more
complex than unit tests).

I created a perfilter task. I am not happy with the current design of this,
since I believe that it should be a
generalization of the filter/filterset used within a copy task (or something
like that). I am currently looking into that, but
I'd like the ant developer community input on that.

The idea is to be able to take multiple files, filter them using the perl
regexp "s/../../gimox" and generate multiple
(or one) output files (using filset and mapper). I am using the oro-2.0.4
for the perl expression processing. I defined
a new task (perlfilter) and a new type (subst) in order to do that. You can
find below some example of such task.

The issues that I have when trying to generalize it into filter/filterset
and copy are the following ones:
	- I am not sure that the subst type can be mapped easily into a
filter type. The token/value attributes are
too specific, I think.
	- the copy task with a merge mapper is not doing a merge (it is not
a concat). It is just overwriting the tofile
by each of the copied file (tofile will be equal to the last copied file).
Not sure if this is a bug or if this is the way
it is supposed to work (but merge mapper is a very confusing term, then).


<perlfilter file="" tofile="test.out" overwrite="true"
  <subst pattern=".*t" replacement="rr" /> 

<perlfilter tofile="test12.out" verbose="true" overwrite="true">
  <fileset dir=".">
    <include name="test.run1.out" /> 
    <include name="test.run2.out" /> 
  <subst pattern="/" replacement="\\" delimiter="#" /> 

<perlfilter todir="." verbose="true" overwrite="true">
  <fileset dir=".">
    <include name="test.run1.out" /> 
    <include name="test.run2.out" /> 
  <mapper type="merge" to="test.out" /> 
  <subst pattern="/" replacement="\\" delimiter="#" /> 
  <subst pattern=".*t" replacement="rr" /> 

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message