ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shatzer, Larry" <Larry.Shat...@Spirent.com>
Subject antcall and build.xml being modified.
Date Wed, 03 Sep 2003 18:51:06 GMT
Consider the following build file:

<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="test">
  <target name="test">
    <antcall target="echotarget"/>
    <replace
      file  = "build.xml"
      token = "&amp;lt;TEST MESSAGE&amp;gt;"
      value = "&amp;lt;test message&amp;gt;"
    />
    <antcall target="echotarget"/>
    <replace
      file  = "build.xml"
      token = "&amp;lt;test message&amp;gt;"
      value = "&amp;lt;TEST MESSAGE&amp;gt;"
    />
    <antcall target="echotarget"/>
  </target>
  <target name="echotarget">
    <echo message="&lt;TEST MESSAGE&gt;"/>
  </target>
</project>

When it is run the output is as follows:

Buildfile: build.xml

test:

echotarget:
     [echo] <TEST MESSAGE>

echotarget:
     [echo] <test message>

echotarget:
     [echo] <TEST MESSAGE>

BUILD SUCCESSFUL
Total time: 3 seconds

I figured the output would have been this:

echotarget:
     [echo] <TEST MESSAGE>

echotarget:
     [echo] <TEST MESSAGE>

echotarget:
     [echo] <TEST MESSAGE>

Now granted, the condition of the build file be updated while the build is
running would be rare. I can see some benefits of it doing this, like a call
to a CVS update target, where the build file is updated, and then the
targets contents could be executed with the new changes.

If anything, I think this should be documented, since it is a gotcha. It got
me while working on a build file, and saved it with a broken task while the
build ran in the background and it failed.

-- Larry

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


Mime
View raw message