From 523a6c944dced35cd047866005e772269d8dae4f Mon Sep 17 00:00:00 2001 From: vis2k Date: Sat, 28 Aug 2021 18:12:27 +0800 Subject: [PATCH] use WeaverTests error handling functions --- Assets/Mirror/Tests/Editor/Weaver/WeaverAssembler.cs | 7 ++++--- Assets/Mirror/Tests/Editor/Weaver/WeaverTests.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Assets/Mirror/Tests/Editor/Weaver/WeaverAssembler.cs b/Assets/Mirror/Tests/Editor/Weaver/WeaverAssembler.cs index 606776438..fd6d4b240 100644 --- a/Assets/Mirror/Tests/Editor/Weaver/WeaverAssembler.cs +++ b/Assets/Mirror/Tests/Editor/Weaver/WeaverAssembler.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -92,7 +93,7 @@ public static void Clear() DeleteOutputOnClear = false; } - public static void Build() + public static void Build(Action OnWarning, Action OnError) { AssemblyBuilder assemblyBuilder = new AssemblyBuilder(Path.Combine(OutputDirectory, OutputFile), SourceFiles.ToArray()) { @@ -154,11 +155,11 @@ public static void Build() { if (message.DiagnosticType == DiagnosticType.Warning) { - Debug.LogWarning(message.MessageData); + OnWarning(message.MessageData); } else if (message.DiagnosticType == DiagnosticType.Error) { - Debug.LogError(message.MessageData); + OnError(message.MessageData); } } // TODO need to feed them to weaverWarnings/weaverErrors diff --git a/Assets/Mirror/Tests/Editor/Weaver/WeaverTests.cs b/Assets/Mirror/Tests/Editor/Weaver/WeaverTests.cs index a5d467b74..347ea859c 100644 --- a/Assets/Mirror/Tests/Editor/Weaver/WeaverTests.cs +++ b/Assets/Mirror/Tests/Editor/Weaver/WeaverTests.cs @@ -32,7 +32,7 @@ protected void BuildAndWeaveTestAssembly(string className, string testName) string testSourceDirectory = className + "~"; WeaverAssembler.OutputFile = Path.Combine(testSourceDirectory, testName + ".dll"); WeaverAssembler.AddSourceFiles(new string[] { Path.Combine(testSourceDirectory, testName + ".cs") }); - WeaverAssembler.Build(); + WeaverAssembler.Build(HandleWeaverWarning, HandleWeaverError); Assert.That(WeaverAssembler.CompilerErrors, Is.False); foreach (string error in weaverErrors)