mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
ifdef out CompilationFinishedHook
This commit is contained in:
parent
6d8fc523a7
commit
3ea5eb5d8d
@ -1,3 +1,6 @@
|
||||
// for Unity 2020+ we use ILPostProcessor.
|
||||
// only automatically invoke it for older versions.
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -27,10 +30,6 @@ public static class CompilationFinishedHook
|
||||
// controls weather Weaver errors are reported direct to the Unity console (tests enable this)
|
||||
public static bool UnityLogEnabled = true;
|
||||
|
||||
// for Unity 2020+ we use ILPostProcessor.
|
||||
// only automatically invoke it for older versions.
|
||||
// for newer versions, we still call CompilationFinished manually in tests.
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
[InitializeOnLoadMethod]
|
||||
public static void OnInitializeOnLoad()
|
||||
{
|
||||
@ -64,7 +63,6 @@ public static void WeaveExistingAssemblies()
|
||||
UnityEditorInternal.InternalEditorUtility.RequestScriptReload();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static Assembly FindCompilationPipelineAssembly(string assemblyName) =>
|
||||
CompilationPipeline.GetAssemblies().First(assembly => assembly.name == assemblyName);
|
||||
@ -188,3 +186,4 @@ static bool WeaveFromFile(string assemblyPath, string[] dependencies)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1,6 +1,7 @@
|
||||
// logger for compilation finished hook.
|
||||
// where we need a callback and Debug.Log.
|
||||
//#if !UNITY_2020_1_OR_NEWER <- still need it for tests in 2020+
|
||||
// for Unity 2020+ we use ILPostProcessor.
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
using Mono.CecilX;
|
||||
using UnityEngine;
|
||||
|
||||
@ -27,4 +28,4 @@ public void Error(string message, MemberReference mr)
|
||||
}
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
#endif
|
||||
|
@ -115,14 +115,13 @@ public static void Build()
|
||||
}
|
||||
|
||||
#if UNITY_2020_1_OR_NEWER && UNITY_EDITOR_OSX
|
||||
// on mac, AssemblyBuilder doesn't invoke ILPostProcessor after
|
||||
// building. it does on windows though.
|
||||
//
|
||||
// we need to weave manually here in 2020+.
|
||||
// -> we have the assemblyPath
|
||||
// -> simply use the from-file Assembly + Resolver from before.
|
||||
// TODO invoke ILPostProcessor for consistency with Windows tests
|
||||
CompilationFinishedHook.OnCompilationFinished(assemblyPath, compilerMessages);
|
||||
// CompilationFinishedHook weaves test pre Unity 2020.
|
||||
// after Unity 2020, ILPostProcessor is invoked by AssemblyBuilder.
|
||||
// on mac, it is not invoked automatically.
|
||||
// need to do it manually until it's fixed by Unity.
|
||||
|
||||
// TODO invoke ILPostProcessor manually
|
||||
// TODO save to file manually, so tests using the DLLs use the waved ones.
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -45,8 +45,8 @@ protected void BuildAndWeaveTestAssembly(string className, string testName)
|
||||
[OneTimeSetUp]
|
||||
public void FixtureSetup()
|
||||
{
|
||||
#if UNITY_2020_1_OR_NEWER && UNITY_EDITOR_OSX
|
||||
// we still use CompilationFinishedHook to run tests in 2020+ on mac
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
// CompilationFinishedHook is used for tests pre-2020 ILPostProcessor
|
||||
CompilationFinishedHook.UnityLogEnabled = false;
|
||||
CompilationFinishedHook.OnWeaverError += HandleWeaverError;
|
||||
CompilationFinishedHook.OnWeaverWarning += HandleWeaverWarning;
|
||||
@ -56,8 +56,8 @@ public void FixtureSetup()
|
||||
[OneTimeTearDown]
|
||||
public void FixtureCleanup()
|
||||
{
|
||||
#if UNITY_2020_1_OR_NEWER && UNITY_EDITOR_OSX
|
||||
// we still use CompilationFinishedHook to run tests in 2020+ on mac
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
// CompilationFinishedHook is used for tests pre-2020 ILPostProcessor
|
||||
CompilationFinishedHook.OnWeaverError -= HandleWeaverError;
|
||||
CompilationFinishedHook.OnWeaverWarning -= HandleWeaverWarning;
|
||||
CompilationFinishedHook.UnityLogEnabled = true;
|
||||
|
Loading…
Reference in New Issue
Block a user