Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Codegen bugfixes #1294

Merged
merged 5 commits into from
Feb 18, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
dotnet/json output processing
Signed-off-by: Paul Balaji <paulbalaji@improbable.io>
Paul Balaji committed Feb 18, 2020
commit 9e90cbef165baa8ebe346c348e8a39afc46f58d6
40 changes: 24 additions & 16 deletions workers/unity/Packages/io.improbable.gdk.tools/GenerateCode.cs
Original file line number Diff line number Diff line change
@@ -154,8 +154,7 @@ private static void Generate()
var exitCode = RedirectedProcess.Command(Common.DotNetBinary)
.WithArgs("run", "-p", $"\"{CodegenExe}\"")
.RedirectOutputOptions(OutputRedirectBehaviour.None)
.AddOutputProcessing(ProcessDotnetOutput)
.AddOutputProcessing(ProcessCodegenOutput)
.AddOutputProcessing(ProcessCodegenStdOut)
.Run();

var numWarnings = codegenLogCounts[CodegenLogLevel.Warn];
@@ -280,27 +279,36 @@ private static void DisplayGeneralFailure()
"Close");
}

private static void ProcessDotnetOutput(string output)
private static void ProcessCodegenStdOut(string output)
{
var match = dotnetRegex.Match(output);
if (match.Success)
{
switch (match.Groups["type"].Value)
{
case "warning":
Debug.LogWarning(output);
break;
case "error":
Debug.LogError(output);
break;
default:
Debug.Log(output);
break;
}
ProcessDotnetOutput(output, match);
}
else
{
ProcessJsonOutput(output);
}
}

private static void ProcessDotnetOutput(string output, Match match)
{
switch (match.Groups["type"].Value)
{
case "warning":
Debug.LogWarning(output);
break;
case "error":
Debug.LogError(output);
break;
default:
Debug.Log(output);
break;
}
}

private static void ProcessCodegenOutput(string output)
private static void ProcessJsonOutput(string output)
{
try
{