From b5b84c97ed27e20632c484ab5e9503e5e7afb50f Mon Sep 17 00:00:00 2001 From: Antoine Aubry Date: Tue, 30 Mar 2021 13:18:57 +0100 Subject: [PATCH] Build: Log more information when GitVersion fails --- tools/build/BuildDefinition.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/build/BuildDefinition.cs b/tools/build/BuildDefinition.cs index 3839276b..21dc8f74 100644 --- a/tools/build/BuildDefinition.cs +++ b/tools/build/BuildDefinition.cs @@ -24,7 +24,17 @@ public static class BuildDefinition { public static GitVersion ResolveVersion(Options options, PreviousReleases releases) { - var versionJson = Read("dotnet", $"gitversion /nofetch{(options.Verbose ? " /diag" : "")}", BasePath); + string versionJson; + try + { + versionJson = Read("dotnet", $"gitversion /nofetch{(options.Verbose ? " /diag" : "")}", BasePath); + } + catch (NonZeroExitCodeException) + { + Run("dotnet", "gitversion /nofetch /diag", BasePath); + throw; + } + WriteVerbose(versionJson); if (options.Verbose) @@ -226,7 +236,7 @@ public static ScaffoldedRelease ScaffoldReleaseNotes(GitVersion version, Previou .Select(c => string.Join(" \n", c)); var releaseNotes = string.Join("\n\n", log); - + WriteVerbose(releaseNotes); return new ScaffoldedRelease(releaseNotes);