ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject RE: tstamp task - does not update property
Date Fri, 25 Feb 2005 21:01:14 GMT
> From: OpenLDAP User []
> Once you call tstamp and set it to a property, you can not update that
> property again.
> What I'm trying to do is echo timestamps at various points in my build
> to optimize the performance of the build. However, if I use the tstamp
> task, set the time to a property x, then if I call tstamp again on
> property x, x does not get updated. It still has the value of the
> call to tstamp.
> Is there a way to overwrite the old value of tstamp? It's pretty messy
> to have to create a new property for every tstamp.
> I'm not sure why it doesn't overwrite by default, that would seem to
> make sense.

Properties are indeed immutable in Ant, with is 'A good thing' TM.

What you can do to echo your timestamp is to put the Ant code that
computes and echos the timestamp into its own target, and never depend
on this target, but always <antcall> it. As long as the property was
never set before, each <antcall> will get its own scope for properties,
so stepping on each others toes. I'll even make a macro here ;-) (Not
tested). --DD

PS: And is <macrodef> has local properties, you wouldn't need <antcall>
and a target at all. 

<project ...>
  <macrodef name="echo-timestamp">
      <antcall target="-timestamp" inheritAll="false" />

  <target name="-timestamp">
      <format property="-timestamp" ... />

  <target name="foo">
    <echo-timestamp />

    <echo-timestamp />

  <target name="bar" depends="foo">
    <echo-timestamp />

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

View raw message