ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Kramer <Douglas.Kra...@Sun.COM>
Subject Ant: get today's date and replace old date
Date Thu, 27 Jan 2005 01:45:43 GMT
PROBLEM 1:

I want to set the date in the version.properties file of my project.
In the past I've used this Unix command to get today's date:

   DATE=`date '+%d %b %Y'`       // 26 Jan 2005

That is, how can I set the date and assign it to a variable in Ant?


PROBLEM 2:

Then I want to replace the date in the file below.
It looks like the Replace task won't work because it cannot do a wildcard
search.  This is what I've been using:

   sed "s/build...*)/build date: $DATE)/" < $VERSION_PROPERTIES > $VERSION_PROPERTIES_NEW


----------------------- version.properties ---------------------------
#
# @(#)version.properties
#
mifdoclet.version=1.5 beta 1 and 1.4 beta 1 (build date: 26 Jan 2005)
----------------------------------------------------------------------

I suppose I could separate out the date and make it a separate property,
and then use the PropertyFile task to update it.

-Doug

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


Mime
View raw message