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