33 lines
1.2 KiB
XML
33 lines
1.2 KiB
XML
<Project ToolsVersion="15.0">
|
|
<Target Name="WriteGitCommitInfoProps">
|
|
<Exec Command="git rev-list --count HEAD"
|
|
ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitInfoCommitCount" />
|
|
</Exec>
|
|
|
|
<Exec Command="git rev-parse HEAD"
|
|
ConsoleToMSBuild="true">
|
|
<Output TaskParameter="ConsoleOutput" PropertyName="GitInfoCommitHash" />
|
|
</Exec>
|
|
|
|
<PropertyGroup>
|
|
<ShouldOverWriteThePropsFile
|
|
Condition=" '$(CommitCount)' != '$(GitInfoCommitCount)' Or
|
|
'$(CommitHash)' != '$(GitInfoCommitHash)' ">true</ShouldOverWriteThePropsFile>
|
|
|
|
<GitCommitInfoPropsContent>
|
|
<Project ToolsVersion="15.0">
|
|
<PropertyGroup>
|
|
<CommitCount>$(GitInfoCommitCount)</CommitCount>
|
|
<CommitHash>$(GitInfoCommitHash)</CommitHash>
|
|
</PropertyGroup>
|
|
</Project>
|
|
</GitCommitInfoPropsContent>
|
|
</PropertyGroup>
|
|
|
|
<WriteLinesToFile File="$(GitCommitInfoProps)"
|
|
Lines="$(GitCommitInfoPropsContent)"
|
|
Condition=" '$(ShouldOverwriteThePropsFile)' == 'true' "
|
|
Overwrite="true" />
|
|
</Target>
|
|
</Project>
|