ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Dunn <ed...@merc-int.com>
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!

-Eric

-----Original Message-----
From: peter reilly [mailto:peter.reilly@corvil.com]
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}"/>
    </condition>
  </target>

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

</project>

or using antelope or antcontrib if

<target name="dochange">
    <loadfile property="file.contents" srcfile="run.bat"/>
    <if>
       <not>
           <contains string="${file.contents}"
                          substring="${correct.command}"/>
        </not>
       <then>
           <echo>Do the change</echo>
           <regex...>
       </then>
     </if>
</target>

Peter

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: 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