I'm assuming you want to keep your per-file processing so you can identify the offending file. Instead of copying with filters, though, try nesting a <concat> (usable as a single-element resourcecollection since 1.7.1) into your length condition. Concat your fileset, embedding your filterchain so that the resulting resource is the filtered resource. Copying will then be in-memory.
HTH, Matt --- On Wed, 6/10/09, jbmdharris <[email protected]> wrote: > From: jbmdharris <[email protected]> > Subject: Fail if any of many files contains a string > To: [email protected] > Date: Wednesday, June 10, 2009, 8:35 PM > > 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: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
