Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Don't let crossgen warnings become msbuild warnings-as-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nguerrera committed Aug 6, 2018
1 parent d63625c commit 1ec1f61
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion build_projects/dotnet-cli-build/Crossgen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,38 @@ protected override string ToolName

protected override MessageImportance StandardOutputLoggingImportance
{
get { return MessageImportance.High; } // or else the output doesn't get logged by default
// Default is low, but we want to see output at normal verbosity.
get { return MessageImportance.Normal; }
}

protected override MessageImportance StandardErrorLoggingImportance
{
// This turns stderr messages into msbuild errors below.
get { return MessageImportance.High; }
}

protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance)
{
// Crossgen's error/warning formatting is inconsistent and so we do
// not use the "canonical error format" handling of base.
//
// Furthermore, we don't want to log crossgen warnings as msbuild
// warnings because we cannot prevent them and they are only
// occasionally formatted as something that base would recognize as
// a canonically formatted warning anyway.
//
// One thing that is consistent is that crossgne errors go to stderr
// and everything else goes to stdout. Above, we set stderr to high
// importance above, and stdout to normal. So we can use that here
// to distinguish between errors and messages.
if (messageImportance == MessageImportance.High)
{
Log.LogError(singleLine);
}
else
{
Log.LogMessage(messageImportance, singleLine);
}
}

protected override string GenerateFullPathToTool()
Expand Down

0 comments on commit 1ec1f61

Please sign in to comment.