Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
#855 add AssemblyInformationalVersion with git sha
Browse files Browse the repository at this point in the history
  • Loading branch information
sawilde committed Jan 20, 2019
1 parent f655f88 commit f39a8a6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
49 changes: 25 additions & 24 deletions build/version.build
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
<?xml version="1.0"?>
<project name="OpenCover" >

<target name="netfx.tools" >
<fail message="Please install 'Microsoft Windows SDK for Windows 8 and .NET Framework'" unless="${directory::exists(netfx.tools.folder)}" />
</target>
<target name="netfx.tools" >
<fail message="Please install 'Microsoft Windows SDK for Windows 8 and .NET Framework'" unless="${directory::exists(netfx.tools.folder)}" />
</target>

<target name="create-snk" depends="netfx.tools">
<property name="source.opencover.snk.file" value="${build.folder}\..\..\..\keys\opencover.snk" />
<property name="opencover.snk.file" value="${build.folder}\Version\opencover.snk" />
<property name="opencover.public.snk.file" value="${build.folder}\Version\opencover.public.snk" />
<target name="create-snk" depends="netfx.tools">
<property name="source.opencover.snk.file" value="${build.folder}\..\..\..\keys\opencover.snk" />
<property name="opencover.snk.file" value="${build.folder}\Version\opencover.snk" />
<property name="opencover.public.snk.file" value="${build.folder}\Version\opencover.public.snk" />

<copy file="${source.opencover.snk.file}" todir="${build.folder}\Version"
if="${file::exists(source.opencover.snk.file) and not file::exists(opencover.snk.file)}" />
<copy file="${source.opencover.snk.file}" todir="${build.folder}\Version"
if="${file::exists(source.opencover.snk.file) and not file::exists(opencover.snk.file)}" />

<exec program="${netfx.tools.folder}\sn.exe" commandline='-k "${opencover.snk.file}"' unless="${file::exists(opencover.snk.file)}"/>
<exec program="${netfx.tools.folder}\sn.exe" commandline='-p "${opencover.snk.file}" "${opencover.public.snk.file}"' unless="${file::exists(opencover.public.snk.file)}"/>
</target>
<exec program="${netfx.tools.folder}\sn.exe" commandline='-k "${opencover.snk.file}"' unless="${file::exists(opencover.snk.file)}"/>
<exec program="${netfx.tools.folder}\sn.exe" commandline='-p "${opencover.snk.file}" "${opencover.public.snk.file}"' unless="${file::exists(opencover.public.snk.file)}"/>
</target>

<target name="get-version-number" >
<echo file="${build.folder}\Version\Version.cs">using System.Reflection;&#xa;</echo>
<echo file="${build.folder}\Version\Version.cs" append="true">[assembly: AssemblyVersion("${buildnumber.version}")]&#xa;</echo>
<echo file="${build.folder}\Version\Version.cs" append="true">[assembly: AssemblyFileVersion("${buildnumber.version}")]&#xa;</echo>
<echo file="${build.folder}\Version\Version.cs">using System.Reflection;&#xa;</echo>
<echo file="${build.folder}\Version\Version.cs" append="true">[assembly: AssemblyVersion("${buildnumber.version}")]&#xa;</echo>
<echo file="${build.folder}\Version\Version.cs" append="true">[assembly: AssemblyFileVersion("${buildnumber.version}")]&#xa;</echo>
<echo file="${build.folder}\Version\Version.cs" append="true">[assembly: AssemblyInformationalVersion("${buildnumber.version}-${ci.gitSha}")]&#xa;</echo>

<echo file="${build.folder}\Version\Version.h">#define FILEVER ${buildnumber.major},${buildnumber.minor},${buildnumber.build},${buildnumber.revision}&#xa;</echo>
<echo file="${build.folder}\Version\Version.h" append="true">#define PRODUCTVER ${buildnumber.major},${buildnumber.minor},${buildnumber.build},${buildnumber.revision}&#xa;</echo>
<echo file="${build.folder}\Version\Version.h" append="true">#define STRFILEVER "${buildnumber.version}"&#xa;</echo>
<echo file="${build.folder}\Version\Version.h" append="true">#define STRPRODUCTVER "${buildnumber.version}"&#xa;</echo>
<echo file="${build.folder}\Version\Version.h">#define FILEVER ${buildnumber.major},${buildnumber.minor},${buildnumber.build},${buildnumber.revision}&#xa;</echo>
<echo file="${build.folder}\Version\Version.h" append="true">#define PRODUCTVER ${buildnumber.major},${buildnumber.minor},${buildnumber.build},${buildnumber.revision}&#xa;</echo>
<echo file="${build.folder}\Version\Version.h" append="true">#define STRFILEVER "${buildnumber.version}"&#xa;</echo>
<echo file="${build.folder}\Version\Version.h" append="true">#define STRPRODUCTVER "${buildnumber.version}"&#xa;</echo>

<echo file="${build.folder}\Version\Version.wxi">&lt;?define Version = "${buildnumber.major}.${buildnumber.minor}.${buildnumber.build}.${buildnumber.revision}" ?&gt;&#xa;</echo>
<echo file="${build.folder}\Version\Version.wxi" append="true">&lt;Include /&gt;&#xa;</echo>
<echo file="${build.folder}\Version\Version.wxi">&lt;?define Version = "${buildnumber.major}.${buildnumber.minor}.${buildnumber.build}.${buildnumber.revision}" ?&gt;&#xa;</echo>
<echo file="${build.folder}\Version\Version.wxi" append="true">&lt;Include /&gt;&#xa;</echo>
</target>

<target name="get-os-version" >
<property name="machine.os" value="${environment::get-operating-system()}" />
<property name="machine.version" value="${operating-system::get-version(environment::get-operating-system())}" />
<echo message="${machine.os} => ${machine.version}" />
<property name="machine.os" value="${environment::get-operating-system()}" />
<property name="machine.version" value="${operating-system::get-version(environment::get-operating-system())}" />
<echo message="${machine.os} => ${machine.version}" />
</target>

</project>
2 changes: 2 additions & 0 deletions default.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<property name="ci.buildNumber" value="0" unless="${property::exists('ci.buildNumber')}" />
<property name="ci.fullBuildNumber" value="${environment::get-variable('APPVEYOR_BUILD_VERSION')}" if="${environment::variable-exists('APPVEYOR_BUILD_VERSION')}"/>
<property name="ci.fullBuildNumber" value="0" unless="${property::exists('ci.fullBuildNumber')}" />
<property name="ci.gitSha" value="${environment::get-variable('APPVEYOR_REPO_COMMIT')}" if="${environment::variable-exists('APPVEYOR_REPO_COMMIT')}"/>
<property name="ci.gitSha" value="0000000" unless="${property::exists('ci.gitSha')}" />
<property name="coverity.folder" value="C:\Projects\cov-analysis-win64-7.7.0.4\cov-analysis-win64-7.7.0.4\bin" if="${directory::exists('C:\Projects\cov-analysis-win64-7.7.0.4\cov-analysis-win64-7.7.0.4\bin')}" />

<property name="coverity.exe" value="${coverity.folder}/cov-build.exe" if="${property::exists('coverity.folder')}" />
Expand Down

0 comments on commit f39a8a6

Please sign in to comment.