dotnet-installer/build/Microsoft.DotNet.Cli.GitCommitInfo.targets

42 lines
1.9 KiB
Text
Raw Normal View History

2017-02-08 22:02:29 +00:00
<Project ToolsVersion="15.0">
<Target Name="WriteGitCommitInfoProps"
DependsOnTargets="BuildDotnetCliBuildFramework">
<GetCommitHash RepoRoot="$(RepoRoot)">
<Output TaskParameter="CommitHash" PropertyName="GitInfoCommitHash" />
</GetCommitHash>
<GenerateBuildVersionInfo RepoRoot="$(RepoRoot)"
VersionMajor="$(VersionMajor)"
VersionMinor="$(VersionMinor)"
VersionPatch="$(VersionPatch)"
ReleaseSuffix="$(ReleaseSuffix)">
<Output TaskParameter="CommitCount" PropertyName="GitInfoCommitCount" />
<Output TaskParameter="MsiVersion" PropertyName="BuildInfoMsiVersion" />
<Output TaskParameter="VersionBadgeMoniker" PropertyName="BuildInfoVersionBadgeMoniker" />
</GenerateBuildVersionInfo>
<PropertyGroup>
<ShouldOverWriteThePropsFile
Condition=" '$(CommitHash)' != '$(GitInfoCommitHash)' Or
'$(CommitCount)' != '$(GitInfoCommitCount)' Or
'$(MsiVersion)' != '$(BuildInfoMsiVersion)' Or
'$(VersionBadgeMoniker)' != '$(BuildInfoVersionBadgeMoniker)' ">true</ShouldOverWriteThePropsFile>
<GitCommitInfoPropsContent>
&lt;Project ToolsVersion=&quot;15.0&quot;&gt;
&lt;PropertyGroup&gt;
&lt;CommitHash&gt;$(GitInfoCommitHash)&lt;/CommitHash&gt;
&lt;CommitCount&gt;$(GitInfoCommitCount)&lt;/CommitCount&gt;
&lt;MsiVersion&gt;$(BuildInfoMsiVersion)&lt;/MsiVersion&gt;
&lt;VersionBadgeMoniker&gt;$(BuildInfoVersionBadgeMoniker)&lt;/VersionBadgeMoniker&gt;
&lt;/PropertyGroup&gt;
&lt;/Project&gt;
</GitCommitInfoPropsContent>
</PropertyGroup>
<WriteLinesToFile File="$(GitCommitInfoProps)"
Lines="$(GitCommitInfoPropsContent)"
Condition=" '$(ShouldOverwriteThePropsFile)' == 'true' "/>
</Target>
</Project>