ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <DDevie...@lgc.com>
Subject RE: AINASL! Help with Parsing Files with Ant
Date Wed, 20 Apr 2005 18:08:13 GMT
> This is how my file should look like at anytime or rather build+1
> 
> ---------- content of target file [version.txt] --------------
> [Version]
> Version=5.0
> Build=555
> Date=Wed 04/13/05 05:08:30 PM
> -------------------------------------------------------

Your problem is that this is not a .properties file, which have
a very specific format and semantic. If you maintained 2 files,
one a real property file with the same info, and another in your
desired format, you should be able to do what you want.

- CVS update both files, version.properties and version.txt
- Manipulate version.properties with <propertyfile>.
- Load the properties (with <property file="">) from the
  updated version.properties
- Simply <echo> your update version.txt file

  <echo file="version.txt">
[Version]
Version=${Version}
Build=${Build}
Date=${Date}
</echo>

You may have to prefix properties when re-loading them,
since Ant properties are immutable.

There are other ways to do this with regular expressions
and the tasks that use them, but I think the dual file
approach above is the simplest, and closest to what you tried.

--DD

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


Mime
View raw message