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

Always respect warning-as-error properties #10892

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/Build/BackEnd/Components/Logging/LoggingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1666,8 +1666,8 @@ private void RouteBuildEvent(object loggingEvent)
}
}

// If this is BuildCheck-ed build - add the warnings promotability/demotability to the service
if (buildEventArgs is ProjectStartedEventArgs projectStartedEvent && this._componentHost.BuildParameters.IsBuildCheckEnabled)
// Respect warning-promotion properties from the remote project
if (buildEventArgs is ProjectStartedEventArgs projectStartedEvent)
JanKrivanek marked this conversation as resolved.
Show resolved Hide resolved
{
AddWarningsAsErrors(projectStartedEvent.BuildEventContext, projectStartedEvent.WarningsAsErrors);
AddWarningsAsMessages(projectStartedEvent.BuildEventContext, projectStartedEvent.WarningsAsMessages);
Expand Down
6 changes: 3 additions & 3 deletions src/Build/BackEnd/Components/RequestBuilder/RequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ private async Task<BuildResult> BuildProject()
{
ErrorUtilities.VerifyThrow(_targetBuilder != null, "Target builder is null");

// We consider this the entrypoint for the project build for purposes of BuildCheck processing
// We consider this the entrypoint for the project build for purposes of BuildCheck processing
bool isRestoring = _requestEntry.RequestConfiguration.GlobalProperties[MSBuildConstants.MSBuildIsRestoring] is not null;

var buildCheckManager = isRestoring
Expand Down Expand Up @@ -1155,7 +1155,7 @@ private async Task<BuildResult> BuildProject()
_requestEntry.Request.BuildEventContext);
}


try
{
HandleProjectStarted(buildCheckManager);
Expand Down Expand Up @@ -1279,7 +1279,7 @@ private void HandleProjectStarted(IBuildCheckManager buildCheckManager)
BuildEventContext projectBuildEventContext = _projectLoggingContext?.BuildEventContext;

// We can set the warning as errors and messages only after the project logging context has been created (as it creates the new ProjectContextId)
if (buildCheckManager != null && loggingService != null && projectBuildEventContext != null)
if (loggingService != null && projectBuildEventContext != null)
{
args.WarningsAsErrors = loggingService.GetWarningsAsErrors(projectBuildEventContext).ToHashSet(StringComparer.OrdinalIgnoreCase);
args.WarningsAsMessages = loggingService.GetWarningsAsMessages(projectBuildEventContext).ToHashSet(StringComparer.OrdinalIgnoreCase);
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/ProjectStartedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public IEnumerable? Items
}

// Following 3 properties are intended only for internal transfer - to properly communicate the warn as error/msg
// from the worker node, to the main node - that may be producing the buildcheck diagnostics.
// from the worker node, to the main node.
// They are not going to be in a binlog (at least not as of now).

internal ISet<string>? WarningsAsErrors { get; set; }
Expand Down