You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Walter Moore <wb...@fedex.com> on 2004/01/19 14:28:34 UTC
ant and cvs
Hi all. I'm new to building ant build.xml files.
I'm trying to build a mechanism in the build file that wil allow me to
check out a tagged file and grab the tag from a version.properties file.
I have these lines in the file:
version=$Name: $
author=$Author: $
Now the Name is expanded to the name of the tag and the Author is
expanded to the username when I delete the file and check it out again
using the tag -- IF I use wincvs. so these lines look like this:
version=$Name: This-Is-My-Tag $
author=$Author: myUserName $
That works ok. My problem comes in when I try to do the same thing using
ant 1.6.0.
These lines get expanded like:
version=$Name\: This-Is-My-Tag $
author=$Author\: myUserName $
Now, if I check this in and then do a check out again of this file, The
$Name: $ and $Author: $ keywords do not get expanded, because they have
'\:' instead of ':'.
This contains the interesting lines of my build file:
==================================================
<!-- Create new version.properties and delete tag files -->
<target name="makeversion" description="create the needed files so
jar will have tag within it.">
<!-- Get a build time -->
<tstamp>
<format property="buildtime.isoformat"
pattern="yyyy-MM-dd'T'HH:mm:ss"/>
</tstamp>
<!-- Modify the properties file by incrementing the build number
and the build time -->
<delete file="${src}/version.properties"/>
<cvs command="update version.properties"/>
<propertyfile file="version.properties" comment="Version properties">
<entry key="release" type="int" operation="+" default="0"/>
<entry key="build" type="int" value="0"/>
<entry key="build.time" type="string"
value="${DSTAMP}_${TSTAMP}"/>
</propertyfile>
<!-- Load the new properties -->
<property file="version.properties" prefix="version"/>
</target>
====================================================
How do I fix this?
Thanks.
Walter Moore
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: ant and cvs
Posted by Peter Reilly <pe...@corvil.com>.
You have ran into propertyfile's treatment of : and = in property values.
Ant (in my opinion) incorrectly interperts java's use of properties.
Propertyfile
escapes : and = for keys (correct) and values (incorrect in my opinion).
The bug associated with this is:
http://issues.apache.org/bugzilla/show_bug.cgi?id=5867
A work-around would be to have two property files,
a cvs-version file (contains the version and author properties) and a
build-version (containing
the release, build and build.time properties) file,
and use the concat task to combine them.
Peter
Walter Moore wrote:
> Hi all. I'm new to building ant build.xml files.
>
> I'm trying to build a mechanism in the build file that wil allow me to
> check out a tagged file and grab the tag from a version.properties file.
>
> I have these lines in the file:
> version=$Name: $
> author=$Author: $
>
> Now the Name is expanded to the name of the tag and the Author is
> expanded to the username when I delete the file and check it out again
> using the tag -- IF I use wincvs. so these lines look like this:
> version=$Name: This-Is-My-Tag $
> author=$Author: myUserName $
>
> That works ok. My problem comes in when I try to do the same thing
> using ant 1.6.0.
> These lines get expanded like:
> version=$Name\: This-Is-My-Tag $
> author=$Author\: myUserName $
>
> Now, if I check this in and then do a check out again of this file,
> The $Name: $ and $Author: $ keywords do not get expanded, because they
> have '\:' instead of ':'.
>
> This contains the interesting lines of my build file:
> ==================================================
> <!-- Create new version.properties and delete tag files -->
> <target name="makeversion" description="create the needed files so
> jar will have tag within it.">
> <!-- Get a build time -->
> <tstamp>
> <format property="buildtime.isoformat"
> pattern="yyyy-MM-dd'T'HH:mm:ss"/>
> </tstamp>
> <!-- Modify the properties file by incrementing the build number
> and the build time -->
> <delete file="${src}/version.properties"/>
> <cvs command="update version.properties"/>
> <propertyfile file="version.properties" comment="Version properties">
> <entry key="release" type="int" operation="+" default="0"/>
> <entry key="build" type="int" value="0"/>
> <entry key="build.time" type="string"
> value="${DSTAMP}_${TSTAMP}"/>
> </propertyfile>
> <!-- Load the new properties -->
> <property file="version.properties" prefix="version"/>
> </target>
> ====================================================
>
> How do I fix this?
>
> Thanks.
> Walter Moore
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org