ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbmdharris <jbmdhar...@hotmail.com>
Subject Fail if any of many files contains a string
Date Thu, 11 Jun 2009 01:35:41 GMT

Is there a way to check if a string is present in any of a set of files and
fail the build?  I've got something now, but it requires copying the
files... which I don't like doing.  Copying puts a bunch of "copying 1 file
to blah blah blah in my build output".  Here's my current code:

        <for param="currentCSSFile">
            <path>
                <fileset dir="${dir.out.css}">
                    <include name="**/*.css"/>
                </fileset>
            </path>
            <sequential>
                <copy file="@{currentCSSFile}" tofile="${tokenCheckFile}"
overwrite="true">
                    <filterchain>
                        <stripjavacomments/>
                        <linecontainsregexp>
                            <regexp pattern="@(.*?)@"/>
                        </linecontainsregexp>
                    </filterchain>
                </copy>
                <fail message="Found missed keyword substitution (@KEYWORD@)
in output file: @{currentCSSFile}">
                    <condition>
                        <length file="${tokenCheckFile}" when="greater"
length="0"/>
                    </condition>
                </fail>
            </sequential>
        </for>
-- 
View this message in context: http://www.nabble.com/Fail-if-any-of-many-files-contains-a-string-tp23973929p23973929.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Mime
View raw message