From 81a4d00b12e3cce30cf47e99fbd6323c718a0c87 Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Tue, 1 Mar 2022 14:34:17 -0600 Subject: [PATCH] Fix failure to report issues when clean fails If the clean fails, the rebuild never happens, and reading issues from the rebuild log needs to be skipped. --- Build/Tasks/Build.cs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Build/Tasks/Build.cs b/Build/Tasks/Build.cs index e9d3852f7ef..702c622dcfc 100644 --- a/Build/Tasks/Build.cs +++ b/Build/Tasks/Build.cs @@ -4,7 +4,7 @@ namespace DotNetNuke.Build.Tasks { using System; - using System.Collections.Generic; + using System.Linq; using Cake.Common.Build; using Cake.Common.Build.AzurePipelines.Data; @@ -41,18 +41,12 @@ public override void Run(Context context) } finally { - var issues = context.ReadIssues( - new List - { - new MsBuildIssuesProvider( - context.Log, - new MsBuildIssuesSettings(cleanLog, context.MsBuildBinaryLogFileFormat())), - new MsBuildIssuesProvider( - context.Log, - new MsBuildIssuesSettings(buildLog, context.MsBuildBinaryLogFileFormat())), - }, - context.Directory(".")); - + var issueProviders = + from logFilePath in new[] { cleanLog, buildLog, } + where context.FileExists(logFilePath) + let settings = new MsBuildIssuesSettings(cleanLog, context.MsBuildBinaryLogFileFormat()) + select new MsBuildIssuesProvider(context.Log, settings); + var issues = context.ReadIssues(issueProviders, context.Directory(".")); foreach (var issue in issues) { var messageData = new AzurePipelinesMessageData