|
I
ended up with these small snipplets to solve my problems where I use svn and
ccnet
and
want both build number and revision from svn into the (in this case) file
version
attribute.
<target name="debug" depends="init">
<call target="setversion" /> <nant buildfile="${build.dir}\top.build" target="debug"/> <call target="unsetversion" /> </target>
<target name="setversion" depends="init">
<!-- Get the revision number for display in the build --> <exec program="svn.exe" commandline="info ${build.dir}" output="revision.txt" /> <foreach item="Line" in="revision.txt" property="line"> <if test="${string::starts-with(line, 'Revision')}"> <property name="svn.revision" value="${string::substring(line, 10, string::get-length(line) - 10)}" /> </if> </foreach> <delete file="revision.txt" /> <!-- label-to-apply is set by ccnet, otherwise we
need to set it -->
<if test="${not property::exists('label-to-apply')}"> <property name="label-to-apply" value="0" /> </if> <exec program='C:\Program Files\Ifsnant\find_and_replace.exe' commandline='${build.dir}\src\fndwin\VersionInfo.cs ${build.dir}\src\fndwin\vi.txt FileVersion(\"1.0.0.0\") FileVersion(\"1.0.${label-to-apply}.${svn.revision}\") 0 supress-banner' /> <move file='${build.dir}\src\fndwin\vi.txt' tofile='${build.dir}\src\fndwin\VersionInfo.cs' overwrite="true" /> </target>
<target name="unsetversion" depends="init">
<exec program="svn.exe" commandline="revert ${build.dir}\src\fndwin\VersionInfo.cs" /> </target> The
"init" only sets build.dir.
This
actually works like a charm for me :) I already got a VersionInfo.cs file linked
into the
other
projects, and it contains version 1.0.0.0.
/Nicke
|
Title: Message
- [Nant-users] Labeling and Versioning Bonnett, Evan A
- RE: [Nant-users] Labeling and Versioning Ryan Cromwell
- Nicklas Norling
