ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Harrigan <>
Subject CvsTagFilter (related to CruiseControl)
Date Wed, 07 Jan 2004 13:57:58 GMT

I've written a small custom filterreader that does the following job:

Working with CruiseControl and Ant, cruise passes in a property
called label that can be used in the cvs task to label your repository.

If you're working on the head this is quite cool, so for example, you 
will have a "build-123" passed in that if a build is successful this
label can be used.

Problem is if you're working on a branch (or a revision). Since there
would be two versions of cruise running, the build number can clash,
so I've written a little filterreader that uses loadproperty in ant to see
if the CVS/Tag file exists. If it does, it reads this Tag file, formats it
properly and passes it back to loadproperty to set the property

Here are some examples:-

 <target name="cvslabel" description="To be run after build and then only by
        <loadfile property="cvs.tag.label" srcFile="${base.dir}/CVS/Tag"
                <filterreader classname="info.harrigan.CvsTagFilter">
                        <fileset dir="${lib.dir}">
            properties are immutable, so if the filterreader above actually
finds the Tag file
            then the cvs.tag.label property will be set. Otherwise, if the
Tag file is not found,
            cvs.tag.label will not be set and we can set it below.
        <property name="cvs.tag.label" value="HEAD"/>
        <echo message="Performing cvs tag ${cvs.tag.label}-${label} on
        <cvs command="-Q tag -c ${cvs.tag.label}-${label}"

The reason why I wrote the filterreader is that none of the current
cope with chopping off bits at the start of the information in the Tag file
(the N). And
it's not until Ant 1.6 is there a TokenFilter that can do a replace on the
input (e.g.,
replace all "." with "_", since "." is an invalid if contained within a

I believe this little class would be quite useful to extract the tag from
CVS for
use within the build.

Would anyone care to comment? If the feedback is positive then I'll release
code under the Apache license and follow the guidelines in the FAQ for
putting it out there in the wild.

Thanks one and all.


This email and any files transmitted with it are confidential and are
intended solely for the use of the individual or entity to whom they are
addressed. This communication represents the originator's personal views and
opinions, which do not necessarily reflect those of HPI Limited. If you are
not the original recipient or the person responsible for delivering the
email to the intended recipient, be advised that you have received this
email in error, and that any use, dissemination, forwarding, printing, or
copying of this email is strictly prohibited. If you received this email in
error, please immediately notify

This message has been scanned by Panda Anti-Virus. Recipients are advised to
apply their own virus checks to this message on delivery.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message