You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Shatzer, Larry" <La...@Spirent.com> on 2003/09/03 20:51:06 UTC

antcall and build.xml being modified.

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


Re: antcall and build.xml being modified.

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 4 Sep 2003, Conor MacNeill <co...@cortexebusiness.com.au>
wrote:

> I would like to have this documented as "undefined".

I agree and will change my blurb accordingly.

Stefan

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


Re: antcall and build.xml being modified.

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
On Thu, 4 Sep 2003 05:31 pm, Stefan Bodewig wrote:
>
> > If anything, I think this should be documented, since it is a
> > gotcha.
>
> Will do.
>

I would like to have this documented as "undefined". I don't think we should 
be forced to reparse a build file in future just because we do so now. A 
cached representation of the buildfile is certainly possible and probably 
desirable for heavy antcall use. 

Self-modifying builds are not a practice I would recommend.

Conor


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


Re: antcall and build.xml being modified.

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 3 Sep 2003, Larry Shatzer <La...@spirent.com> wrote:

> When it is run the output is as follows:

As long as you are not using an OS like Windows that locks your build
file while Ant is running.

> I figured the output would have been this:

<antcall> is just a thin layer on top of <ant>, it reparses the build
file for each invocation.  This makes it the heavy operation it is.

> If anything, I think this should be documented, since it is a
> gotcha.

Will do.

Stefan

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