Suggestion for implementation: a way to do a FileSet or file list (to a file) from a positive match of a search for a String in a FileSet (or single file or src directory)

This is very much like a "grep" task with a designated output file for the matching file list (which can later be used as an includesfile or an excludesfile) and a String to match, and how many lines to search in the file (or search until another String is found, for example if you only want to search in the "header" area of source code, search until "public class" is found).

This can be done now with something like:

<apply executable="grep" output="filelist.txt">
            <arg value="-l"/>
            <arg value="-s"/>
            <arg value="Base-Package"/>
            <fileset dir="${src}" >
                <include name="pkg/**/*.java"/>
                <excludesfile name="files.exclude.txt" />
            </fileset>
</apply>

BUT there is a problem in that non-matches return a result of "1" which is displayed by ant (possible error), producing a really long list (in my case) of:

[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
[apply] Result: 1
..... etc, etc, etc.

This is quite a nuisance when you want to monitor what is going on with ant (logging, etc.).

P.S. I am doing this under Windows and there is no "quiet, -q" mode for grep, and I actually do not think that would work anyway.

-Liz
ErgoTech Systems, Inc.


-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to