ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Dunn <>
Subject RE: Design help
Date Wed, 30 Apr 2003 15:42:12 GMT
Wow, thanks a lot. That looks really good, I'm gonna try it!


-----Original Message-----
From: peter reilly []
Sent: Wednesday, April 30, 2003 1:40 AM
To: Ant Users List
Subject: Re: Design help

You could do something on these lines...

<project default="dochange">

  <property name="correct.command" value="//correct command line//" />

  <target name="check.already.corrected">
    <loadfile property="file.contents" srcfile="run.bat"/>
    <condition property="already.corrected">
      <contains string="${file.contents}" substring="${correct.command}"/>

  <target name="dochange"
             depends="check.already.corrected" unless="already.corrected">
    <echo>Do the change</echo>


or using antelope or antcontrib if

<target name="dochange">
    <loadfile property="file.contents" srcfile="run.bat"/>
           <contains string="${file.contents}"
           <echo>Do the change</echo>


On Tuesday 29 April 2003 23:02, Eric Dunn wrote:
> Hi,
>      I am trying ot figure out how to do this correctly. I want to edit a
> .bat file, looking for a specific java call and adding a command line
> arguement, and something its command line specified classpath.
> So I tried replaceregexp and I it works right, but if my customer runs it
> twice it has no way to check if it already made the change.
> So I installed "Antelope" with its "if\else" tasks but it seems to check
> properties. I need a property that dynamically is set by perhaps some
> custom task like "FileContains(filename,searchstring" so that the if\else
> task in antelope can use it an decide whether to run my replaceregexpr.
> Is this the right train of thought? Should I just write some monster custom
> ant task to just read the file myself, do java conditional logic, and
> insert if appropriate? I am pretty close to doing that.
> Thanks,
> Eric
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message