Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzers prototype proposal #9735

Merged
merged 44 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a59fe1e
Initial demonstration version
JanKrivanek Feb 12, 2024
628394d
Make analyzer test use bootstrap properly (#9733)
JanKrivanek Feb 13, 2024
59ab931
Hook analyzers stats stub
JanKrivanek Feb 13, 2024
92e3795
Fix unit tests by explicitly opting into analysis
JanKrivanek Feb 14, 2024
33c4d2e
Disable build acceleration for MSBuild.Bootstrap
ladipro Feb 15, 2024
b37e495
Make EndToEndTests disposable
ladipro Feb 15, 2024
2db509f
Support running Analyzers.UnitTests from stage1
ladipro Feb 15, 2024
4cdd903
Fix MSBuild.dll casing
ladipro Feb 15, 2024
05450bb
Don't run netfx Analyzer.UnitTests in Windows Core builds
ladipro Feb 16, 2024
7e12ef0
Fix Analyzers.UnitTests on Mac
ladipro Feb 16, 2024
fdda2cd
Renaming changes
JanKrivanek Feb 16, 2024
72749c4
Renaming for clarity (#9754)
JanKrivanek Feb 16, 2024
9314121
Removing unnecessary types
JanKrivanek Feb 20, 2024
886c483
Code move
JanKrivanek Feb 20, 2024
60e01a7
Adjust namespaces
JanKrivanek Feb 20, 2024
b474fa1
Simplify TestEnvironments in EndToEndTests
ladipro Feb 21, 2024
ac76b77
Support for per-project configuration, Acquisition mounting, etc
JanKrivanek Feb 28, 2024
0467261
Add more comments
JanKrivanek Feb 28, 2024
5f9d941
Grace handle double initialization attempts
JanKrivanek Feb 29, 2024
40dd6e0
Fix tests
JanKrivanek Feb 29, 2024
bddef4c
Troubleshoot test, comment
JanKrivanek Feb 29, 2024
296faa9
Reflect PR comments
JanKrivanek Mar 1, 2024
f873eda
Fix build
JanKrivanek Mar 1, 2024
3db5e97
Fix build - proper multitargeting on core builds
JanKrivanek Mar 5, 2024
6021771
Adjust API naming and exposure
JanKrivanek Mar 12, 2024
72f2d51
Merge branch 'main' into exp/build-analyzers
JanKrivanek Mar 18, 2024
178907f
Add forgotten acquisition data sending
JanKrivanek Mar 18, 2024
e178918
Renaming BuildCop to BuildCheck (#9893)
maridematte Mar 19, 2024
0892e86
Renamed a few files missed (#9900)
maridematte Mar 21, 2024
31a2a0e
Add template for custom analyzers (#9789)
YuliiaKovalova Mar 25, 2024
d710e00
Merge branch 'main' into exp/build-analyzers
JanKrivanek Mar 25, 2024
5fab936
Run tests against just-built bootstrap environment
ladipro Apr 3, 2024
9b5b925
Reflecting PR comments
JanKrivanek Apr 4, 2024
d97a611
Add test without analysis
JanKrivanek Apr 4, 2024
e18f00f
Rename tests project
JanKrivanek Apr 4, 2024
368cb08
Force case renaming
JanKrivanek Apr 4, 2024
7025f3a
Simplify GlobalInstance initialization
JanKrivanek Apr 5, 2024
aeb4107
Remove multiple registrations checking
JanKrivanek Apr 5, 2024
01510e2
Reflect on PR feedback
JanKrivanek Apr 5, 2024
1d7c4c6
Apply suggestions from code review
JanKrivanek Apr 5, 2024
25b5f75
Reflect on PR comments
JanKrivanek Apr 5, 2024
aaaafcc
Update src/Build/BuildCheck/API/BuildAnalyzerRule.cs
JanKrivanek Apr 10, 2024
cf29add
Reflect PR comments
JanKrivanek Apr 10, 2024
402f490
Merge branch 'exp/build-analyzers' of https://github.com/dotnet/msbui…
JanKrivanek Apr 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions MSBuild.sln
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSBuild.VSSetup.Arm64", "sr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Build.UnitTests.Shared", "src\UnitTests.Shared\Microsoft.Build.UnitTests.Shared.csproj", "{52A0B9C1-23B7-4CCC-B3FC-BDBA1C619E2A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Build.BuildCheck.UnitTests", "src\BuildCheck.UnitTests\Microsoft.Build.BuildCheck.UnitTests.csproj", "{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -864,6 +866,30 @@ Global
{52A0B9C1-23B7-4CCC-B3FC-BDBA1C619E2A}.Release|x64.Build.0 = Release|x64
{52A0B9C1-23B7-4CCC-B3FC-BDBA1C619E2A}.Release|x86.ActiveCfg = Release|Any CPU
{52A0B9C1-23B7-4CCC-B3FC-BDBA1C619E2A}.Release|x86.Build.0 = Release|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Debug|ARM64.ActiveCfg = Debug|arm64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Debug|ARM64.Build.0 = Debug|arm64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Debug|x64.ActiveCfg = Debug|x64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Debug|x64.Build.0 = Debug|x64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Debug|x86.ActiveCfg = Debug|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Debug|x86.Build.0 = Debug|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.MachineIndependent|Any CPU.ActiveCfg = MachineIndependent|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.MachineIndependent|Any CPU.Build.0 = MachineIndependent|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.MachineIndependent|ARM64.ActiveCfg = MachineIndependent|arm64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.MachineIndependent|ARM64.Build.0 = MachineIndependent|arm64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.MachineIndependent|x64.ActiveCfg = MachineIndependent|x64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.MachineIndependent|x64.Build.0 = MachineIndependent|x64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.MachineIndependent|x86.ActiveCfg = MachineIndependent|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.MachineIndependent|x86.Build.0 = MachineIndependent|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Release|Any CPU.Build.0 = Release|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Release|ARM64.ActiveCfg = Release|arm64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Release|ARM64.Build.0 = Release|arm64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Release|x64.ActiveCfg = Release|x64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Release|x64.Build.0 = Release|x64
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Release|x86.ActiveCfg = Release|Any CPU
{434CC6DB-1E66-4FB1-A66C-D5BBE99F0ED8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
21 changes: 21 additions & 0 deletions eng/BootStrapMsBuild.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project>

<!--
Construct a location of MSBuild bootstrap folder - to be used for deployment and for tests
relying on bootstrapped MSBuild
-->

<PropertyGroup>
<BootstrapDestination>$(ArtifactsBinDir)bootstrap\</BootstrapDestination>
<BootstrapDestination Condition="'$(Platform)' == 'x64' or '$(Platform)' == 'arm64'">$(BootstrapDestination)$(Platform)\</BootstrapDestination>
<BootstrapDestination>$(BootstrapDestination)$(TargetFramework.ToLowerInvariant())\MSBuild\</BootstrapDestination>
</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
<BootstrapBinaryDestination>$(BootstrapDestination)$(TargetMSBuildToolsVersion)\Bin</BootstrapBinaryDestination>
</PropertyGroup>

<PropertyGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<BootstrapBinaryDestination>$(BootstrapDestination)</BootstrapBinaryDestination>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
-->

<PropertyGroup>
<BootstrapDestination>$(ArtifactsBinDir)bootstrap\</BootstrapDestination>
<BootstrapDestination Condition="'$(Platform)' == 'x64' or '$(Platform)' == 'arm64'">$(BootstrapDestination)$(Platform)\</BootstrapDestination>
<BootstrapDestination>$(BootstrapDestination)$(TargetFramework.ToLowerInvariant())\MSBuild\</BootstrapDestination>

<BootstrapDependsOn Condition="$(TargetFramework.StartsWith('net4'))">BootstrapFull</BootstrapDependsOn>
<BootstrapDependsOn Condition="!$(TargetFramework.StartsWith('net4'))">BootstrapNetCore</BootstrapDependsOn>

<!-- Needed to ensure that RuntimeTargetsCopyLocalItems is populated for full framework -->
<DisableRuntimeTargets>false</DisableRuntimeTargets>

<!-- Disable build acceleration for this non-standard project. The Bootstrap target must run after any of the dependencies changes. -->
<AccelerateBuildsInVisualStudio>false</AccelerateBuildsInVisualStudio>
</PropertyGroup>

<Target Name="Bootstrap" DependsOnTargets="$(BootstrapDependsOn)"
Expand Down
5 changes: 2 additions & 3 deletions eng/cibuild_bootstrapped_msbuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,12 @@ try {

# When using bootstrapped MSBuild:
# - Turn off node reuse (so that bootstrapped MSBuild processes don't stay running and lock files)
# - Do run tests
# - Don't try to create a bootstrap deployment
# - Create bootstrap environment as it's required when also running tests
if ($onlyDocChanged) {
& $PSScriptRoot\Common\Build.ps1 -restore -build -ci /p:CreateBootstrap=false /nr:false @properties
}
else {
& $PSScriptRoot\Common\Build.ps1 -restore -build -test -ci /p:CreateBootstrap=false /nr:false @properties
& $PSScriptRoot\Common\Build.ps1 -restore -build -test -ci /p:CreateBootstrap=true /nr:false @properties
}

exit $lastExitCode
Expand Down
5 changes: 2 additions & 3 deletions eng/cibuild_bootstrapped_msbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,10 @@ export DOTNET_HOST_PATH="$_InitializeDotNetCli/dotnet"

# When using bootstrapped MSBuild:
# - Turn off node reuse (so that bootstrapped MSBuild processes don't stay running and lock files)
# - Do run tests
# - Don't try to create a bootstrap deployment
# - Create bootstrap environment as it's required when also running tests
if [ $onlyDocChanged = 0 ]
then
. "$ScriptRoot/common/build.sh" --restore --build --test --ci --nodereuse false --configuration $configuration /p:CreateBootstrap=false $properties $extra_properties
. "$ScriptRoot/common/build.sh" --restore --build --test --ci --nodereuse false --configuration $configuration /p:CreateBootstrap=true $properties $extra_properties

else
. "$ScriptRoot/common/build.sh" --restore --build --ci --nodereuse false --configuration $configuration /p:CreateBootstrap=false $properties $extra_properties
Expand Down
7 changes: 7 additions & 0 deletions src/Build.UnitTests/BackEnd/MockHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Build.BackEnd;
using Microsoft.Build.BackEnd.Logging;
using Microsoft.Build.BackEnd.SdkResolution;
using Microsoft.Build.BuildCheck.Infrastructure;
using Microsoft.Build.Engine.UnitTests.BackEnd;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Execution;
Expand Down Expand Up @@ -61,6 +62,8 @@ internal sealed class MockHost : MockLoggingService, IBuildComponentHost, IBuild

private ISdkResolverService _sdkResolverService;

private IBuildCheckManagerProvider _buildCheckManagerProvider;

#region SystemParameterFields

#endregion;
Expand Down Expand Up @@ -126,6 +129,9 @@ public MockHost(BuildParameters buildParameters, ConfigCache overrideConfigCache

_sdkResolverService = new MockSdkResolverService();
((IBuildComponent)_sdkResolverService).InitializeComponent(this);

_buildCheckManagerProvider = new NullBuildCheckManagerProvider();
((IBuildComponent)_buildCheckManagerProvider).InitializeComponent(this);
}

/// <summary>
Expand Down Expand Up @@ -194,6 +200,7 @@ public IBuildComponent GetComponent(BuildComponentType type)
BuildComponentType.ResultsCache => (IBuildComponent)_resultsCache,
BuildComponentType.RequestBuilder => (IBuildComponent)_requestBuilder,
BuildComponentType.SdkResolverService => (IBuildComponent)_sdkResolverService,
BuildComponentType.BuildCheckManagerProvider => (IBuildComponent)_buildCheckManagerProvider,
_ => throw new ArgumentException("Unexpected type " + type),
};
}
Expand Down
1 change: 1 addition & 0 deletions src/Build/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#endif
[assembly: InternalsVisibleTo("Microsoft.Build.Framework.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")]
[assembly: InternalsVisibleTo("Microsoft.Build.Engine.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")]
[assembly: InternalsVisibleTo("Microsoft.Build.BuildCheck.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")]
[assembly: InternalsVisibleTo("Microsoft.Build.UnitTests.Shared, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")]
[assembly: InternalsVisibleTo("Microsoft.Build.Conversion.Core, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.Build.Conversion.Unittest, PublicKey=002400000480000094000000060200000024000052534131000400000100010015c01ae1f50e8cc09ba9eac9147cf8fd9fce2cfe9f8dce4f7301c4132ca9fb50ce8cbf1df4dc18dd4d210e4345c744ecb3365ed327efdbc52603faa5e21daa11234c8c4a73e51f03bf192544581ebe107adee3a34928e39d04e524a9ce729d5090bfd7dad9d10c722c0def9ccc08ff0a03790e48bcd1f9b6c476063e1966a1c4")]
Expand Down
22 changes: 21 additions & 1 deletion src/Build/BackEnd/BuildManager/BuildManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
using Microsoft.Build.BackEnd;
using Microsoft.Build.BackEnd.Logging;
using Microsoft.Build.BackEnd.SdkResolution;
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.BuildCheck;
using Microsoft.Build.Experimental.ProjectCache;
using Microsoft.Build.FileAccesses;
using Microsoft.Build.Framework;
Expand Down Expand Up @@ -2952,7 +2955,12 @@ private void OnProjectStarted(object sender, ProjectStartedEventArgs e)
/// <summary>
/// Creates a logging service around the specified set of loggers.
/// </summary>
private ILoggingService CreateLoggingService(IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> forwardingLoggers, ISet<string> warningsAsErrors, ISet<string> warningsNotAsErrors, ISet<string> warningsAsMessages)
private ILoggingService CreateLoggingService(
IEnumerable<ILogger> loggers,
IEnumerable<ForwardingLoggerRecord> forwardingLoggers,
ISet<string> warningsAsErrors,
ISet<string> warningsNotAsErrors,
ISet<string> warningsAsMessages)
{
Debug.Assert(Monitor.IsEntered(_syncLock));

Expand All @@ -2976,6 +2984,18 @@ private ILoggingService CreateLoggingService(IEnumerable<ILogger> loggers, IEnum
loggingService.WarningsNotAsErrors = warningsNotAsErrors;
loggingService.WarningsAsMessages = warningsAsMessages;

if (_buildParameters.IsBuildCheckEnabled)
{
var buildCheckManagerProvider =
((IBuildComponentHost)this).GetComponent(BuildComponentType.BuildCheckManagerProvider) as IBuildCheckManagerProvider;
buildCheckManagerProvider!.Instance.SetDataSource(BuildCheckDataSource.EventArgs);

loggers = (loggers ?? Enumerable.Empty<ILogger>()).Concat(new[]
{
new BuildCheckConnectorLogger(new AnalyzerLoggingContextFactory(loggingService), buildCheckManagerProvider.Instance)
});
}

try
{
if (loggers != null)
Expand Down
15 changes: 15 additions & 0 deletions src/Build/BackEnd/BuildManager/BuildParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
using Microsoft.Build.BackEnd;
using Microsoft.Build.Collections;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Experimental;
using Microsoft.Build.Experimental.BuildCheck;
using Microsoft.Build.Experimental.ProjectCache;
using Microsoft.Build.Framework;
using Microsoft.Build.Graph;
Expand Down Expand Up @@ -207,6 +209,8 @@ public class BuildParameters : ITranslatable

private bool _question;

private bool _isBuildCheckEnabled;

/// <summary>
/// The settings used to load the project under build
/// </summary>
Expand Down Expand Up @@ -309,6 +313,7 @@ internal BuildParameters(BuildParameters other, bool resetEnvironment = false)
DiscardBuildResults = other.DiscardBuildResults;
LowPriority = other.LowPriority;
Question = other.Question;
IsBuildCheckEnabled = other.IsBuildCheckEnabled;
ProjectCacheDescriptor = other.ProjectCacheDescriptor;
}

Expand Down Expand Up @@ -834,6 +839,15 @@ public bool Question
set => _question = value;
}

/// <summary>
/// Gets or sets an indication of build analysis enablement.
/// </summary>
public bool IsBuildCheckEnabled
{
get => _isBuildCheckEnabled;
set => _isBuildCheckEnabled = value;
}

/// <summary>
/// Gets or sets the project cache description to use for all <see cref="BuildSubmission"/> or <see cref="GraphBuildSubmission"/>
/// in addition to any potential project caches described in each project.
Expand Down Expand Up @@ -898,6 +912,7 @@ void ITranslatable.Translate(ITranslator translator)
translator.TranslateEnum(ref _projectLoadSettings, (int)_projectLoadSettings);
translator.Translate(ref _interactive);
translator.Translate(ref _question);
translator.Translate(ref _isBuildCheckEnabled);
translator.TranslateEnum(ref _projectIsolationMode, (int)_projectIsolationMode);
translator.Translate(ref _reportFileAccesses);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using Microsoft.Build.BackEnd.Components.Caching;
using Microsoft.Build.BackEnd.SdkResolution;
using Microsoft.Build.BuildCheck.Infrastructure;
using Microsoft.Build.FileAccesses;
using Microsoft.Build.Shared;

Expand Down Expand Up @@ -76,6 +77,8 @@ public void RegisterDefaultFactories()
// NodeEndpoint,
_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.BuildCheckManagerProvider] = new BuildComponentEntry(BuildComponentType.BuildCheckManagerProvider, 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Threading;
using System.Threading.Tasks.Dataflow;
using Microsoft.Build.BackEnd.Logging;
using Microsoft.Build.BuildCheck.Infrastructure;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework;
using Microsoft.Build.Shared;
Expand Down Expand Up @@ -281,6 +282,9 @@ public void CleanupForBuild()
TraceEngine("CFB: Rethrowing shutdown exceptions");
throw new AggregateException(deactivateExceptions);
}

var buildCheckManager = (_componentHost.GetComponent(BuildComponentType.BuildCheckManagerProvider) as IBuildCheckManagerProvider)!.Instance;
buildCheckManager.FinalizeProcessing(_nodeLoggingContext);
},
isLastTask: true);

Expand Down
5 changes: 5 additions & 0 deletions src/Build/BackEnd/Components/IBuildComponentHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ internal enum BuildComponentType
/// The component which launches new MSBuild nodes.
/// </summary>
NodeLauncher,

/// <summary>
/// The Build Analyzer Manager.
/// </summary>
BuildCheckManagerProvider,
}

/// <summary>
Expand Down
Loading
Loading