mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix: #2912 ILPostProcessor isn't used before 2020.3 because Unity bugs
This commit is contained in:
parent
0d96636389
commit
8b5534f51f
@ -1,6 +1,6 @@
|
||||
// for Unity 2020+ we use ILPostProcessor.
|
||||
// only automatically invoke it for older versions.
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
#if !UNITY_2020_3_OR_NEWER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// logger for compilation finished hook.
|
||||
// where we need a callback and Debug.Log.
|
||||
// for Unity 2020+ we use ILPostProcessor.
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
#if !UNITY_2020_3_OR_NEWER
|
||||
using Mono.CecilX;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
#if !UNITY_2020_3_OR_NEWER
|
||||
// make sure we weaved successfully when entering play mode.
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
@ -12,7 +12,7 @@
|
||||
// ArraySegment<T> in Mirror.Tests.Dll.
|
||||
//
|
||||
// we need a custom resolver for ILPostProcessor.
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// we keep this in Weaver folder because we can access CompilationPipleine here.
|
||||
// in tests folder we can't, unless we rename to "Unity.*.CodeGen",
|
||||
// but then tests wouldn't be weaved anymore.
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
using System;
|
||||
using System.IO;
|
||||
using Unity.CompilationPipeline.Common.Diagnostics;
|
||||
|
@ -1,5 +1,6 @@
|
||||
// hook via ILPostProcessor from Unity 2020+
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
// hook via ILPostProcessor from Unity 2020.3+
|
||||
// (2020.1 has errors https://github.com/vis2k/Mirror/issues/2912)
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
// Unity.CompilationPipeline reference is only resolved if assembly name is
|
||||
// Unity.*.CodeGen:
|
||||
// https://forum.unity.com/threads/how-does-unity-do-codegen-and-why-cant-i-do-it-myself.853867/#post-5646937
|
||||
|
@ -103,7 +103,7 @@ public static void Build(Action<string> OnWarning, Action<string> OnError)
|
||||
assemblyBuilder.compilerOptions.AllowUnsafeCode = true;
|
||||
}
|
||||
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
// Unity automatically invokes ILPostProcessor after
|
||||
// AssemblyBuilder.Build() (on windows at least. not on mac).
|
||||
// => .buildFinished() below CompilerMessages would already contain
|
||||
@ -134,7 +134,7 @@ public static void Build(Action<string> OnWarning, Action<string> OnError)
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
// on 2018/2019, CompilationFinishedHook weaves after building.
|
||||
// on 2020, ILPostProcessor weaves after building.
|
||||
// on windows, it runs after AssemblyBuilder.Build()
|
||||
|
@ -45,7 +45,7 @@ protected void BuildAndWeaveTestAssembly(string className, string testName)
|
||||
[OneTimeSetUp]
|
||||
public void FixtureSetup()
|
||||
{
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
#if !UNITY_2020_3_OR_NEWER
|
||||
// CompilationFinishedHook is used for tests pre-2020 ILPostProcessor
|
||||
CompilationFinishedHook.UnityLogEnabled = false;
|
||||
CompilationFinishedHook.OnWeaverError += HandleWeaverError;
|
||||
@ -56,7 +56,7 @@ public void FixtureSetup()
|
||||
[OneTimeTearDown]
|
||||
public void FixtureCleanup()
|
||||
{
|
||||
#if !UNITY_2020_1_OR_NEWER
|
||||
#if !UNITY_2020_3_OR_NEWER
|
||||
// CompilationFinishedHook is used for tests pre-2020 ILPostProcessor
|
||||
CompilationFinishedHook.OnWeaverError -= HandleWeaverError;
|
||||
CompilationFinishedHook.OnWeaverWarning -= HandleWeaverWarning;
|
||||
|
Loading…
Reference in New Issue
Block a user