Moving the GitCommitHash code to a target to be shared amongst a couple of other targets.

This commit is contained in:
Livar Cunha 2020-01-09 12:52:53 -08:00
parent ca6e86d472
commit befcc966a5
3 changed files with 10 additions and 8 deletions

View file

@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="FinalizeBuild"
BeforeTargets="AfterBuild"
DependsOnTargets="GenerateFullNuGetVersion">
DependsOnTargets="GenerateFullNuGetVersion;GetCommitHash">
<CopyBlobsToLatest FeedUrl="$(DotnetPublishSdkAssetsBlobFeedUrl)"
AccountKey="$(DotNetPublishSdkAssetsBlobFeedKey)"
NugetVersion="$(FullNugetVersion)"

View file

@ -414,13 +414,7 @@
ReplacementStrings="$(ReplacementString)" />
</Target>
<Target Name="GenerateVersionFile" DependsOnTargets="SetupBundledComponents">
<Exec Command="git rev-parse HEAD"
ConsoleToMSBuild="true"
Condition=" '$(GitCommitHash)' == '' ">
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitHash" />
</Exec>
<Target Name="GenerateVersionFile" DependsOnTargets="SetupBundledComponents;GetCommitHash">
<WriteLinesToFile File="$(SdkOutputDirectory).version"
Lines="$(GitCommitHash);$(Version);$(Rid)"
Overwrite="true" />

View file

@ -5,4 +5,12 @@
<FullNugetVersion Condition=" '$(VersionSuffixDateStamp)' != '' And '$(VersionSuffixBuildOfTheDay)' != '' ">$(FullNugetVersion).$(VersionSuffixDateStamp).$(VersionSuffixBuildOfTheDay)</FullNugetVersion>
</PropertyGroup>
</Target>
<Target Name="GetCommitHash">
<Exec Command="git rev-parse HEAD"
ConsoleToMSBuild="true"
Condition=" '$(GitCommitHash)' == '' ">
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitHash" />
</Exec>
</Target>
</Project>