Skip to content

Commit

Permalink
Don't drop the warning/error code and type when overriding by binlog (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ilonatommy authored Nov 7, 2024
1 parent 386669e commit bad7318
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ public BuildTestBase(ProjectProviderBase providerBase, ITestOutputHelper output,
buildRoot.VisitAllChildren<TextNode>(m =>
{
if (m is Message || m is Error || m is Warning)
outputBuilder.AppendLine(m.Title);
{
var context = GetBinlogMessageContext(m);
outputBuilder.AppendLine($"{context}{m.Title}");
}
});

res = new CommandResult(res.StartInfo, res.ExitCode, outputBuilder.ToString());
Expand All @@ -198,6 +201,24 @@ public BuildTestBase(ProjectProviderBase providerBase, ITestOutputHelper output,
return (res, logFilePath);
}

private string GetBinlogMessageContext(TextNode node)
{
var currentNode = node;
while (currentNode != null)
{
if (currentNode is Error error)
{
return $"{error.File}({error.LineNumber},{error.ColumnNumber}): error {error.Code}: ";
}
else if (currentNode is Warning warning)
{
return $"{warning.File}({warning.LineNumber},{warning.ColumnNumber}): warning {warning.Code}: ";
}
currentNode = currentNode.Parent as TextNode;
}
return string.Empty;
}

protected bool IsDotnetWasmFromRuntimePack(BuildArgs buildArgs) =>
!(buildArgs.AOT || (buildArgs.Config == "Release" && IsUsingWorkloads));

Expand Down

0 comments on commit bad7318

Please sign in to comment.