88using System . Threading ;
99using Microsoft . Build . BackEnd ;
1010using Microsoft . Build . BackEnd . Logging ;
11+ using Microsoft . Build . Experimental . BuildCheck ;
1112using Microsoft . Build . Experimental . BuildCheck . Acquisition ;
1213using Microsoft . Build . Experimental . BuildCheck . Analyzers ;
1314using Microsoft . Build . Experimental . BuildCheck . Logging ;
14- using Microsoft . Build . Experimental . BuildCheck ;
1515using Microsoft . Build . Framework ;
1616using Microsoft . Build . Shared ;
1717
@@ -46,7 +46,7 @@ public void InitializeComponent(IBuildComponentHost host)
4646 IBuildCheckManager instance ;
4747 if ( host ! . BuildParameters . IsBuildCheckEnabled )
4848 {
49- instance = new BuildCheckManager ( host . LoggingService ) ;
49+ instance = new BuildCheckManager ( ) ;
5050 }
5151 else
5252 {
@@ -66,17 +66,15 @@ internal sealed class BuildCheckManager : IBuildCheckManager
6666 private readonly TracingReporter _tracingReporter = new TracingReporter ( ) ;
6767 private readonly ConfigurationProvider _configurationProvider = new ConfigurationProvider ( ) ;
6868 private readonly BuildCheckCentralContext _buildCheckCentralContext ;
69- private readonly ILoggingService _loggingService ;
7069 private readonly List < BuildAnalyzerFactoryContext > _analyzersRegistry ;
7170 private readonly bool [ ] _enabledDataSources = new bool [ ( int ) BuildCheckDataSource . ValuesCount ] ;
7271 private readonly BuildEventsProcessor _buildEventsProcessor ;
7372 private readonly IBuildCheckAcquisitionModule _acquisitionModule ;
7473
75- internal BuildCheckManager ( ILoggingService loggingService )
74+ internal BuildCheckManager ( )
7675 {
7776 _analyzersRegistry = new List < BuildAnalyzerFactoryContext > ( ) ;
7877 _acquisitionModule = new BuildCheckAcquisitionModule ( ) ;
79- _loggingService = loggingService ;
8078 _buildCheckCentralContext = new ( _configurationProvider ) ;
8179 _buildEventsProcessor = new ( _buildCheckCentralContext ) ;
8280 }
@@ -205,7 +203,7 @@ internal void RegisterCustomAnalyzer(
205203 }
206204 }
207205
208- private void SetupSingleAnalyzer ( BuildAnalyzerFactoryContext analyzerFactoryContext , string projectFullPath , BuildEventContext buildEventContext )
206+ private void SetupSingleAnalyzer ( BuildAnalyzerFactoryContext analyzerFactoryContext , string projectFullPath )
209207 {
210208 // For custom analyzers - it should run only on projects where referenced
211209 // (otherwise error out - https://github.com/orgs/dotnet/projects/373/views/1?pane=issue&itemId=57849480)
@@ -283,7 +281,7 @@ private void SetupSingleAnalyzer(BuildAnalyzerFactoryContext analyzerFactoryCont
283281 }
284282 }
285283
286- private void SetupAnalyzersForNewProject ( string projectFullPath , BuildEventContext buildEventContext )
284+ private void SetupAnalyzersForNewProject ( string projectFullPath , AnalyzerLoggingContext loggingContext )
287285 {
288286 // Only add analyzers here
289287 // On an execution node - we might remove and dispose the analyzers once project is done
@@ -295,11 +293,11 @@ private void SetupAnalyzersForNewProject(string projectFullPath, BuildEventConte
295293 {
296294 try
297295 {
298- SetupSingleAnalyzer ( analyzerFactoryContext , projectFullPath , buildEventContext ) ;
296+ SetupSingleAnalyzer ( analyzerFactoryContext , projectFullPath ) ;
299297 }
300298 catch ( BuildCheckConfigurationException e )
301299 {
302- _loggingService . LogErrorFromText ( buildEventContext , null , null , null ,
300+ loggingContext . LogErrorFromText ( null , null , null ,
303301 new BuildEventFileInfo ( projectFullPath ) ,
304302 e . Message ) ;
305303 analyzersToRemove . Add ( analyzerFactoryContext ) ;
@@ -309,7 +307,7 @@ private void SetupAnalyzersForNewProject(string projectFullPath, BuildEventConte
309307 analyzersToRemove . ForEach ( c =>
310308 {
311309 _analyzersRegistry . Remove ( c ) ;
312- _loggingService . LogCommentFromText ( buildEventContext , MessageImportance . High , $ "Dismounting analyzer '{ c . FriendlyName } '") ;
310+ loggingContext . LogCommentFromText ( MessageImportance . High , $ "Dismounting analyzer '{ c . FriendlyName } '") ;
313311 } ) ;
314312 foreach ( var analyzerToRemove in analyzersToRemove . Select ( a => a . MaterializedAnalyzer ) . Where ( a => a != null ) )
315313 {
@@ -377,7 +375,9 @@ public void FinalizeProcessing(LoggingContext loggingContext)
377375 loggingContext . LogBuildEvent ( analyzerEventArg ) ;
378376 }
379377
380- public void StartProjectEvaluation ( BuildCheckDataSource buildCheckDataSource , BuildEventContext buildEventContext ,
378+ public void StartProjectEvaluation (
379+ BuildCheckDataSource buildCheckDataSource ,
380+ AnalyzerLoggingContext loggingContext ,
381381 string fullPath )
382382 {
383383 if ( buildCheckDataSource == BuildCheckDataSource . EventArgs && IsInProcNode )
@@ -388,7 +388,7 @@ public void StartProjectEvaluation(BuildCheckDataSource buildCheckDataSource, Bu
388388 return ;
389389 }
390390
391- SetupAnalyzersForNewProject ( fullPath , buildEventContext ) ;
391+ SetupAnalyzersForNewProject ( fullPath , loggingContext ) ;
392392 }
393393
394394 /*
0 commit comments