From e30d44755ad17e8abf3efb53acc4a5d4f5a77ea7 Mon Sep 17 00:00:00 2001 From: Dave Glick Date: Wed, 18 Aug 2021 12:14:13 -0400 Subject: [PATCH] Updating StructuredLogger to fix type duplication problems --- ReleaseNotes.md | 2 ++ src/Buildalyzer/AnalyzerManager.cs | 6 ++---- src/Buildalyzer/Buildalyzer.csproj | 2 +- src/Buildalyzer/Logging/EventProcessor.cs | 12 ------------ 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index da26f0aa..b9edf2ed 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,5 +1,7 @@ # 3.2.4 +- Updated structured logging library to consolidate MSBuild and binary logging types (internal change, should be no impact to consumers). + # 3.2.3 - Fixed a bug where Buildalyzer.Workspaces would not add transitive references to projects in the Roslyn workspace (#181). diff --git a/src/Buildalyzer/AnalyzerManager.cs b/src/Buildalyzer/AnalyzerManager.cs index 034f430c..2925111f 100644 --- a/src/Buildalyzer/AnalyzerManager.cs +++ b/src/Buildalyzer/AnalyzerManager.cs @@ -1,14 +1,12 @@ -extern alias StructuredLogger; - -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using Buildalyzer.Logging; using Microsoft.Build.Construction; +using Microsoft.Build.Logging.StructuredLogger; using Microsoft.Extensions.Logging; -using StructuredLogger::Microsoft.Build.Logging.StructuredLogger; namespace Buildalyzer { diff --git a/src/Buildalyzer/Buildalyzer.csproj b/src/Buildalyzer/Buildalyzer.csproj index a1e7bf17..a5e685c9 100644 --- a/src/Buildalyzer/Buildalyzer.csproj +++ b/src/Buildalyzer/Buildalyzer.csproj @@ -34,7 +34,7 @@ - + diff --git a/src/Buildalyzer/Logging/EventProcessor.cs b/src/Buildalyzer/Logging/EventProcessor.cs index 6d16c264..b3ee4169 100644 --- a/src/Buildalyzer/Logging/EventProcessor.cs +++ b/src/Buildalyzer/Logging/EventProcessor.cs @@ -1,5 +1,3 @@ -extern alias StructuredLogger; - using System; using System.Collections; using System.Collections.Generic; @@ -67,8 +65,6 @@ public EventProcessor(AnalyzerManager manager, ProjectAnalyzer analyzer, IEnumer // See https://twitter.com/KirillOsenkov/status/1427686459713019904 private void StatusEventRaised(object sender, BuildStatusEventArgs e) { - // Needed to add an extern alias, see https://github.com/KirillOsenkov/MSBuildStructuredLog/issues/521 - // Also need to account for either type coming from either a StructuredLogging reader or MSBuild if (e is ProjectEvaluationFinishedEventArgs msBuildEv) { _evalulationResults[msBuildEv.BuildEventContext.EvaluationId] = new PropertiesAndItems @@ -77,14 +73,6 @@ private void StatusEventRaised(object sender, BuildStatusEventArgs e) Items = msBuildEv.Items }; } - else if (e is StructuredLogger::Microsoft.Build.Framework.ProjectEvaluationFinishedEventArgs slEv) - { - _evalulationResults[slEv.BuildEventContext.EvaluationId] = new PropertiesAndItems - { - Properties = slEv.Properties, - Items = slEv.Items - }; - } } private void ProjectStarted(object sender, ProjectStartedEventArgs e)