dotnet-installer/build/GitCommitInfo.targets

34 lines
1.2 KiB
Text
Raw Normal View History

2017-02-08 22:02:29 +00:00
<Project ToolsVersion="15.0">
<Target Name="WriteGitCommitInfoProps">
<Exec Command="git rev-list --count HEAD"
ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitInfoCommitCount" />
</Exec>
2017-02-10 20:13:44 +00:00
<Exec Command="git rev-parse HEAD"
ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitInfoCommitHash" />
</Exec>
2017-02-08 22:02:29 +00:00
<PropertyGroup>
<ShouldOverWriteThePropsFile
Condition=" '$(CommitCount)' != '$(GitInfoCommitCount)' Or
2017-02-10 20:13:44 +00:00
'$(CommitHash)' != '$(GitInfoCommitHash)' ">true</ShouldOverWriteThePropsFile>
2017-02-08 22:02:29 +00:00
<GitCommitInfoPropsContent>
&lt;Project ToolsVersion=&quot;15.0&quot;&gt;
&lt;PropertyGroup&gt;
&lt;CommitCount&gt;$(GitInfoCommitCount)&lt;/CommitCount&gt;
2017-02-08 22:02:29 +00:00
&lt;CommitHash&gt;$(GitInfoCommitHash)&lt;/CommitHash&gt;
&lt;/PropertyGroup&gt;
&lt;/Project&gt;
</GitCommitInfoPropsContent>
</PropertyGroup>
<WriteLinesToFile File="$(GitCommitInfoProps)"
Lines="$(GitCommitInfoPropsContent)"
2017-02-09 18:50:21 +00:00
Condition=" '$(ShouldOverwriteThePropsFile)' == 'true' "
Overwrite="true" />
2017-02-08 22:02:29 +00:00
</Target>
</Project>