[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Easy way to embed head version number?.

From: Oliver Pajonk <oliver.pajonk_at_gmail.com>
Date: 2005-08-26 14:54:11 CEST

2005/8/26, Ryan Schmidt <subversion-2005@ryandesign.com>:
>
> On 25.08.2005, at 22:16, Joe Wade wrote:
>
> > I want to embed the head repository version number in the code of a
> > project so that when the code is compilied the head version number
> > is embedded in the binary (executable/library/etc). I want to do
> > this, so when a customer calls me up, I can have them give me the
> > binary version info and know exactly what code was used to create
> > the binary.
> > Ideally, I would be able to embed a string such as:
> >
> > 1.001.1234
> >
> > where the first two number indicate major and minor revision, and
> > the last indicates the revision of the repository when the binary
> > was created.
>
> This should help you:
>
> http://subversion.tigris.org/faq.html#version-value-in-source
>

I use svnversion in my Ant script like this:

<target name="setBuildVersion">
<mkdir dir="${dir.build}"/>
<exec executable="svnversion" spawn="false" dir="${basedir}" output="${
buildversion.outputfile}">
<arg line="."/>
</exec>
<replaceregexp file="${buildversion.outputfile}"
match="(.*)"
replace="application.buildversion=\1"
byline="false"/>
</target>

This creates a file that can be loaded into a Java Properties Object easily
if it is in the classpath. In my case I include it in my distribution JAR.
The property "application.buildversion" is the exact string generated by
svnversion.

-- 
Oliver Pajonk
Received on Fri Aug 26 14:56:20 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.