Merge pull request #125 from unoplatform/dev/jela/binlog-failsafe
fix: Failsafe on "Found invalid data while decoding" binlog replay from controller
This commit is contained in:
Коммит
894a8edf73
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace Uno.SourceGeneration.Helpers
|
||||
{
|
||||
|
@ -11,17 +12,26 @@ namespace Uno.SourceGeneration.Helpers
|
|||
/// <summary>
|
||||
/// Replays the provided binlog file in the current build engine
|
||||
/// </summary>
|
||||
public static void Replay(IBuildEngine engine, string filePath)
|
||||
public static void Replay(IBuildEngine engine, string filePath, TaskLoggingHelper log)
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
var replaySource = new Microsoft.Build.Logging.BinaryLogReplayEventSource();
|
||||
try
|
||||
{
|
||||
var replaySource = new Microsoft.Build.Logging.BinaryLogReplayEventSource();
|
||||
|
||||
replaySource.MessageRaised += (s, e) => engine.LogMessageEvent(e);
|
||||
replaySource.WarningRaised += (s, e) => engine.LogWarningEvent(e);
|
||||
replaySource.ErrorRaised += (s, e) => engine.LogErrorEvent(e);
|
||||
replaySource.MessageRaised += (s, e) => engine.LogMessageEvent(e);
|
||||
replaySource.WarningRaised += (s, e) => engine.LogWarningEvent(e);
|
||||
replaySource.ErrorRaised += (s, e) => engine.LogErrorEvent(e);
|
||||
|
||||
replaySource.Replay(filePath);
|
||||
replaySource.Replay(filePath);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
var fileSize = File.Exists(filePath) ? new FileInfo(filePath).Length : -1;
|
||||
|
||||
log.LogWarning($"Failed to replay source generation controller build messages (path:{filePath}, size:{fileSize}) : {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace Uno.SourceGeneratorTasks
|
|||
|
||||
responseTask.Wait(_sharedCompileCts.Token);
|
||||
|
||||
BinaryLoggerReplayHelper.Replay(BuildEngine, binlogFile);
|
||||
BinaryLoggerReplayHelper.Replay(BuildEngine, binlogFile, Log);
|
||||
|
||||
if (responseTask.Result.Type == GenerationResponse.ResponseType.Completed)
|
||||
{
|
||||
|
@ -340,7 +340,7 @@ namespace Uno.SourceGeneratorTasks
|
|||
process.WaitForExit();
|
||||
}
|
||||
|
||||
BinaryLoggerReplayHelper.Replay(BuildEngine, binlogFile);
|
||||
BinaryLoggerReplayHelper.Replay(BuildEngine, binlogFile, Log);
|
||||
|
||||
if (process.ExitCode == 0)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче