diff --git a/src/Build.UnitTests/BackEnd/MockHost.cs b/src/Build.UnitTests/BackEnd/MockHost.cs index 649c7488669..a5df5d99cfa 100644 --- a/src/Build.UnitTests/BackEnd/MockHost.cs +++ b/src/Build.UnitTests/BackEnd/MockHost.cs @@ -5,7 +5,7 @@ using Microsoft.Build.BackEnd; using Microsoft.Build.BackEnd.Logging; using Microsoft.Build.BackEnd.SdkResolution; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Infrastructure; using Microsoft.Build.Engine.UnitTests.BackEnd; using Microsoft.Build.Evaluation; using Microsoft.Build.Execution; @@ -62,7 +62,7 @@ internal sealed class MockHost : MockLoggingService, IBuildComponentHost, IBuild private ISdkResolverService _sdkResolverService; - private IBuildCopManagerProvider _buildCopManagerProvider; + private IBuildCheckManagerProvider _buildCheckManagerProvider; #region SystemParameterFields @@ -130,8 +130,8 @@ public MockHost(BuildParameters buildParameters, ConfigCache overrideConfigCache _sdkResolverService = new MockSdkResolverService(); ((IBuildComponent)_sdkResolverService).InitializeComponent(this); - _buildCopManagerProvider = new NullBuildCopManagerProvider(); - ((IBuildComponent)_buildCopManagerProvider).InitializeComponent(this); + _buildCheckManagerProvider = new NullBuildCheckManagerProvider(); + ((IBuildComponent)_buildCheckManagerProvider).InitializeComponent(this); } /// @@ -200,7 +200,7 @@ public IBuildComponent GetComponent(BuildComponentType type) BuildComponentType.ResultsCache => (IBuildComponent)_resultsCache, BuildComponentType.RequestBuilder => (IBuildComponent)_requestBuilder, BuildComponentType.SdkResolverService => (IBuildComponent)_sdkResolverService, - BuildComponentType.BuildCop => (IBuildComponent)_buildCopManagerProvider, + BuildComponentType.BuildCheck => (IBuildComponent)_buildCheckManagerProvider, _ => throw new ArgumentException("Unexpected type " + type), }; } diff --git a/src/Build/BackEnd/BuildManager/BuildManager.cs b/src/Build/BackEnd/BuildManager/BuildManager.cs index 163b43544ae..f99833cdc15 100644 --- a/src/Build/BackEnd/BuildManager/BuildManager.cs +++ b/src/Build/BackEnd/BuildManager/BuildManager.cs @@ -21,13 +21,13 @@ using Microsoft.Build.BackEnd; using Microsoft.Build.BackEnd.Logging; using Microsoft.Build.BackEnd.SdkResolution; -using Microsoft.Build.BuildCop.Infrastructure; -using Microsoft.Build.BuildCop.Logging; +using Microsoft.Build.BuildCheck.Infrastructure; +using Microsoft.Build.BuildCheck.Logging; using Microsoft.Build.Evaluation; using Microsoft.Build.Eventing; using Microsoft.Build.Exceptions; using Microsoft.Build.Experimental; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Experimental.ProjectCache; using Microsoft.Build.FileAccesses; using Microsoft.Build.Framework; @@ -2984,15 +2984,15 @@ private ILoggingService CreateLoggingService( loggingService.WarningsNotAsErrors = warningsNotAsErrors; loggingService.WarningsAsMessages = warningsAsMessages; - if (((IBuildComponentHost)this).BuildParameters.IsBuildCopEnabled) + if (((IBuildComponentHost)this).BuildParameters.IsBuildCheckEnabled) { - var buildCopManagerProvider = - ((IBuildComponentHost)this).GetComponent(BuildComponentType.BuildCop) as IBuildCopManagerProvider; - buildCopManagerProvider!.Instance.SetDataSource(BuildCopDataSource.EventArgs); + var buildCheckManagerProvider = + ((IBuildComponentHost)this).GetComponent(BuildComponentType.BuildCheck) as IBuildCheckManagerProvider; + buildCheckManagerProvider!.Instance.SetDataSource(BuildCheckDataSource.EventArgs); loggers = (loggers ?? Enumerable.Empty()).Concat(new[] { - new BuildCopConnectorLogger(new AnalyzerLoggingContextFactory(loggingService), buildCopManagerProvider.Instance) + new BuildCheckConnectorLogger(new AnalyzerLoggingContextFactory(loggingService), buildCheckManagerProvider.Instance) }); } diff --git a/src/Build/BackEnd/BuildManager/BuildParameters.cs b/src/Build/BackEnd/BuildManager/BuildParameters.cs index 952133d7ee2..826fbadef56 100644 --- a/src/Build/BackEnd/BuildManager/BuildParameters.cs +++ b/src/Build/BackEnd/BuildManager/BuildParameters.cs @@ -11,7 +11,7 @@ using Microsoft.Build.Collections; using Microsoft.Build.Evaluation; using Microsoft.Build.Experimental; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Experimental.ProjectCache; using Microsoft.Build.Framework; using Microsoft.Build.Graph; @@ -209,7 +209,7 @@ public class BuildParameters : ITranslatable private bool _question; - private bool _isBuildCopEnabled; + private bool _isBuildCheckEnabled; /// /// The settings used to load the project under build @@ -313,7 +313,7 @@ internal BuildParameters(BuildParameters other, bool resetEnvironment = false) DiscardBuildResults = other.DiscardBuildResults; LowPriority = other.LowPriority; Question = other.Question; - IsBuildCopEnabled = other.IsBuildCopEnabled; + IsBuildCheckEnabled = other.IsBuildCheckEnabled; ProjectCacheDescriptor = other.ProjectCacheDescriptor; } @@ -842,10 +842,10 @@ public bool Question /// /// Gets or sets an indication of build analysis enablement. /// - public bool IsBuildCopEnabled + public bool IsBuildCheckEnabled { - get => _isBuildCopEnabled; - set => _isBuildCopEnabled = value; + get => _isBuildCheckEnabled; + set => _isBuildCheckEnabled = value; } /// @@ -912,7 +912,7 @@ void ITranslatable.Translate(ITranslator translator) translator.TranslateEnum(ref _projectLoadSettings, (int)_projectLoadSettings); translator.Translate(ref _interactive); translator.Translate(ref _question); - translator.Translate(ref _isBuildCopEnabled); + translator.Translate(ref _isBuildCheckEnabled); translator.TranslateEnum(ref _projectIsolationMode, (int)_projectIsolationMode); translator.Translate(ref _reportFileAccesses); diff --git a/src/Build/BackEnd/Components/BuildComponentFactoryCollection.cs b/src/Build/BackEnd/Components/BuildComponentFactoryCollection.cs index 930225a0c9f..865d1da9149 100644 --- a/src/Build/BackEnd/Components/BuildComponentFactoryCollection.cs +++ b/src/Build/BackEnd/Components/BuildComponentFactoryCollection.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using Microsoft.Build.BackEnd.Components.Caching; using Microsoft.Build.BackEnd.SdkResolution; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Infrastructure; using Microsoft.Build.FileAccesses; using Microsoft.Build.Shared; @@ -78,7 +78,7 @@ public void RegisterDefaultFactories() _componentEntriesByType[BuildComponentType.LoggingService] = new BuildComponentEntry(BuildComponentType.LoggingService, null); _componentEntriesByType[BuildComponentType.RequestBuilder] = new BuildComponentEntry(BuildComponentType.RequestBuilder, RequestBuilder.CreateComponent, CreationPattern.CreateAlways); // This conditionally registers real or no-op implementation based on BuildParameters - _componentEntriesByType[BuildComponentType.BuildCop] = new BuildComponentEntry(BuildComponentType.BuildCop, BuildCopManagerProvider.CreateComponent, CreationPattern.Singleton); + _componentEntriesByType[BuildComponentType.BuildCheck] = new BuildComponentEntry(BuildComponentType.BuildCheck, BuildCheckManagerProvider.CreateComponent, CreationPattern.Singleton); _componentEntriesByType[BuildComponentType.TargetBuilder] = new BuildComponentEntry(BuildComponentType.TargetBuilder, TargetBuilder.CreateComponent, CreationPattern.CreateAlways); _componentEntriesByType[BuildComponentType.TaskBuilder] = new BuildComponentEntry(BuildComponentType.TaskBuilder, TaskBuilder.CreateComponent, CreationPattern.CreateAlways); _componentEntriesByType[BuildComponentType.RegisteredTaskObjectCache] = new BuildComponentEntry(BuildComponentType.RegisteredTaskObjectCache, RegisteredTaskObjectCache.CreateComponent, CreationPattern.Singleton); diff --git a/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs b/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs index 4932f0c2293..05d11dc38cb 100644 --- a/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs +++ b/src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs @@ -10,7 +10,7 @@ using System.Threading; using System.Threading.Tasks.Dataflow; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Infrastructure; using Microsoft.Build.Execution; using Microsoft.Build.Framework; using Microsoft.Build.Shared; @@ -283,8 +283,8 @@ public void CleanupForBuild() throw new AggregateException(deactivateExceptions); } - var buildCopManager = (_componentHost.GetComponent(BuildComponentType.BuildCop) as IBuildCopManagerProvider)!.Instance; - buildCopManager.FinalizeProcessing(_nodeLoggingContext); + var buildCheckManager = (_componentHost.GetComponent(BuildComponentType.BuildCheck) as IBuildCheckManagerProvider)!.Instance; + buildCheckManager.FinalizeProcessing(_nodeLoggingContext); }, isLastTask: true); diff --git a/src/Build/BackEnd/Components/IBuildComponentHost.cs b/src/Build/BackEnd/Components/IBuildComponentHost.cs index e7392d7d42c..2ebea5a290a 100644 --- a/src/Build/BackEnd/Components/IBuildComponentHost.cs +++ b/src/Build/BackEnd/Components/IBuildComponentHost.cs @@ -146,7 +146,7 @@ internal enum BuildComponentType /// /// The Build Analyzer Manager. /// - BuildCop, + BuildCheck, } /// diff --git a/src/Build/BackEnd/Components/Logging/EventSourceSink.cs b/src/Build/BackEnd/Components/Logging/EventSourceSink.cs index 5ac9a885806..5c58d92561e 100644 --- a/src/Build/BackEnd/Components/Logging/EventSourceSink.cs +++ b/src/Build/BackEnd/Components/Logging/EventSourceSink.cs @@ -2,8 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using Microsoft.Build.BuildCop.Infrastructure; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.BuildCheck.Infrastructure; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Framework; using Microsoft.Build.Shared; @@ -104,7 +104,7 @@ internal sealed class EventSourceSink : /// /// This event is raised to log build cop events. /// - public event BuildCopEventHandler BuildCopEventRaised; + public event BuildCheckEventHandler BuildCheckEventRaised; #endregion #region Properties @@ -270,8 +270,8 @@ public void Consume(BuildEventArgs buildEvent) case TelemetryEventArgs telemetryEvent: RaiseTelemetryEvent(null, telemetryEvent); break; - case BuildCopEventArgs buildCopEvent: - RaiseBuildCopEvent(null, buildCopEvent); + case BuildCheckEventArgs buildCheckEvent: + RaiseBuildCheckEvent(null, buildCheckEvent); break; default: @@ -859,13 +859,13 @@ private void RaiseStatusEvent(object sender, BuildStatusEventArgs buildEvent) RaiseAnyEvent(sender, buildEvent); } - private void RaiseBuildCopEvent(object sender, BuildCopEventArgs buildEvent) + private void RaiseBuildCheckEvent(object sender, BuildCheckEventArgs buildEvent) { - if (BuildCopEventRaised != null) + if (BuildCheckEventRaised != null) { try { - BuildCopEventRaised(sender, buildEvent); + BuildCheckEventRaised(sender, buildEvent); } catch (LoggerException) { diff --git a/src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs b/src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs index ce2f4a1e79e..5d4938c7b7b 100644 --- a/src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs +++ b/src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs @@ -10,13 +10,13 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Infrastructure; using Microsoft.Build.Collections; using Microsoft.Build.Evaluation; using Microsoft.Build.Eventing; using Microsoft.Build.Exceptions; using Microsoft.Build.Execution; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Framework; using Microsoft.Build.Internal; using Microsoft.Build.Shared; @@ -1118,10 +1118,10 @@ private void SetProjectCurrentDirectory() /// private async Task BuildProject() { - // We consider this the entrypoint for the project build for purposes of BuildCop processing + // We consider this the entrypoint for the project build for purposes of BuildCheck processing - var buildCopManager = (_componentHost.GetComponent(BuildComponentType.BuildCop) as IBuildCopManagerProvider)!.Instance; - buildCopManager.SetDataSource(BuildCopDataSource.BuildExecution); + var buildCheckManager = (_componentHost.GetComponent(BuildComponentType.BuildCheck) as IBuildCheckManagerProvider)!.Instance; + buildCheckManager.SetDataSource(BuildCheckDataSource.BuildExecution); ErrorUtilities.VerifyThrow(_targetBuilder != null, "Target builder is null"); @@ -1137,8 +1137,8 @@ private async Task BuildProject() // Load the project if (!_requestEntry.RequestConfiguration.IsLoaded) { - buildCopManager.StartProjectEvaluation( - BuildCopDataSource.BuildExecution, + buildCheckManager.StartProjectEvaluation( + BuildCheckDataSource.BuildExecution, _requestEntry.Request.ParentBuildEventContext, _requestEntry.RequestConfiguration.ProjectFullPath); @@ -1162,14 +1162,14 @@ private async Task BuildProject() } finally { - buildCopManager.EndProjectEvaluation( - BuildCopDataSource.BuildExecution, + buildCheckManager.EndProjectEvaluation( + BuildCheckDataSource.BuildExecution, _requestEntry.Request.ParentBuildEventContext); } _projectLoggingContext = _nodeLoggingContext.LogProjectStarted(_requestEntry); - buildCopManager.StartProjectRequest( - BuildCopDataSource.BuildExecution, + buildCheckManager.StartProjectRequest( + BuildCheckDataSource.BuildExecution, _requestEntry.Request.ParentBuildEventContext); // Now that the project has started, parse a few known properties which indicate warning codes to treat as errors or messages @@ -1223,8 +1223,8 @@ private async Task BuildProject() MSBuildEventSource.Log.BuildProjectStop(_requestEntry.RequestConfiguration.ProjectFullPath, string.Join(", ", allTargets)); } - buildCopManager.EndProjectRequest( - BuildCopDataSource.BuildExecution, + buildCheckManager.EndProjectRequest( + BuildCheckDataSource.BuildExecution, _requestEntry.Request.ParentBuildEventContext); return result; diff --git a/src/Build/BuildCop/API/BuildAnalyzer.cs b/src/Build/BuildCheck/API/BuildAnalyzer.cs similarity index 88% rename from src/Build/BuildCop/API/BuildAnalyzer.cs rename to src/Build/BuildCheck/API/BuildAnalyzer.cs index 6299fc4c282..0cb8cbaa629 100644 --- a/src/Build/BuildCop/API/BuildAnalyzer.cs +++ b/src/Build/BuildCheck/API/BuildAnalyzer.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Infrastructure; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// Base class for build analyzers. @@ -39,7 +39,7 @@ public abstract class BuildAnalyzer : IDisposable /// /// /// - public abstract void RegisterActions(IBuildCopRegistrationContext registrationContext); + public abstract void RegisterActions(IBuildCheckRegistrationContext registrationContext); public virtual void Dispose() { } diff --git a/src/Build/BuildCop/API/BuildAnalyzerConfiguration.cs b/src/Build/BuildCheck/API/BuildAnalyzerConfiguration.cs similarity index 93% rename from src/Build/BuildCop/API/BuildAnalyzerConfiguration.cs rename to src/Build/BuildCheck/API/BuildAnalyzerConfiguration.cs index 19ab210e097..03cb9381080 100644 --- a/src/Build/BuildCop/API/BuildAnalyzerConfiguration.cs +++ b/src/Build/BuildCheck/API/BuildAnalyzerConfiguration.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// Configuration for a build analyzer. @@ -16,7 +16,7 @@ public class BuildAnalyzerConfiguration // nor in the editorconfig configuration file. public static BuildAnalyzerConfiguration Default { get; } = new() { - EvaluationAnalysisScope = BuildCop.EvaluationAnalysisScope.AnalyzedProjectOnly, + EvaluationAnalysisScope = BuildCheck.EvaluationAnalysisScope.AnalyzedProjectOnly, Severity = BuildAnalyzerResultSeverity.Info, IsEnabled = false, }; diff --git a/src/Build/BuildCop/API/BuildAnalyzerResultSeverity.cs b/src/Build/BuildCheck/API/BuildAnalyzerResultSeverity.cs similarity index 87% rename from src/Build/BuildCop/API/BuildAnalyzerResultSeverity.cs rename to src/Build/BuildCheck/API/BuildAnalyzerResultSeverity.cs index 955b91f52ad..412a014be06 100644 --- a/src/Build/BuildCop/API/BuildAnalyzerResultSeverity.cs +++ b/src/Build/BuildCheck/API/BuildAnalyzerResultSeverity.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// The severity of reported result (or preconfigured or user configured severity for a rule). diff --git a/src/Build/BuildCop/API/BuildAnalyzerRule.cs b/src/Build/BuildCheck/API/BuildAnalyzerRule.cs similarity index 94% rename from src/Build/BuildCop/API/BuildAnalyzerRule.cs rename to src/Build/BuildCheck/API/BuildAnalyzerRule.cs index 06194471be5..9e610834691 100644 --- a/src/Build/BuildCop/API/BuildAnalyzerRule.cs +++ b/src/Build/BuildCheck/API/BuildAnalyzerRule.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// Represents a rule that is a unit of build analysis. @@ -49,7 +49,7 @@ public BuildAnalyzerRule(string id, string title, string description, string cat public string Category { get; } /// - /// Message format that will be used by the actual reports () - those will just supply the actual arguments. + /// Message format that will be used by the actual reports () - those will just supply the actual arguments. /// public string MessageFormat { get; } diff --git a/src/Build/BuildCop/API/BuildCopResult.cs b/src/Build/BuildCheck/API/BuildCheckResult.cs similarity index 71% rename from src/Build/BuildCop/API/BuildCopResult.cs rename to src/Build/BuildCheck/API/BuildCheckResult.cs index 9a2842178d0..97975cf7051 100644 --- a/src/Build/BuildCop/API/BuildCopResult.cs +++ b/src/Build/BuildCheck/API/BuildCheckResult.cs @@ -6,7 +6,7 @@ using Microsoft.Build.Construction; using Microsoft.Build.Framework; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// Representation of a single report of a single finding from a BuildAnalyzer @@ -14,14 +14,14 @@ namespace Microsoft.Build.Experimental.BuildCop; /// Optionally a location is attached - in the near future we might need to support multiple locations /// (for 2 cases - a) grouped result for multiple occurrences; b) a single report for a finding resulting from combination of multiple locations) /// -public sealed class BuildCopResult : IBuildCopResult +public sealed class BuildCheckResult : IBuildCheckResult { - public static BuildCopResult Create(BuildAnalyzerRule rule, ElementLocation location, params string[] messageArgs) + public static BuildCheckResult Create(BuildAnalyzerRule rule, ElementLocation location, params string[] messageArgs) { - return new BuildCopResult(rule, location, messageArgs); + return new BuildCheckResult(rule, location, messageArgs); } - public BuildCopResult(BuildAnalyzerRule buildAnalyzerRule, ElementLocation location, string[] messageArgs) + public BuildCheckResult(BuildAnalyzerRule buildAnalyzerRule, ElementLocation location, string[] messageArgs) { BuildAnalyzerRule = buildAnalyzerRule; Location = location; @@ -31,9 +31,9 @@ public BuildCopResult(BuildAnalyzerRule buildAnalyzerRule, ElementLocation locat internal BuildEventArgs ToEventArgs(BuildAnalyzerResultSeverity severity) => severity switch { - BuildAnalyzerResultSeverity.Info => new BuildCopResultMessage(this), - BuildAnalyzerResultSeverity.Warning => new BuildCopResultWarning(this), - BuildAnalyzerResultSeverity.Error => new BuildCopResultError(this), + BuildAnalyzerResultSeverity.Info => new BuildCheckResultMessage(this), + BuildAnalyzerResultSeverity.Warning => new BuildCheckResultWarning(this), + BuildAnalyzerResultSeverity.Error => new BuildCheckResultError(this), _ => throw new ArgumentOutOfRangeException(nameof(severity), severity, null), }; diff --git a/src/Build/BuildCop/API/ConfigurationContext.cs b/src/Build/BuildCheck/API/ConfigurationContext.cs similarity index 81% rename from src/Build/BuildCop/API/ConfigurationContext.cs rename to src/Build/BuildCheck/API/ConfigurationContext.cs index 1ee058be2f0..4ea815eb2b8 100644 --- a/src/Build/BuildCop/API/ConfigurationContext.cs +++ b/src/Build/BuildCheck/API/ConfigurationContext.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Infrastructure; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// Holder of an optional configuration from .editorconfig file (not recognized by the infrastructure) @@ -20,14 +20,14 @@ private ConfigurationContext(CustomConfigurationData[] customConfigurationData) internal static ConfigurationContext FromDataEnumeration(CustomConfigurationData[] customConfigurationData) { - if (!customConfigurationData.Any(BuildCop.CustomConfigurationData.NotNull)) + if (!customConfigurationData.Any(BuildCheck.CustomConfigurationData.NotNull)) { return Null; } return new ConfigurationContext( customConfigurationData - .Where(BuildCop.CustomConfigurationData.NotNull) + .Where(BuildCheck.CustomConfigurationData.NotNull) .ToArray()); } diff --git a/src/Build/BuildCop/API/EvaluationAnalysisScope.cs b/src/Build/BuildCheck/API/EvaluationAnalysisScope.cs similarity index 95% rename from src/Build/BuildCop/API/EvaluationAnalysisScope.cs rename to src/Build/BuildCheck/API/EvaluationAnalysisScope.cs index f8979ed8257..7ff6471a39a 100644 --- a/src/Build/BuildCop/API/EvaluationAnalysisScope.cs +++ b/src/Build/BuildCheck/API/EvaluationAnalysisScope.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// For datasource events that can differentiate from where exactly they originate - e.g. diff --git a/src/Build/BuildCheck/API/IBuildCheckRegistrationContext.cs b/src/Build/BuildCheck/API/IBuildCheckRegistrationContext.cs new file mode 100644 index 00000000000..04cdf5aa87f --- /dev/null +++ b/src/Build/BuildCheck/API/IBuildCheckRegistrationContext.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; + +namespace Microsoft.Build.Experimental.BuildCheck; + +public interface IBuildCheckRegistrationContext +{ + void RegisterEvaluatedPropertiesAction(Action> evaluatedPropertiesAction); + void RegisterParsedItemsAction(Action> parsedItemsAction); +} diff --git a/src/Build/BuildCop/Acquisition/AnalyzerAcquisitionData.cs b/src/Build/BuildCheck/Acquisition/AnalyzerAcquisitionData.cs similarity index 70% rename from src/Build/BuildCop/Acquisition/AnalyzerAcquisitionData.cs rename to src/Build/BuildCheck/Acquisition/AnalyzerAcquisitionData.cs index 1f75152284f..c71d69d115c 100644 --- a/src/Build/BuildCop/Acquisition/AnalyzerAcquisitionData.cs +++ b/src/Build/BuildCheck/Acquisition/AnalyzerAcquisitionData.cs @@ -6,9 +6,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; -namespace Microsoft.Build.BuildCop.Acquisition; +namespace Microsoft.Build.BuildCheck.Acquisition; // TODO: Acquisition // define the data that will be passed to the acquisition module (and remoted if needed) @@ -19,8 +19,8 @@ internal class AnalyzerAcquisitionData(string data) internal static class AnalyzerAcquisitionDataExtensions { - public static AnalyzerAcquisitionData ToAnalyzerAcquisitionData(this BuildCopAcquisitionEventArgs eventArgs) => + public static AnalyzerAcquisitionData ToAnalyzerAcquisitionData(this BuildCheckAcquisitionEventArgs eventArgs) => new(eventArgs.AcquisitionData); - public static BuildCopAcquisitionEventArgs ToBuildEventArgs(this AnalyzerAcquisitionData data) => new(data.Data); + public static BuildCheckAcquisitionEventArgs ToBuildEventArgs(this AnalyzerAcquisitionData data) => new(data.Data); } diff --git a/src/Build/BuildCop/Acquisition/BuildCopAcquisitionModule.cs b/src/Build/BuildCheck/Acquisition/BuildCheckAcquisitionModule.cs similarity index 74% rename from src/Build/BuildCop/Acquisition/BuildCopAcquisitionModule.cs rename to src/Build/BuildCheck/Acquisition/BuildCheckAcquisitionModule.cs index 9131be44995..bd7463085a1 100644 --- a/src/Build/BuildCop/Acquisition/BuildCopAcquisitionModule.cs +++ b/src/Build/BuildCheck/Acquisition/BuildCheckAcquisitionModule.cs @@ -6,12 +6,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Microsoft.Build.BuildCop.Analyzers; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Analyzers; +using Microsoft.Build.BuildCheck.Infrastructure; -namespace Microsoft.Build.BuildCop.Acquisition; +namespace Microsoft.Build.BuildCheck.Acquisition; -internal class BuildCopAcquisitionModule +internal class BuildCheckAcquisitionModule { private static T Construct() where T : new() => new(); public BuildAnalyzerFactory CreateBuildAnalyzerFactory(AnalyzerAcquisitionData analyzerAcquisitionData) diff --git a/src/Build/BuildCop/Analyzers/SharedOutputPathAnalyzer.cs b/src/Build/BuildCheck/Analyzers/SharedOutputPathAnalyzer.cs similarity index 86% rename from src/Build/BuildCop/Analyzers/SharedOutputPathAnalyzer.cs rename to src/Build/BuildCheck/Analyzers/SharedOutputPathAnalyzer.cs index b028f78ee88..970b644d495 100644 --- a/src/Build/BuildCop/Analyzers/SharedOutputPathAnalyzer.cs +++ b/src/Build/BuildCheck/Analyzers/SharedOutputPathAnalyzer.cs @@ -6,11 +6,11 @@ using System.Collections.Immutable; using System.Diagnostics; using System.IO; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Infrastructure; using Microsoft.Build.Construction; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; -namespace Microsoft.Build.BuildCop.Analyzers; +namespace Microsoft.Build.BuildCheck.Analyzers; @@ -30,7 +30,7 @@ public override void Initialize(ConfigurationContext configurationContext) /* This is it - no custom configuration */ } - public override void RegisterActions(IBuildCopRegistrationContext registrationContext) + public override void RegisterActions(IBuildCheckRegistrationContext registrationContext) { registrationContext.RegisterEvaluatedPropertiesAction(EvaluatedPropertiesAction); } @@ -38,7 +38,7 @@ public override void RegisterActions(IBuildCopRegistrationContext registrationCo private readonly Dictionary _projectsPerOutputPath = new(StringComparer.CurrentCultureIgnoreCase); private readonly HashSet _projects = new(StringComparer.CurrentCultureIgnoreCase); - private void EvaluatedPropertiesAction(BuildCopDataContext context) + private void EvaluatedPropertiesAction(BuildCheckDataContext context) { if (!_projects.Add(context.Data.ProjectFilePath)) { @@ -61,7 +61,7 @@ private void EvaluatedPropertiesAction(BuildCopDataContext context) + private string? CheckAndAddFullOutputPath(string? path, BuildCheckDataContext context) { if (string.IsNullOrEmpty(path)) { @@ -77,7 +77,7 @@ private void EvaluatedPropertiesAction(BuildCopDataContext /// Counterpart type for BuildAnalyzerConfiguration - with all properties non-nullable diff --git a/src/Build/BuildCop/Infrastructure/BuildAnalyzerWrapper.cs b/src/Build/BuildCheck/Infrastructure/BuildAnalyzerWrapper.cs similarity index 91% rename from src/Build/BuildCop/Infrastructure/BuildAnalyzerWrapper.cs rename to src/Build/BuildCheck/Infrastructure/BuildAnalyzerWrapper.cs index 173b3e48a5a..22d116d95a1 100644 --- a/src/Build/BuildCop/Infrastructure/BuildAnalyzerWrapper.cs +++ b/src/Build/BuildCheck/Infrastructure/BuildAnalyzerWrapper.cs @@ -6,9 +6,9 @@ using System.Diagnostics; using System.Linq; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; /// /// A wrapping, enriching class for BuildAnalyzer - so that we have additional data and functionality. @@ -49,7 +49,7 @@ internal void StartNewProject( } } - // to be used on eval node (BuildCopDataSource.BuildExecution) + // to be used on eval node (BuildCheckDataSource.BuildExecution) internal void Uninitialize() { _isInitialized = false; diff --git a/src/Build/BuildCop/Infrastructure/BuildCopCentralContext.cs b/src/Build/BuildCheck/Infrastructure/BuildCheckCentralContext.cs similarity index 81% rename from src/Build/BuildCop/Infrastructure/BuildCopCentralContext.cs rename to src/Build/BuildCheck/Infrastructure/BuildCheckCentralContext.cs index 96b125cbca6..55b70993bb5 100644 --- a/src/Build/BuildCop/Infrastructure/BuildCopCentralContext.cs +++ b/src/Build/BuildCheck/Infrastructure/BuildCheckCentralContext.cs @@ -6,18 +6,18 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; /// /// A manager of the runs of the analyzers - deciding based on configuration of what to run and what to postfilter. /// -internal sealed class BuildCopCentralContext +internal sealed class BuildCheckCentralContext { private record CallbackRegistry( - List<(BuildAnalyzerWrapper, Action>)> EvaluatedPropertiesActions, - List<(BuildAnalyzerWrapper, Action>)> ParsedItemsActions) + List<(BuildAnalyzerWrapper, Action>)> EvaluatedPropertiesActions, + List<(BuildAnalyzerWrapper, Action>)> ParsedItemsActions) { public CallbackRegistry() : this([],[]) { } } @@ -30,21 +30,21 @@ public CallbackRegistry() : this([],[]) { } internal bool HasEvaluatedPropertiesActions => _globalCallbacks.EvaluatedPropertiesActions.Any(); internal bool HasParsedItemsActions => _globalCallbacks.ParsedItemsActions.Any(); - internal void RegisterEvaluatedPropertiesAction(BuildAnalyzerWrapper analyzer, Action> evaluatedPropertiesAction) + internal void RegisterEvaluatedPropertiesAction(BuildAnalyzerWrapper analyzer, Action> evaluatedPropertiesAction) // Here we might want to communicate to node that props need to be sent. // (it was being communicated via MSBUILDLOGPROPERTIESANDITEMSAFTEREVALUATION) => RegisterAction(analyzer, evaluatedPropertiesAction, _globalCallbacks.EvaluatedPropertiesActions); - internal void RegisterParsedItemsAction(BuildAnalyzerWrapper analyzer, Action> parsedItemsAction) + internal void RegisterParsedItemsAction(BuildAnalyzerWrapper analyzer, Action> parsedItemsAction) => RegisterAction(analyzer, parsedItemsAction, _globalCallbacks.ParsedItemsActions); private void RegisterAction( BuildAnalyzerWrapper wrappedAnalyzer, - Action> handler, - List<(BuildAnalyzerWrapper, Action>)> handlersRegistry) + Action> handler, + List<(BuildAnalyzerWrapper, Action>)> handlersRegistry) where T : AnalysisData { - void WrappedHandler(BuildCopDataContext context) + void WrappedHandler(BuildCheckDataContext context) { using var _ = wrappedAnalyzer.StartSpan(); handler(context); @@ -65,7 +65,7 @@ internal void DeregisterAnalyzer(BuildAnalyzerWrapper analyzer) internal void RunEvaluatedPropertiesActions( EvaluatedPropertiesAnalysisData evaluatedPropertiesAnalysisData, LoggingContext loggingContext, - Action + Action resultHandler) => RunRegisteredActions(_globalCallbacks.EvaluatedPropertiesActions, evaluatedPropertiesAnalysisData, loggingContext, resultHandler); @@ -73,16 +73,16 @@ internal void RunEvaluatedPropertiesActions( internal void RunParsedItemsActions( ParsedItemsAnalysisData parsedItemsAnalysisData, LoggingContext loggingContext, - Action + Action resultHandler) => RunRegisteredActions(_globalCallbacks.ParsedItemsActions, parsedItemsAnalysisData, loggingContext, resultHandler); private void RunRegisteredActions( - List<(BuildAnalyzerWrapper, Action>)> registeredCallbacks, + List<(BuildAnalyzerWrapper, Action>)> registeredCallbacks, T analysisData, LoggingContext loggingContext, - Action resultHandler) + Action resultHandler) where T : AnalysisData { string projectFullPath = analysisData.ProjectFilePath; @@ -122,7 +122,7 @@ private void RunRegisteredActions( // TODO: if the input data supports that - check the configPerRule[0].EvaluationAnalysisScope - BuildCopDataContext context = new BuildCopDataContext( + BuildCheckDataContext context = new BuildCheckDataContext( analyzerCallback.Item1, loggingContext, configPerRule, diff --git a/src/Build/BuildCop/Infrastructure/BuildCopConfigurationException.cs b/src/Build/BuildCheck/Infrastructure/BuildCheckConfigurationException.cs similarity index 75% rename from src/Build/BuildCop/Infrastructure/BuildCopConfigurationException.cs rename to src/Build/BuildCheck/Infrastructure/BuildCheckConfigurationException.cs index 4580fb03b81..a87f8939229 100644 --- a/src/Build/BuildCop/Infrastructure/BuildCopConfigurationException.cs +++ b/src/Build/BuildCheck/Infrastructure/BuildCheckConfigurationException.cs @@ -7,15 +7,15 @@ using System.Text; using System.Threading.Tasks; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; -internal class BuildCopConfigurationException : Exception +internal class BuildCheckConfigurationException : Exception { /// /// Exception to communicate issues with user specified configuration - unsupported scenarios, malformations, etc. /// This exception usually leads to defuncting the particular analyzer for the rest of the build (even if issue occured with a single project). /// - public BuildCopConfigurationException(string message) : base(message) + public BuildCheckConfigurationException(string message) : base(message) { } } diff --git a/src/Build/BuildCop/Infrastructure/BuildCopConnectorLogger.cs b/src/Build/BuildCheck/Infrastructure/BuildCheckConnectorLogger.cs similarity index 68% rename from src/Build/BuildCop/Infrastructure/BuildCopConnectorLogger.cs rename to src/Build/BuildCheck/Infrastructure/BuildCheckConnectorLogger.cs index d3510e8c2df..b860423748e 100644 --- a/src/Build/BuildCop/Infrastructure/BuildCopConnectorLogger.cs +++ b/src/Build/BuildCheck/Infrastructure/BuildCheckConnectorLogger.cs @@ -6,13 +6,13 @@ using System.Diagnostics; using System.Linq; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.BuildCop.Acquisition; -using Microsoft.Build.BuildCop.Logging; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.BuildCheck.Acquisition; +using Microsoft.Build.BuildCheck.Logging; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Framework; -namespace Microsoft.Build.BuildCop.Infrastructure; -internal sealed class BuildCopConnectorLogger(IBuildAnalysisLoggingContextFactory loggingContextFactory, IBuildCopManager buildCopManager) +namespace Microsoft.Build.BuildCheck.Infrastructure; +internal sealed class BuildCheckConnectorLogger(IBuildAnalysisLoggingContextFactory loggingContextFactory, IBuildCheckManager buildCheckManager) : ILogger { public LoggerVerbosity Verbosity { get; set; } @@ -35,7 +35,7 @@ private void EventSource_AnyEventRaised(object sender, BuildEventArgs e) try { - buildCopManager.ProcessEvaluationFinishedEventArgs( + buildCheckManager.ProcessEvaluationFinishedEventArgs( loggingContextFactory.CreateLoggingContext(e.BuildEventContext!), projectEvaluationFinishedEventArgs); } @@ -46,7 +46,7 @@ private void EventSource_AnyEventRaised(object sender, BuildEventArgs e) throw; } - buildCopManager.EndProjectEvaluation(BuildCopDataSource.EventArgs, e.BuildEventContext!); + buildCheckManager.EndProjectEvaluation(BuildCheckDataSource.EventArgs, e.BuildEventContext!); } else if (e is ProjectEvaluationStartedEventArgs projectEvaluationStartedEventArgs) { @@ -55,26 +55,26 @@ private void EventSource_AnyEventRaised(object sender, BuildEventArgs e) return; } - buildCopManager.StartProjectEvaluation(BuildCopDataSource.EventArgs, e.BuildEventContext!, + buildCheckManager.StartProjectEvaluation(BuildCheckDataSource.EventArgs, e.BuildEventContext!, projectEvaluationStartedEventArgs.ProjectFile!); } else if (e is ProjectStartedEventArgs projectStartedEvent) { - buildCopManager.StartProjectRequest(BuildCopDataSource.EventArgs, e.BuildEventContext!); + buildCheckManager.StartProjectRequest(BuildCheckDataSource.EventArgs, e.BuildEventContext!); } else if (e is ProjectFinishedEventArgs projectFinishedEventArgs) { - buildCopManager.EndProjectRequest(BuildCopDataSource.EventArgs, e.BuildEventContext!); + buildCheckManager.EndProjectRequest(BuildCheckDataSource.EventArgs, e.BuildEventContext!); } - else if (e is BuildCopEventArgs buildCopBuildEventArgs) + else if (e is BuildCheckEventArgs buildCheckBuildEventArgs) { - if (buildCopBuildEventArgs is BuildCopTracingEventArgs tracingEventArgs) + if (buildCheckBuildEventArgs is BuildCheckTracingEventArgs tracingEventArgs) { _stats.Merge(tracingEventArgs.TracingData, (span1, span2) => span1 + span2); } - else if (buildCopBuildEventArgs is BuildCopAcquisitionEventArgs acquisitionEventArgs) + else if (buildCheckBuildEventArgs is BuildCheckAcquisitionEventArgs acquisitionEventArgs) { - buildCopManager.ProcessAnalyzerAcquisition(acquisitionEventArgs.ToAnalyzerAcquisitionData()); + buildCheckManager.ProcessAnalyzerAcquisition(acquisitionEventArgs.ToAnalyzerAcquisitionData()); } } } @@ -83,7 +83,7 @@ private void EventSource_AnyEventRaised(object sender, BuildEventArgs e) private void EventSource_BuildFinished(object sender, BuildFinishedEventArgs e) { - _stats.Merge(buildCopManager.CreateTracingStats(), (span1, span2) => span1 + span2); + _stats.Merge(buildCheckManager.CreateTracingStats(), (span1, span2) => span1 + span2); string msg = string.Join(Environment.NewLine, _stats.Select(a => a.Key + ": " + a.Value)); diff --git a/src/Build/BuildCheck/Infrastructure/BuildCheckContext.cs b/src/Build/BuildCheck/Infrastructure/BuildCheckContext.cs new file mode 100644 index 00000000000..3546a6ab7b8 --- /dev/null +++ b/src/Build/BuildCheck/Infrastructure/BuildCheckContext.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Threading; +using Microsoft.Build.Experimental.BuildCheck; + +namespace Microsoft.Build.BuildCheck.Infrastructure; + +internal sealed class BuildCheckRegistrationContext(BuildAnalyzerWrapper analyzerWrapper, BuildCheckCentralContext buildCheckCentralContext) : IBuildCheckRegistrationContext +{ + private int _evaluatedPropertiesActionCount; + private int _parsedItemsActionCount; + + public void RegisterEvaluatedPropertiesAction(Action> evaluatedPropertiesAction) + { + if (Interlocked.Increment(ref _evaluatedPropertiesActionCount) > 1) + { + throw new BuildCheckConfigurationException( + $"Analyzer '{analyzerWrapper.BuildAnalyzer.FriendlyName}' attempted to call '{nameof(RegisterEvaluatedPropertiesAction)}' multiple times."); + } + + buildCheckCentralContext.RegisterEvaluatedPropertiesAction(analyzerWrapper, evaluatedPropertiesAction); + } + + public void RegisterParsedItemsAction(Action> parsedItemsAction) + { + if (Interlocked.Increment(ref _parsedItemsActionCount) > 1) + { + throw new BuildCheckConfigurationException( + $"Analyzer '{analyzerWrapper.BuildAnalyzer.FriendlyName}' attempted to call '{nameof(RegisterParsedItemsAction)}' multiple times."); + } + + buildCheckCentralContext.RegisterParsedItemsAction(analyzerWrapper, parsedItemsAction); + } +} diff --git a/src/Build/BuildCop/Infrastructure/BuildCopManagerProvider.cs b/src/Build/BuildCheck/Infrastructure/BuildCheckManagerProvider.cs similarity index 79% rename from src/Build/BuildCop/Infrastructure/BuildCopManagerProvider.cs rename to src/Build/BuildCheck/Infrastructure/BuildCheckManagerProvider.cs index 4f476192acd..df5385b08ba 100644 --- a/src/Build/BuildCop/Infrastructure/BuildCopManagerProvider.cs +++ b/src/Build/BuildCheck/Infrastructure/BuildCheckManagerProvider.cs @@ -13,36 +13,36 @@ using Microsoft.Build.BackEnd; using Microsoft.Build.BackEnd.Components.Caching; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.BuildCop.Acquisition; -using Microsoft.Build.BuildCop.Analyzers; -using Microsoft.Build.BuildCop.Logging; +using Microsoft.Build.BuildCheck.Acquisition; +using Microsoft.Build.BuildCheck.Analyzers; +using Microsoft.Build.BuildCheck.Logging; using Microsoft.Build.Collections; using Microsoft.Build.Construction; using Microsoft.Build.Evaluation; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Framework; using Microsoft.Build.Shared; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; internal delegate BuildAnalyzer BuildAnalyzerFactory(); internal delegate BuildAnalyzerWrapper BuildAnalyzerWrapperFactory(ConfigurationContext configurationContext); /// -/// The central manager for the BuildCop - this is the integration point with MSBuild infrastructure. +/// The central manager for the BuildCheck - this is the integration point with MSBuild infrastructure. /// -internal sealed class BuildCopManagerProvider : IBuildCopManagerProvider +internal sealed class BuildCheckManagerProvider : IBuildCheckManagerProvider { private static int s_isInitialized = 0; - private static IBuildCopManager s_globalInstance = new NullBuildCopManager(); - internal static IBuildCopManager GlobalInstance => s_isInitialized != 0 ? s_globalInstance : throw new InvalidOperationException("BuildCopManagerProvider not initialized"); + private static IBuildCheckManager s_globalInstance = new NullBuildCheckManager(); + internal static IBuildCheckManager GlobalInstance => s_isInitialized != 0 ? s_globalInstance : throw new InvalidOperationException("BuildCheckManagerProvider not initialized"); - public IBuildCopManager Instance => GlobalInstance; + public IBuildCheckManager Instance => GlobalInstance; internal static IBuildComponent CreateComponent(BuildComponentType type) { - ErrorUtilities.VerifyThrow(type == BuildComponentType.BuildCop, "Cannot create components of type {0}", type); - return new BuildCopManagerProvider(); + ErrorUtilities.VerifyThrow(type == BuildComponentType.BuildCheck, "Cannot create components of type {0}", type); + return new BuildCheckManagerProvider(); } public void InitializeComponent(IBuildComponentHost host) @@ -55,43 +55,43 @@ public void InitializeComponent(IBuildComponentHost host) return; } - if (host!.BuildParameters.IsBuildCopEnabled) + if (host!.BuildParameters.IsBuildCheckEnabled) { - s_globalInstance = new BuildCopManager(host.LoggingService); + s_globalInstance = new BuildCheckManager(host.LoggingService); } else { - s_globalInstance = new NullBuildCopManager(); + s_globalInstance = new NullBuildCheckManager(); } } public void ShutdownComponent() => GlobalInstance.Shutdown(); - private sealed class BuildCopManager : IBuildCopManager + private sealed class BuildCheckManager : IBuildCheckManager { private readonly TracingReporter _tracingReporter = new TracingReporter(); - private readonly BuildCopCentralContext _buildCopCentralContext = new(); + private readonly BuildCheckCentralContext _buildCheckCentralContext = new(); private readonly ILoggingService _loggingService; private readonly List _analyzersRegistry =[]; - private readonly bool[] _enabledDataSources = new bool[(int)BuildCopDataSource.ValuesCount]; + private readonly bool[] _enabledDataSources = new bool[(int)BuildCheckDataSource.ValuesCount]; private readonly BuildEventsProcessor _buildEventsProcessor; - private readonly BuildCopAcquisitionModule _acquisitionModule = new(); + private readonly BuildCheckAcquisitionModule _acquisitionModule = new(); - private bool IsInProcNode => _enabledDataSources[(int)BuildCopDataSource.EventArgs] && - _enabledDataSources[(int)BuildCopDataSource.BuildExecution]; + private bool IsInProcNode => _enabledDataSources[(int)BuildCheckDataSource.EventArgs] && + _enabledDataSources[(int)BuildCheckDataSource.BuildExecution]; /// /// Notifies the manager that the data source will be used - /// so it should register the built-in analyzers for the source if it hasn't been done yet. /// - /// - public void SetDataSource(BuildCopDataSource buildCopDataSource) + /// + public void SetDataSource(BuildCheckDataSource buildCheckDataSource) { - if (!_enabledDataSources[(int)buildCopDataSource]) + if (!_enabledDataSources[(int)buildCheckDataSource]) { - _enabledDataSources[(int)buildCopDataSource] = true; - RegisterBuiltInAnalyzers(buildCopDataSource); + _enabledDataSources[(int)buildCheckDataSource] = true; + RegisterBuiltInAnalyzers(buildCheckDataSource); } } @@ -100,11 +100,11 @@ public void ProcessAnalyzerAcquisition(AnalyzerAcquisitionData acquisitionData) if (IsInProcNode) { var factory = _acquisitionModule.CreateBuildAnalyzerFactory(acquisitionData); - RegisterCustomAnalyzer(BuildCopDataSource.EventArgs, factory); + RegisterCustomAnalyzer(BuildCheckDataSource.EventArgs, factory); } else { - BuildCopAcquisitionEventArgs eventArgs = acquisitionData.ToBuildEventArgs(); + BuildCheckAcquisitionEventArgs eventArgs = acquisitionData.ToBuildEventArgs(); // TODO: We may want to pass the real context here (from evaluation) eventArgs.BuildEventContext = new BuildEventContext( @@ -118,27 +118,27 @@ public void ProcessAnalyzerAcquisition(AnalyzerAcquisitionData acquisitionData) } } - internal BuildCopManager(ILoggingService loggingService) + internal BuildCheckManager(ILoggingService loggingService) { _loggingService = loggingService; - _buildEventsProcessor = new(_buildCopCentralContext); + _buildEventsProcessor = new(_buildCheckCentralContext); } private static T Construct() where T : new() => new(); private static readonly (string[] ruleIds, bool defaultEnablement, BuildAnalyzerFactory factory)[][] s_builtInFactoriesPerDataSource = [ - // BuildCopDataSource.EventArgs + // BuildCheckDataSource.EventArgs [ ([SharedOutputPathAnalyzer.SupportedRule.Id], SharedOutputPathAnalyzer.SupportedRule.DefaultConfiguration.IsEnabled ?? false, Construct) ], - // BuildCopDataSource.Execution + // BuildCheckDataSource.Execution [] ]; - private void RegisterBuiltInAnalyzers(BuildCopDataSource buildCopDataSource) + private void RegisterBuiltInAnalyzers(BuildCheckDataSource buildCheckDataSource) { _analyzersRegistry.AddRange( - s_builtInFactoriesPerDataSource[(int)buildCopDataSource] + s_builtInFactoriesPerDataSource[(int)buildCheckDataSource] .Select(v => new BuildAnalyzerFactoryContext(v.factory, v.ruleIds, v.defaultEnablement))); } @@ -147,12 +147,12 @@ private void RegisterBuiltInAnalyzers(BuildCopDataSource buildCopDataSource) /// Registeres the custom analyzer, the construction of analyzer is deferred until the first using project is encountered /// internal void RegisterCustomAnalyzer( - BuildCopDataSource buildCopDataSource, + BuildCheckDataSource buildCheckDataSource, BuildAnalyzerFactory factory, string[] ruleIds, bool defaultEnablement) { - if (_enabledDataSources[(int)buildCopDataSource]) + if (_enabledDataSources[(int)buildCheckDataSource]) { _analyzersRegistry.Add(new BuildAnalyzerFactoryContext(factory, ruleIds, defaultEnablement)); } @@ -163,10 +163,10 @@ internal void RegisterCustomAnalyzer( /// Registeres the custom analyzer, the construction of analyzer is needed during registration /// internal void RegisterCustomAnalyzer( - BuildCopDataSource buildCopDataSource, + BuildCheckDataSource buildCheckDataSource, BuildAnalyzerFactory factory) { - if (_enabledDataSources[(int)buildCopDataSource]) + if (_enabledDataSources[(int)buildCheckDataSource]) { var instance = factory(); _analyzersRegistry.Add(new BuildAnalyzerFactoryContext(factory, @@ -210,7 +210,7 @@ private void SetupSingleAnalyzer(BuildAnalyzerFactoryContext analyzerFactoryCont .SequenceEqual(analyzerFactoryContext.RuleIds, StringComparer.CurrentCultureIgnoreCase) ) { - throw new BuildCopConfigurationException( + throw new BuildCheckConfigurationException( $"The analyzer '{analyzer.FriendlyName}' exposes rules '{analyzer.SupportedRules.Select(r => r.Id).ToCsvString()}', but different rules were declared during registration: '{analyzerFactoryContext.RuleIds.ToCsvString()}'"); } @@ -222,7 +222,7 @@ private void SetupSingleAnalyzer(BuildAnalyzerFactoryContext analyzerFactoryCont // Create the wrapper and register to central context wrapper.StartNewProject(projectFullPath, configurations); - var wrappedContext = new BuildCopRegistrationContext(wrapper, _buildCopCentralContext); + var wrappedContext = new BuildCheckRegistrationContext(wrapper, _buildCheckCentralContext); analyzer.RegisterActions(wrappedContext); } else @@ -240,7 +240,7 @@ private void SetupSingleAnalyzer(BuildAnalyzerFactoryContext analyzerFactoryCont if (configurations.GroupBy(c => c.EvaluationAnalysisScope).Count() > 1) { - throw new BuildCopConfigurationException( + throw new BuildCheckConfigurationException( string.Format("All rules for a single analyzer should have the same EvaluationAnalysisScope for a single project (violating rules: [{0}], project: {1})", analyzerFactoryContext.RuleIds.ToCsvString(), projectFullPath)); @@ -261,7 +261,7 @@ private void SetupAnalyzersForNewProject(string projectFullPath, BuildEventConte { SetupSingleAnalyzer(analyzerFactoryContext, projectFullPath, buildEventContext); } - catch (BuildCopConfigurationException e) + catch (BuildCheckConfigurationException e) { _loggingService.LogErrorFromText(buildEventContext, null, null, null, new BuildEventFileInfo(projectFullPath), @@ -274,7 +274,7 @@ private void SetupAnalyzersForNewProject(string projectFullPath, BuildEventConte analyzersToRemove.ForEach(c => _analyzersRegistry.Remove(c)); foreach (var analyzerToRemove in analyzersToRemove.Select(a => a.MaterializedAnalyzer).Where(a => a != null)) { - _buildCopCentralContext.DeregisterAnalyzer(analyzerToRemove!); + _buildCheckCentralContext.DeregisterAnalyzer(analyzerToRemove!); _tracingReporter.AddStats(analyzerToRemove!.BuildAnalyzer.FriendlyName, analyzerToRemove.Elapsed); analyzerToRemove.BuildAnalyzer.Dispose(); } @@ -311,15 +311,15 @@ public void FinalizeProcessing(LoggingContext loggingContext) return; } - BuildCopTracingEventArgs eventArgs = + BuildCheckTracingEventArgs eventArgs = new(CreateTracingStats()) { BuildEventContext = loggingContext.BuildEventContext }; loggingContext.LogBuildEvent(eventArgs); } - public void StartProjectEvaluation(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext, + public void StartProjectEvaluation(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext, string fullPath) { - if (buildCopDataSource == BuildCopDataSource.EventArgs && IsInProcNode) + if (buildCheckDataSource == BuildCheckDataSource.EventArgs && IsInProcNode) { // Skipping this event - as it was already handled by the in-proc node. // This is because in-proc node has the BuildEventArgs source and BuildExecution source @@ -337,15 +337,15 @@ public void StartProjectEvaluation(BuildCopDataSource buildCopDataSource, BuildE */ - public void EndProjectEvaluation(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext) + public void EndProjectEvaluation(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext) { } - public void StartProjectRequest(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext) + public void StartProjectRequest(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext) { } - public void EndProjectRequest(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext) + public void EndProjectRequest(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext) { } diff --git a/src/Build/BuildCop/Infrastructure/BuildEventsProcessor.cs b/src/Build/BuildCheck/Infrastructure/BuildEventsProcessor.cs similarity index 81% rename from src/Build/BuildCop/Infrastructure/BuildEventsProcessor.cs rename to src/Build/BuildCheck/Infrastructure/BuildEventsProcessor.cs index b3299f9624d..723e0430636 100644 --- a/src/Build/BuildCop/Infrastructure/BuildEventsProcessor.cs +++ b/src/Build/BuildCheck/Infrastructure/BuildEventsProcessor.cs @@ -12,21 +12,21 @@ using Microsoft.Build.BackEnd; using Microsoft.Build.BackEnd.Components.Caching; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.BuildCop.Analyzers; -using Microsoft.Build.BuildCop.Logging; +using Microsoft.Build.BuildCheck.Analyzers; +using Microsoft.Build.BuildCheck.Logging; using Microsoft.Build.Collections; using Microsoft.Build.Construction; using Microsoft.Build.Evaluation; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Framework; using Microsoft.Build.Shared; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; -internal class BuildEventsProcessor(BuildCopCentralContext buildCopCentralContext) +internal class BuildEventsProcessor(BuildCheckCentralContext buildCheckCentralContext) { private readonly SimpleProjectRootElementCache _cache = new SimpleProjectRootElementCache(); - private readonly BuildCopCentralContext _buildCopCentralContext = buildCopCentralContext; + private readonly BuildCheckCentralContext _buildCheckCentralContext = buildCheckCentralContext; // This requires MSBUILDLOGPROPERTIESANDITEMSAFTEREVALUATION set to 1 public void ProcessEvaluationFinishedEventArgs( @@ -42,9 +42,9 @@ public void ProcessEvaluationFinishedEventArgs( EvaluatedPropertiesAnalysisData analysisData = new(evaluationFinishedEventArgs.ProjectFile!, propertiesLookup); - _buildCopCentralContext.RunEvaluatedPropertiesActions(analysisData, loggingContext, ReportResult); + _buildCheckCentralContext.RunEvaluatedPropertiesActions(analysisData, loggingContext, ReportResult); - if (_buildCopCentralContext.HasParsedItemsActions) + if (_buildCheckCentralContext.HasParsedItemsActions) { ProjectRootElement xml = ProjectRootElement.OpenProjectOrSolution( evaluationFinishedEventArgs.ProjectFile!, /*unused*/ @@ -53,7 +53,7 @@ public void ProcessEvaluationFinishedEventArgs( ParsedItemsAnalysisData itemsAnalysisData = new(evaluationFinishedEventArgs.ProjectFile!, new ItemsHolder(xml.Items, xml.ItemGroups)); - _buildCopCentralContext.RunParsedItemsActions(itemsAnalysisData, loggingContext, ReportResult); + _buildCheckCentralContext.RunParsedItemsActions(itemsAnalysisData, loggingContext, ReportResult); } } @@ -61,7 +61,7 @@ private static void ReportResult( BuildAnalyzerWrapper analyzerWrapper, LoggingContext loggingContext, BuildAnalyzerConfigurationInternal[] configPerRule, - BuildCopResult result) + BuildCheckResult result) { if (!analyzerWrapper.BuildAnalyzer.SupportedRules.Contains(result.BuildAnalyzerRule)) { diff --git a/src/Build/BuildCop/Infrastructure/ConfigurationProvider.cs b/src/Build/BuildCheck/Infrastructure/ConfigurationProvider.cs similarity index 97% rename from src/Build/BuildCop/Infrastructure/ConfigurationProvider.cs rename to src/Build/BuildCheck/Infrastructure/ConfigurationProvider.cs index 48db5678d98..d77f5c2ce16 100644 --- a/src/Build/BuildCop/Infrastructure/ConfigurationProvider.cs +++ b/src/Build/BuildCheck/Infrastructure/ConfigurationProvider.cs @@ -9,10 +9,10 @@ using System.Text; using System.Text.Json.Serialization; using System.Text.Json; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; using System.Configuration; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; // TODO: https://github.com/dotnet/msbuild/issues/9628 @@ -90,7 +90,7 @@ public static CustomConfigurationData GetCustomConfiguration(string projectFullP /// /// /// - /// If CustomConfigurationData differs in a build for a same ruleId + /// If CustomConfigurationData differs in a build for a same ruleId /// public static void CheckCustomConfigurationDataValidity(string projectFullPath, string ruleId) { diff --git a/src/Build/BuildCop/Infrastructure/CustomConfigurationData.cs b/src/Build/BuildCheck/Infrastructure/CustomConfigurationData.cs similarity index 97% rename from src/Build/BuildCop/Infrastructure/CustomConfigurationData.cs rename to src/Build/BuildCheck/Infrastructure/CustomConfigurationData.cs index f6ecf0b91cf..d200d48ee66 100644 --- a/src/Build/BuildCop/Infrastructure/CustomConfigurationData.cs +++ b/src/Build/BuildCheck/Infrastructure/CustomConfigurationData.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// Holder for the key-value pairs of unstructured data from .editorconfig file, diff --git a/src/Build/BuildCop/Infrastructure/IBuildCopManager.cs b/src/Build/BuildCheck/Infrastructure/IBuildCheckManager.cs similarity index 58% rename from src/Build/BuildCop/Infrastructure/IBuildCopManager.cs rename to src/Build/BuildCheck/Infrastructure/IBuildCheckManager.cs index 2082c82f286..703d0b6bfa9 100644 --- a/src/Build/BuildCop/Infrastructure/IBuildCopManager.cs +++ b/src/Build/BuildCheck/Infrastructure/IBuildCheckManager.cs @@ -8,13 +8,13 @@ using System.Threading.Tasks; using Microsoft.Build.BackEnd; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.BuildCop.Acquisition; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Acquisition; +using Microsoft.Build.BuildCheck.Infrastructure; using Microsoft.Build.Framework; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; -internal enum BuildCopDataSource +internal enum BuildCheckDataSource { EventArgs, BuildExecution, @@ -23,15 +23,15 @@ internal enum BuildCopDataSource } /// -/// The central manager for the BuildCop - this is the integration point with MSBuild infrastructure. +/// The central manager for the BuildCheck - this is the integration point with MSBuild infrastructure. /// -internal interface IBuildCopManager +internal interface IBuildCheckManager { void ProcessEvaluationFinishedEventArgs( IBuildAnalysisLoggingContext buildAnalysisContext, ProjectEvaluationFinishedEventArgs projectEvaluationFinishedEventArgs); - void SetDataSource(BuildCopDataSource buildCopDataSource); + void SetDataSource(BuildCheckDataSource buildCheckDataSource); void ProcessAnalyzerAcquisition(AnalyzerAcquisitionData acquisitionData); @@ -44,10 +44,10 @@ void ProcessEvaluationFinishedEventArgs( // to manager about what analyzers need to be materialized and configuration fetched. // No unloading of analyzers is yet considered - once loaded it stays for whole build. - void StartProjectEvaluation(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext, string fullPath); - void EndProjectEvaluation(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext); - void StartProjectRequest(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext); - void EndProjectRequest(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext); + void StartProjectEvaluation(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext, string fullPath); + void EndProjectEvaluation(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext); + void StartProjectRequest(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext); + void EndProjectRequest(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext); void Shutdown(); } diff --git a/src/Build/BuildCop/Infrastructure/IBuildCopManagerProvider.cs b/src/Build/BuildCheck/Infrastructure/IBuildCheckManagerProvider.cs similarity index 58% rename from src/Build/BuildCop/Infrastructure/IBuildCopManagerProvider.cs rename to src/Build/BuildCheck/Infrastructure/IBuildCheckManagerProvider.cs index a58bc5ae321..6b8bdea6080 100644 --- a/src/Build/BuildCop/Infrastructure/IBuildCopManagerProvider.cs +++ b/src/Build/BuildCheck/Infrastructure/IBuildCheckManagerProvider.cs @@ -7,11 +7,11 @@ using System.Text; using System.Threading.Tasks; using Microsoft.Build.BackEnd; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; -internal interface IBuildCopManagerProvider : IBuildComponent +internal interface IBuildCheckManagerProvider : IBuildComponent { - IBuildCopManager Instance { get; } + IBuildCheckManager Instance { get; } } diff --git a/src/Build/BuildCop/Infrastructure/NullBuildCopManager.cs b/src/Build/BuildCheck/Infrastructure/NullBuildCheckManager.cs similarity index 50% rename from src/Build/BuildCop/Infrastructure/NullBuildCopManager.cs rename to src/Build/BuildCheck/Infrastructure/NullBuildCheckManager.cs index bfcf6e7be2c..d6685345652 100644 --- a/src/Build/BuildCop/Infrastructure/NullBuildCopManager.cs +++ b/src/Build/BuildCheck/Infrastructure/NullBuildCheckManager.cs @@ -7,13 +7,13 @@ using System.Text; using System.Threading.Tasks; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.BuildCop.Acquisition; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.BuildCheck.Acquisition; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Framework; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; -internal class NullBuildCopManager : IBuildCopManager +internal class NullBuildCheckManager : IBuildCheckManager { public void Shutdown() { } @@ -21,7 +21,7 @@ public void ProcessEvaluationFinishedEventArgs(IBuildAnalysisLoggingContext buil ProjectEvaluationFinishedEventArgs projectEvaluationFinishedEventArgs) { } - public void SetDataSource(BuildCopDataSource buildCopDataSource) { } + public void SetDataSource(BuildCheckDataSource buildCheckDataSource) { } public void ProcessAnalyzerAcquisition(AnalyzerAcquisitionData acquisitionData) { } public Dictionary CreateTracingStats() => throw new NotImplementedException(); @@ -29,22 +29,22 @@ public void ProcessAnalyzerAcquisition(AnalyzerAcquisitionData acquisitionData) public void FinalizeProcessing(LoggingContext loggingContext) { } - public void StartProjectEvaluation(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext, + public void StartProjectEvaluation(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext, string fullPath) { } - public void EndProjectEvaluation(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext) + public void EndProjectEvaluation(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext) { } - public void StartProjectRequest(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext) + public void StartProjectRequest(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext) { } - public void EndProjectRequest(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext) + public void EndProjectRequest(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext) { } - public void YieldProject(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext) + public void YieldProject(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext) { } - public void ResumeProject(BuildCopDataSource buildCopDataSource, BuildEventContext buildEventContext) + public void ResumeProject(BuildCheckDataSource buildCheckDataSource, BuildEventContext buildEventContext) { } } diff --git a/src/Build/BuildCop/Infrastructure/NullBuildCopManagerProvider.cs b/src/Build/BuildCheck/Infrastructure/NullBuildCheckManagerProvider.cs similarity index 61% rename from src/Build/BuildCop/Infrastructure/NullBuildCopManagerProvider.cs rename to src/Build/BuildCheck/Infrastructure/NullBuildCheckManagerProvider.cs index 3aaf8708347..c6dcbd84f8d 100644 --- a/src/Build/BuildCop/Infrastructure/NullBuildCopManagerProvider.cs +++ b/src/Build/BuildCheck/Infrastructure/NullBuildCheckManagerProvider.cs @@ -7,13 +7,13 @@ using System.Text; using System.Threading.Tasks; using Microsoft.Build.BackEnd; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; -internal class NullBuildCopManagerProvider : IBuildCopManagerProvider +internal class NullBuildCheckManagerProvider : IBuildCheckManagerProvider { - public IBuildCopManager Instance { get; } = new NullBuildCopManager(); + public IBuildCheckManager Instance { get; } = new NullBuildCheckManager(); public void InitializeComponent(IBuildComponentHost host) { } public void ShutdownComponent() { } diff --git a/src/Build/BuildCop/Infrastructure/TracingReporter.cs b/src/Build/BuildCheck/Infrastructure/TracingReporter.cs similarity index 93% rename from src/Build/BuildCop/Infrastructure/TracingReporter.cs rename to src/Build/BuildCheck/Infrastructure/TracingReporter.cs index 434ac882d7c..614a1711a77 100644 --- a/src/Build/BuildCop/Infrastructure/TracingReporter.cs +++ b/src/Build/BuildCheck/Infrastructure/TracingReporter.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace Microsoft.Build.BuildCop.Infrastructure; +namespace Microsoft.Build.BuildCheck.Infrastructure; internal class TracingReporter { diff --git a/src/Build/BuildCop/Logging/AnalyzerLoggingContext.cs b/src/Build/BuildCheck/Logging/AnalyzerLoggingContext.cs similarity index 86% rename from src/Build/BuildCop/Logging/AnalyzerLoggingContext.cs rename to src/Build/BuildCheck/Logging/AnalyzerLoggingContext.cs index ddf799afded..7d1d5badc92 100644 --- a/src/Build/BuildCop/Logging/AnalyzerLoggingContext.cs +++ b/src/Build/BuildCheck/Logging/AnalyzerLoggingContext.cs @@ -2,10 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Framework; -namespace Microsoft.Build.BuildCop.Logging; +namespace Microsoft.Build.BuildCheck.Logging; internal class AnalyzerLoggingContext : LoggingContext, IBuildAnalysisLoggingContext { diff --git a/src/Build/BuildCop/Logging/AnalyzerLoggingContextFactory.cs b/src/Build/BuildCheck/Logging/AnalyzerLoggingContextFactory.cs similarity index 84% rename from src/Build/BuildCop/Logging/AnalyzerLoggingContextFactory.cs rename to src/Build/BuildCheck/Logging/AnalyzerLoggingContextFactory.cs index 70a8126b7c6..8c437f45174 100644 --- a/src/Build/BuildCop/Logging/AnalyzerLoggingContextFactory.cs +++ b/src/Build/BuildCheck/Logging/AnalyzerLoggingContextFactory.cs @@ -2,10 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; using Microsoft.Build.Framework; -namespace Microsoft.Build.BuildCop.Logging; +namespace Microsoft.Build.BuildCheck.Logging; internal class AnalyzerLoggingContextFactory(ILoggingService loggingService) : IBuildAnalysisLoggingContextFactory { public IBuildAnalysisLoggingContext CreateLoggingContext(BuildEventContext eventContext) => diff --git a/src/Build/BuildCop/Logging/BuildAnalysisLoggingContextExtensions.cs b/src/Build/BuildCheck/Logging/BuildAnalysisLoggingContextExtensions.cs similarity index 84% rename from src/Build/BuildCop/Logging/BuildAnalysisLoggingContextExtensions.cs rename to src/Build/BuildCheck/Logging/BuildAnalysisLoggingContextExtensions.cs index c115c649b55..4951fd7e3c6 100644 --- a/src/Build/BuildCop/Logging/BuildAnalysisLoggingContextExtensions.cs +++ b/src/Build/BuildCheck/Logging/BuildAnalysisLoggingContextExtensions.cs @@ -3,9 +3,9 @@ using System; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; -namespace Microsoft.Build.BuildCop.Logging; +namespace Microsoft.Build.BuildCheck.Logging; internal static class BuildAnalysisLoggingContextExtensions { diff --git a/src/Build/BuildCop/Logging/IBuildAnalysisLoggingContext.cs b/src/Build/BuildCheck/Logging/IBuildAnalysisLoggingContext.cs similarity index 79% rename from src/Build/BuildCop/Logging/IBuildAnalysisLoggingContext.cs rename to src/Build/BuildCheck/Logging/IBuildAnalysisLoggingContext.cs index 79d0ad32876..c7433a14eb9 100644 --- a/src/Build/BuildCop/Logging/IBuildAnalysisLoggingContext.cs +++ b/src/Build/BuildCheck/Logging/IBuildAnalysisLoggingContext.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; public interface IBuildAnalysisLoggingContext { } diff --git a/src/Build/BuildCop/Logging/IBuildAnalysisLoggingContextFactory.cs b/src/Build/BuildCheck/Logging/IBuildAnalysisLoggingContextFactory.cs similarity index 86% rename from src/Build/BuildCop/Logging/IBuildAnalysisLoggingContextFactory.cs rename to src/Build/BuildCheck/Logging/IBuildAnalysisLoggingContextFactory.cs index ea959fa3db9..e239c8dc73d 100644 --- a/src/Build/BuildCop/Logging/IBuildAnalysisLoggingContextFactory.cs +++ b/src/Build/BuildCheck/Logging/IBuildAnalysisLoggingContextFactory.cs @@ -3,7 +3,7 @@ using Microsoft.Build.Framework; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; public interface IBuildAnalysisLoggingContextFactory { diff --git a/src/Build/BuildCop/OM/BuildCopDataContext.cs b/src/Build/BuildCheck/OM/BuildCheckDataContext.cs similarity index 81% rename from src/Build/BuildCop/OM/BuildCopDataContext.cs rename to src/Build/BuildCheck/OM/BuildCheckDataContext.cs index 5549a01f4b9..d9a560c7e60 100644 --- a/src/Build/BuildCop/OM/BuildCopDataContext.cs +++ b/src/Build/BuildCheck/OM/BuildCheckDataContext.cs @@ -7,11 +7,11 @@ using System.Text; using System.Threading.Tasks; using Microsoft.Build.BackEnd.Logging; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.BuildCheck.Infrastructure; using Microsoft.Build.Experimental; using Microsoft.Build.Framework; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// Base for a data passed from infrastructure to build analyzers. @@ -25,18 +25,18 @@ public abstract class AnalysisData(string projectFilePath) public string ProjectFilePath { get; } = projectFilePath; } -public class BuildCopDataContext where T : AnalysisData +public class BuildCheckDataContext where T : AnalysisData { private readonly BuildAnalyzerWrapper _analyzerWrapper; private readonly LoggingContext _loggingContext; private readonly BuildAnalyzerConfigurationInternal[] _configPerRule; - private readonly Action _resultHandler; + private readonly Action _resultHandler; - internal BuildCopDataContext( + internal BuildCheckDataContext( BuildAnalyzerWrapper analyzerWrapper, LoggingContext loggingContext, BuildAnalyzerConfigurationInternal[] configPerRule, - Action resultHandler, + Action resultHandler, T data) { _analyzerWrapper = analyzerWrapper; @@ -50,7 +50,7 @@ internal BuildCopDataContext( /// Method for reporting the result of the build analyzer rule. /// /// - public void ReportResult(BuildCopResult result) + public void ReportResult(BuildCheckResult result) => _resultHandler(_analyzerWrapper, _loggingContext, _configPerRule, result); /// diff --git a/src/Build/BuildCop/OM/EvaluatedPropertiesAnalysisData.cs b/src/Build/BuildCheck/OM/EvaluatedPropertiesAnalysisData.cs similarity index 91% rename from src/Build/BuildCop/OM/EvaluatedPropertiesAnalysisData.cs rename to src/Build/BuildCheck/OM/EvaluatedPropertiesAnalysisData.cs index fda8d3ffdf6..0a31bdf675a 100644 --- a/src/Build/BuildCop/OM/EvaluatedPropertiesAnalysisData.cs +++ b/src/Build/BuildCheck/OM/EvaluatedPropertiesAnalysisData.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using Microsoft.Build.BackEnd.Logging; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; public class EvaluatedPropertiesAnalysisData : AnalysisData { internal EvaluatedPropertiesAnalysisData( diff --git a/src/Build/BuildCop/OM/ParsedItemsAnalysisData.cs b/src/Build/BuildCheck/OM/ParsedItemsAnalysisData.cs similarity index 96% rename from src/Build/BuildCop/OM/ParsedItemsAnalysisData.cs rename to src/Build/BuildCheck/OM/ParsedItemsAnalysisData.cs index 043491ee4f1..62a0e588ae3 100644 --- a/src/Build/BuildCop/OM/ParsedItemsAnalysisData.cs +++ b/src/Build/BuildCheck/OM/ParsedItemsAnalysisData.cs @@ -9,7 +9,7 @@ using Microsoft.Build.BackEnd.Logging; using Microsoft.Build.Construction; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; public static class ItemTypeExtensions { diff --git a/src/Build/BuildCop/Utilities/EnumerableExtensions.cs b/src/Build/BuildCheck/Utilities/EnumerableExtensions.cs similarity index 97% rename from src/Build/BuildCop/Utilities/EnumerableExtensions.cs rename to src/Build/BuildCheck/Utilities/EnumerableExtensions.cs index 70b95b22f51..1a978642eb8 100644 --- a/src/Build/BuildCop/Utilities/EnumerableExtensions.cs +++ b/src/Build/BuildCheck/Utilities/EnumerableExtensions.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; internal static class EnumerableExtensions { diff --git a/src/Build/BuildCop/API/IBuildCopRegistrationContext.cs b/src/Build/BuildCop/API/IBuildCopRegistrationContext.cs deleted file mode 100644 index 4c1b6751ef8..00000000000 --- a/src/Build/BuildCop/API/IBuildCopRegistrationContext.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; - -namespace Microsoft.Build.Experimental.BuildCop; - -public interface IBuildCopRegistrationContext -{ - void RegisterEvaluatedPropertiesAction(Action> evaluatedPropertiesAction); - void RegisterParsedItemsAction(Action> parsedItemsAction); -} diff --git a/src/Build/BuildCop/Infrastructure/BuildCopContext.cs b/src/Build/BuildCop/Infrastructure/BuildCopContext.cs deleted file mode 100644 index 2316d9d601e..00000000000 --- a/src/Build/BuildCop/Infrastructure/BuildCopContext.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Threading; -using Microsoft.Build.Experimental.BuildCop; - -namespace Microsoft.Build.BuildCop.Infrastructure; - -internal sealed class BuildCopRegistrationContext(BuildAnalyzerWrapper analyzerWrapper, BuildCopCentralContext buildCopCentralContext) : IBuildCopRegistrationContext -{ - private int _evaluatedPropertiesActionCount; - private int _parsedItemsActionCount; - - public void RegisterEvaluatedPropertiesAction(Action> evaluatedPropertiesAction) - { - if (Interlocked.Increment(ref _evaluatedPropertiesActionCount) > 1) - { - throw new BuildCopConfigurationException( - $"Analyzer '{analyzerWrapper.BuildAnalyzer.FriendlyName}' attempted to call '{nameof(RegisterEvaluatedPropertiesAction)}' multiple times."); - } - - buildCopCentralContext.RegisterEvaluatedPropertiesAction(analyzerWrapper, evaluatedPropertiesAction); - } - - public void RegisterParsedItemsAction(Action> parsedItemsAction) - { - if (Interlocked.Increment(ref _parsedItemsActionCount) > 1) - { - throw new BuildCopConfigurationException( - $"Analyzer '{analyzerWrapper.BuildAnalyzer.FriendlyName}' attempted to call '{nameof(RegisterParsedItemsAction)}' multiple times."); - } - - buildCopCentralContext.RegisterParsedItemsAction(analyzerWrapper, parsedItemsAction); - } -} diff --git a/src/Build/Microsoft.Build.csproj b/src/Build/Microsoft.Build.csproj index b76f1a0ecf3..2daff2fe714 100644 --- a/src/Build/Microsoft.Build.csproj +++ b/src/Build/Microsoft.Build.csproj @@ -121,7 +121,7 @@ BackEnd\Components\RequestBuilder\IntrinsicTasks\TaskLoggingHelperExtension.cs - BuildCop\Utilities\IsExternalInit.cs + BuildCheck\Utilities\IsExternalInit.cs @@ -156,38 +156,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -195,9 +195,9 @@ - - - + + + diff --git a/src/Framework/BuildCop/BuildCopEventArgs.cs b/src/Framework/BuildCop/BuildCopEventArgs.cs index d7051e2689a..106754be327 100644 --- a/src/Framework/BuildCop/BuildCopEventArgs.cs +++ b/src/Framework/BuildCop/BuildCopEventArgs.cs @@ -10,14 +10,14 @@ using Microsoft.Build.Framework; using Microsoft.Build.Shared; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; -public abstract class BuildCopEventArgs : BuildEventArgs +public abstract class BuildCheckEventArgs : BuildEventArgs { } -public sealed class BuildCopTracingEventArgs(Dictionary tracingData) : BuildCopEventArgs +public sealed class BuildCheckTracingEventArgs(Dictionary tracingData) : BuildCheckEventArgs { - internal BuildCopTracingEventArgs() : this(new Dictionary()) + internal BuildCheckTracingEventArgs() : this(new Dictionary()) { } public Dictionary TracingData { get; private set; } = tracingData; @@ -50,9 +50,9 @@ internal override void CreateFromStream(BinaryReader reader, int version) } } -public sealed class BuildCopAcquisitionEventArgs(string acquisitionData) : BuildCopEventArgs +public sealed class BuildCheckAcquisitionEventArgs(string acquisitionData) : BuildCheckEventArgs { - internal BuildCopAcquisitionEventArgs() : this(string.Empty) + internal BuildCheckAcquisitionEventArgs() : this(string.Empty) { } public string AcquisitionData { get; private set; } = acquisitionData; @@ -71,14 +71,14 @@ internal override void CreateFromStream(BinaryReader reader, int version) AcquisitionData = reader.ReadString(); } } -public sealed class BuildCopResultWarning : BuildWarningEventArgs +public sealed class BuildCheckResultWarning : BuildWarningEventArgs { - public BuildCopResultWarning(IBuildCopResult result) + public BuildCheckResultWarning(IBuildCheckResult result) { this.Message = result.FormatMessage(); } - internal BuildCopResultWarning() { } + internal BuildCheckResultWarning() { } internal override void WriteToStream(BinaryWriter writer) { @@ -97,14 +97,14 @@ internal override void CreateFromStream(BinaryReader reader, int version) public override string? Message { get; protected set; } } -public sealed class BuildCopResultError : BuildErrorEventArgs +public sealed class BuildCheckResultError : BuildErrorEventArgs { - public BuildCopResultError(IBuildCopResult result) + public BuildCheckResultError(IBuildCheckResult result) { this.Message = result.FormatMessage(); } - internal BuildCopResultError() { } + internal BuildCheckResultError() { } internal override void WriteToStream(BinaryWriter writer) { @@ -123,14 +123,14 @@ internal override void CreateFromStream(BinaryReader reader, int version) public override string? Message { get; protected set; } } -public sealed class BuildCopResultMessage : BuildMessageEventArgs +public sealed class BuildCheckResultMessage : BuildMessageEventArgs { - public BuildCopResultMessage(IBuildCopResult result) + public BuildCheckResultMessage(IBuildCheckResult result) { this.Message = result.FormatMessage(); } - internal BuildCopResultMessage() { } + internal BuildCheckResultMessage() { } internal override void WriteToStream(BinaryWriter writer) { diff --git a/src/Framework/BuildCop/IBuildCopResult.cs b/src/Framework/BuildCop/IBuildCopResult.cs index c47e03c5365..e6f04518305 100644 --- a/src/Framework/BuildCop/IBuildCopResult.cs +++ b/src/Framework/BuildCop/IBuildCopResult.cs @@ -7,12 +7,12 @@ using System.Text; using System.Threading.Tasks; -namespace Microsoft.Build.Experimental.BuildCop; +namespace Microsoft.Build.Experimental.BuildCheck; /// /// Holder for the reported result of a build cop rule. /// -public interface IBuildCopResult +public interface IBuildCheckResult { /// /// Optional location of the finding (in near future we might need to support multiple locations). diff --git a/src/Framework/Features.cs b/src/Framework/Features.cs index acb4a05dba6..48d3f785a63 100644 --- a/src/Framework/Features.cs +++ b/src/Framework/Features.cs @@ -42,7 +42,7 @@ public static class Features { private static readonly Dictionary _featureStatusMap = new Dictionary { - { "BuildCop.Beta", FeatureStatus.Preview }, + { "BuildCheck.Beta", FeatureStatus.Preview }, { "EvaluationContext_SharedSDKCachePolicy", FeatureStatus.Available }, // EvaluationContext supports the SharingPolicy.SharedSDKCache flag. // Add more features here. }; diff --git a/src/Framework/IEventSource.cs b/src/Framework/IEventSource.cs index 18be5acb2c0..146142b488a 100644 --- a/src/Framework/IEventSource.cs +++ b/src/Framework/IEventSource.cs @@ -3,7 +3,7 @@ #nullable disable -using Microsoft.Build.Experimental.BuildCop; +using Microsoft.Build.Experimental.BuildCheck; namespace Microsoft.Build.Framework { @@ -78,9 +78,9 @@ namespace Microsoft.Build.Framework public delegate void AnyEventHandler(object sender, BuildEventArgs e); /// - /// Type of handler for BuildCopEventRaised events + /// Type of handler for BuildCheckEventRaised events /// - public delegate void BuildCopEventHandler(object sender, BuildCopEventArgs e); + public delegate void BuildCheckEventHandler(object sender, BuildCheckEventArgs e); /// /// This interface defines the events raised by the build engine. diff --git a/src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs b/src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs index df213d22248..6ffae8dfb52 100644 --- a/src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs +++ b/src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs @@ -1185,7 +1185,7 @@ public void InvalidToolsVersionErrors() graphBuildOptions: null, lowPriority: false, question: false, - isBuildCopEnabled: false, + isBuildCheckEnabled: false, inputResultsCaches: null, outputResultsCache: null, saveProjectResult: false, diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index 930eb956e41..ac9c638e003 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -717,7 +717,7 @@ public static ExitType Execute( string[] inputResultsCaches = null; string outputResultsCache = null; bool question = false; - bool isBuildCopEnabled = false; + bool isBuildCheckEnabled = false; string[] getProperty = Array.Empty(); string[] getItem = Array.Empty(); string[] getTargetResult = Array.Empty(); @@ -765,7 +765,7 @@ public static ExitType Execute( #endif ref lowPriority, ref question, - ref isBuildCopEnabled, + ref isBuildCheckEnabled, ref getProperty, ref getItem, ref getTargetResult, @@ -868,7 +868,7 @@ public static ExitType Execute( graphBuildOptions, lowPriority, question, - isBuildCopEnabled, + isBuildCheckEnabled, inputResultsCaches, outputResultsCache, saveProjectResult: outputPropertiesItemsOrTargetResults, @@ -1255,7 +1255,7 @@ internal static bool BuildProject( GraphBuildOptions graphBuildOptions, bool lowPriority, bool question, - bool isBuildCopEnabled, + bool isBuildCheckEnabled, string[] inputResultsCaches, string outputResultsCache, bool saveProjectResult, @@ -1457,7 +1457,7 @@ internal static bool BuildProject( parameters.InputResultsCacheFiles = inputResultsCaches; parameters.OutputResultsCacheFile = outputResultsCache; parameters.Question = question; - parameters.IsBuildCopEnabled = isBuildCopEnabled; + parameters.IsBuildCheckEnabled = isBuildCheckEnabled; #if FEATURE_REPORTFILEACCESSES parameters.ReportFileAccesses = reportFileAccesses; #endif @@ -2432,7 +2432,7 @@ private static bool ProcessCommandLineSwitches( #endif ref bool lowPriority, ref bool question, - ref bool isBuildCopEnabled, + ref bool isBuildCheckEnabled, ref string[] getProperty, ref string[] getItem, ref string[] getTargetResult, @@ -2563,7 +2563,7 @@ private static bool ProcessCommandLineSwitches( #endif ref lowPriority, ref question, - ref isBuildCopEnabled, + ref isBuildCheckEnabled, ref getProperty, ref getItem, ref getTargetResult, @@ -2649,7 +2649,7 @@ private static bool ProcessCommandLineSwitches( question = commandLineSwitches.IsParameterizedSwitchSet(CommandLineSwitches.ParameterizedSwitch.Question); - isBuildCopEnabled = IsBuildCopEnabled(commandLineSwitches); + isBuildCheckEnabled = IsBuildCheckEnabled(commandLineSwitches); inputResultsCaches = ProcessInputResultsCaches(commandLineSwitches); @@ -2723,7 +2723,7 @@ private static bool ProcessCommandLineSwitches( return invokeBuild; } - private static bool IsBuildCopEnabled(CommandLineSwitches commandLineSwitches) + private static bool IsBuildCheckEnabled(CommandLineSwitches commandLineSwitches) { // todo: opt-in behavior: https://github.com/dotnet/msbuild/issues/9723 bool isAnalysisEnabled = commandLineSwitches.IsParameterizedSwitchSet(CommandLineSwitches.ParameterizedSwitch.Analyze); diff --git a/src/Shared/LogMessagePacketBase.cs b/src/Shared/LogMessagePacketBase.cs index 5c5748939c9..3a90c6a33ae 100644 --- a/src/Shared/LogMessagePacketBase.cs +++ b/src/Shared/LogMessagePacketBase.cs @@ -10,8 +10,8 @@ using Microsoft.Build.Framework; #if !TASKHOST -using Microsoft.Build.Experimental.BuildCop; -using Microsoft.Build.BuildCop.Infrastructure; +using Microsoft.Build.Experimental.BuildCheck; +using Microsoft.Build.BuildCheck.Infrastructure; #endif #if !TASKHOST && !MSBUILDENTRYPOINTEXE @@ -212,29 +212,29 @@ internal enum LoggingEventType : int ExtendedCriticalBuildMessageEvent = 33, /// - /// Event is + /// Event is /// - BuildCopMessageEvent = 34, + BuildCheckMessageEvent = 34, /// - /// Event is + /// Event is /// - BuildCopWarningEvent = 35, + BuildCheckWarningEvent = 35, /// - /// Event is + /// Event is /// - BuildCopErrorEvent = 36, + BuildCheckErrorEvent = 36, /// - /// Event is + /// Event is /// - BuildCopTracingEvent = 37, + BuildCheckTracingEvent = 37, /// - /// Event is + /// Event is /// - BuildCopAcquisitionEvent = 38, + BuildCheckAcquisitionEvent = 38, } #endregion @@ -640,11 +640,11 @@ private BuildEventArgs GetBuildEventArgFromId() LoggingEventType.PropertyInitialValueSet => new PropertyInitialValueSetEventArgs(), LoggingEventType.PropertyReassignment => new PropertyReassignmentEventArgs(), LoggingEventType.UninitializedPropertyRead => new UninitializedPropertyReadEventArgs(), - LoggingEventType.BuildCopMessageEvent => new BuildCopResultMessage(), - LoggingEventType.BuildCopWarningEvent => new BuildCopResultWarning(), - LoggingEventType.BuildCopErrorEvent => new BuildCopResultError(), - LoggingEventType.BuildCopAcquisitionEvent => new BuildCopAcquisitionEventArgs(), - LoggingEventType.BuildCopTracingEvent => new BuildCopTracingEventArgs(), + LoggingEventType.BuildCheckMessageEvent => new BuildCheckResultMessage(), + LoggingEventType.BuildCheckWarningEvent => new BuildCheckResultWarning(), + LoggingEventType.BuildCheckErrorEvent => new BuildCheckResultError(), + LoggingEventType.BuildCheckAcquisitionEvent => new BuildCheckAcquisitionEventArgs(), + LoggingEventType.BuildCheckTracingEvent => new BuildCheckTracingEventArgs(), #endif _ => throw new InternalErrorException("Should not get to the default of GetBuildEventArgFromId ID: " + _eventType) }; @@ -756,25 +756,25 @@ private LoggingEventType GetLoggingEventId(BuildEventArgs eventArg) { return LoggingEventType.UninitializedPropertyRead; } - else if (eventType == typeof(BuildCopResultMessage)) + else if (eventType == typeof(BuildCheckResultMessage)) { - return LoggingEventType.BuildCopMessageEvent; + return LoggingEventType.BuildCheckMessageEvent; } - else if (eventType == typeof(BuildCopResultWarning)) + else if (eventType == typeof(BuildCheckResultWarning)) { - return LoggingEventType.BuildCopWarningEvent; + return LoggingEventType.BuildCheckWarningEvent; } - else if (eventType == typeof(BuildCopResultError)) + else if (eventType == typeof(BuildCheckResultError)) { - return LoggingEventType.BuildCopErrorEvent; + return LoggingEventType.BuildCheckErrorEvent; } - else if (eventType == typeof(BuildCopAcquisitionEventArgs)) + else if (eventType == typeof(BuildCheckAcquisitionEventArgs)) { - return LoggingEventType.BuildCopAcquisitionEvent; + return LoggingEventType.BuildCheckAcquisitionEvent; } - else if (eventType == typeof(BuildCopTracingEventArgs)) + else if (eventType == typeof(BuildCheckTracingEventArgs)) { - return LoggingEventType.BuildCopTracingEvent; + return LoggingEventType.BuildCheckTracingEvent; } #endif else if (eventType == typeof(TargetStartedEventArgs))