Skip to content

Commit

Permalink
Add the CompileListener from game-ci to create github annotations of …
Browse files Browse the repository at this point in the history
…errors and warnings
  • Loading branch information
mikeage committed Nov 21, 2023
1 parent 067180a commit 31e65b5
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Assets/Editor/BuildCompileListener.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using UnityEngine;
using UnityEditor;

namespace UnityBuilderAction.Reporting
{
[InitializeOnLoad]
static class CompileListener
{
static CompileListener()
{
if (Application.isBatchMode)
{
Application.logMessageReceived += Application_logMessageReceived;
}
}

private static void Application_logMessageReceived(string condition, string stackTrace, LogType type)
{
string prefix = "";
switch (type)
{
case LogType.Error:
prefix = "error";
break;
case LogType.Warning:
prefix = "warning";
break;
case LogType.Exception:
prefix = "error";
break;
}
Console.WriteLine($"{Environment.NewLine}::{prefix} ::{condition}{Environment.NewLine}{stackTrace}");
}
}
}
11 changes: 11 additions & 0 deletions Assets/Editor/BuildCompileListener.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 31e65b5

Please sign in to comment.