This may be very simplistic, but what about just an echo message into
the file? You can use a property for the variable data like the build
number and date. You probably need an echo statement for each line.
<echo message="Build=${build.number}" file="c:\directory\version.txt"/>
-----Original Message-----
From: Dominique Devienne [mailto:[EMAIL PROTECTED]
Sent: April 20, 2005 12:08 PM
To: Ant Users List
Subject: RE: AINASL! Help with Parsing Files with Ant
> 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: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]