ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: Searching a log file for "Error" string
Date Wed, 28 Jan 2004 09:29:25 GMT
The following should do the trick in a verbose fashion.

    <loadfile property="log.property" srcfile="compiler.log">
      <filterchain>
        <linecontains>
          <contains value="Error"/>
        </linecontains>
      </filterchain>
    </loadfile>

    <condition property="has.error">
      <contains string="${log.property}" substring="Error"/>
    </condition>

    <fail if="has.error">
      It had an error
    </fail>

Peter

James Millet wrote:

>
>
>Hi,
>One of the tasks in my build process is an 'exec' task that invokes a C++
>compiler with its output going to a file specified in the "output"
>attribute of the exec task. I would like to search that output file for the
>string "Error" and fail the build if it is found. I see how to use the
>"fail" task with it's 'if' and 'unless' attributes for properies, so my big
>problem is how to do the search for "Error" and set (or not set) a
>property.
>I see <linecontains>, but that seems to be in the context of copying and I
>am not doing any copies.
>Any suggestions?
>Thanks,
>Jim Millet
>millet@us.ibm.com
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


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


Mime
View raw message