ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S I" <xia...@hotmail.com>
Subject ANT: AINASL! Help with Parsing Files with Ant
Date Wed, 20 Apr 2005 17:53:35 GMT
Hi

I know Ant is not a scripting language, however, is there a way to checkout 
a file [version.txt] , out of CVS whose content as displayed below need to 
be changed & incremented automatically for nightly builds?  BTW, we're a 
Java shop, developing in Windows environment and deploying to Linux servers.

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
-------------------------------------------------------

Here's my xml/ant code:

<?xml version="1.0"?>

<project name="NextVesion" default="buildnum" basedir=".">

<target name="buildnum">
        <propertyfile file="version.txt" comment="[Version]">
	<entry  key="Version" value="5.0" />
	<entry  key="Build" value="+" type="int" operation="+"/>
	<entry  key="Date" type="date" value="now" />



        </propertyfile>
    </target>
</project>
----------------------------------------------------------------

And here's the UNWATNED result:

#[Version]
#Tue Apr 19 15:42:20 PDT 2005
Date=2005/04/19 15\:42
Build=556
Version=5.0
---------------------------------------------------------------


*The [Version] gets written as intended but annoyingly preceded by #
*Ant/Buildnumber Task automatically inserts #Tue Apr 19 15:42:20 PDT 2005, 
which is not my intention.
*The Date, even if I try to format it through Buildnumber, comes out all 
weird with escape chars.
*The only thing correctly done & intended is that the build number is 
incremented by 1.
*Version's untouched HOWEVER NOTHING comes out in their original 
juxtaposition as the original target file in the order they're supposed to.  
I have changed the order of the <entry keys to no avail; nothing, nada.  
I've written to the original contributors of the Buildnumber task 
utility...guess what? I rcv'd mail daemons.  Not surprised.

I'm the build/release guy and new to Ant and was trying to automate all my 
build processes with Ant. However, looks like I have to resort to GNU 
Utilities like Sed/Awk to accomplish parsing the [version.txt] file.  Any 
ideas or help would be appreciated.

Thank you,

S. Raze



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


Mime
View raw message