|
|
0cf1b4 |
From e02ee86364b9db3edc298a6a081004aa07473d09 Mon Sep 17 00:00:00 2001
|
|
|
0cf1b4 |
From: Omair Majid <omajid@redhat.com>
|
|
|
0cf1b4 |
Date: Wed, 29 Aug 2018 17:03:25 -0400
|
|
|
0cf1b4 |
Subject: [PATCH] Allow setting the commit id using /p:LatestCommit
|
|
|
0cf1b4 |
|
|
|
0cf1b4 |
This is similar to how CommitCount is already supported.
|
|
|
0cf1b4 |
|
|
|
0cf1b4 |
This lets consumers who are building outside a git repo, such as
|
|
|
0cf1b4 |
source-build, set a commit id which is displayed by `dotnet --info`
|
|
|
0cf1b4 |
and `strings dotnet | grep '@(#)'`.
|
|
|
0cf1b4 |
|
|
|
0cf1b4 |
See: https://github.com/dotnet/source-build/issues/651
|
|
|
0cf1b4 |
See: https://github.com/dotnet/cli/pull/5945
|
|
|
0cf1b4 |
---
|
|
|
0cf1b4 |
dir.targets | 9 +++++----
|
|
|
0cf1b4 |
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
0cf1b4 |
|
|
|
0cf1b4 |
diff --git a/dir.targets b/dir.targets
|
|
|
0cf1b4 |
index 8d34872c6..59dc1ebde 100644
|
|
|
0cf1b4 |
--- a/dir.targets
|
|
|
0cf1b4 |
+++ b/dir.targets
|
|
|
0cf1b4 |
@@ -17,7 +17,8 @@
|
|
|
0cf1b4 |
<Exec Command="$(DotnetToolCommand) build $(MSBuildThisFileDirectory)tools-local/tasks/core-setup.tasks.csproj" />
|
|
|
0cf1b4 |
</Target>
|
|
|
0cf1b4 |
|
|
|
0cf1b4 |
- <Target Name="GetLatestCommitHash">
|
|
|
0cf1b4 |
+
|
|
|
0cf1b4 |
+ Condition="'$(LatestCommit)' == ''">
|
|
|
0cf1b4 |
|
|
|
0cf1b4 |
<Exec Command="git rev-parse HEAD 2>&1" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true">
|
|
|
0cf1b4 |
<Output TaskParameter="ConsoleOutput" PropertyName="LatestCommit" />
|
|
|
0cf1b4 |
@@ -29,13 +30,13 @@
|
|
|
0cf1b4 |
</PropertyGroup>
|
|
|
0cf1b4 |
</Target>
|
|
|
0cf1b4 |
|
|
|
0cf1b4 |
- <Target Name="GetCommitCount">
|
|
|
0cf1b4 |
+
|
|
|
0cf1b4 |
+ Condition="'$(CommitCount)' == ''">
|
|
|
0cf1b4 |
|
|
|
0cf1b4 |
StandardOutputImportance="Low"
|
|
|
0cf1b4 |
IgnoreExitCode="true"
|
|
|
0cf1b4 |
IgnoreStandardErrorWarningFormat="true"
|
|
|
0cf1b4 |
- ConsoleToMSBuild="true"
|
|
|
0cf1b4 |
- Condition="'$(CommitCount)' == ''">
|
|
|
0cf1b4 |
+ ConsoleToMSBuild="true">
|
|
|
0cf1b4 |
<Output TaskParameter="ConsoleOutput" PropertyName="CommitCount" />
|
|
|
0cf1b4 |
<Output TaskParameter="ExitCode" PropertyName="CommitCountExitCode" />
|
|
|
0cf1b4 |
</Exec>
|