Skip to content

Commit cfef12c

Browse files
fix: Resolve an issue where 2019.4 would not properly run ILPP with a clean import (#645)
* Add an dummy ILPP to force 2019.4 to proper compilation order * Turning on this test for 2019.4 * Hack -> Workaround rename Co-authored-by: Matt Walsh <matt.walsh@unity3d.com> Co-authored-by: Matt Walsh <69258106+mattwalsh-unity@users.noreply.github.com>
1 parent 0786f7b commit cfef12c

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

com.unity.multiplayer.mlapi/Editor/CodeGen/ILPostProcessorProgram.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,31 @@
1111

1212
using Assembly = System.Reflection.Assembly;
1313

14+
using ILPPInterface = Unity.CompilationPipeline.Common.ILPostProcessing.ILPostProcessor;
15+
1416
namespace MLAPI.Editor.CodeGen
1517
{
18+
// There is a behaviour difference between 2019.4 and 2020+ codegen
19+
// that essentially does checking on the existence of ILPP vs if a CodeGen assembly
20+
// is present. So in order to make sure ILPP runs properly in 2019.4 from a clean
21+
// import of the project we add this dummy ILPP which forces the callback to made
22+
// and meets the internal ScriptCompilation pipeline requirements
23+
internal sealed class ILPP2019CodegenWorkaround : ILPPInterface
24+
{
25+
public override ILPPInterface GetInstance()
26+
{
27+
return this;
28+
}
29+
30+
public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly)
31+
{
32+
return null;
33+
}
34+
35+
public override bool WillProcess(ICompiledAssembly compiledAssembly) => compiledAssembly.References.Any(filePath => Path.GetFileNameWithoutExtension(filePath) == CodeGenHelpers.RuntimeAssemblyName);
36+
37+
}
38+
1639
internal static class ILPostProcessProgram
1740
{
1841
private static ILPostProcessor[] s_ILPostProcessors { get; set; }
@@ -213,4 +236,4 @@ void WriteAssembly(InMemoryAssembly inMemoryAssembly, string outputPath, string
213236
}
214237
}
215238
}
216-
#endif
239+
#endif

com.unity.multiplayer.mlapi/Tests/Runtime/RpcQueueTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class RpcQueueTests
2727
[UnityTest]
2828
public IEnumerator RpcQueueUnitTest()
2929
{
30-
#if UNITY_2020_2_OR_NEWER // Disabling this test on 2019.4 due to ILPP issues on Yamato CI/CD runs
3130
var networkManagerObject = new GameObject(nameof(NetworkManager));
3231
m_NetworkManager = networkManagerObject.AddComponent<NetworkManager>();
3332
var unetTransport = networkManagerObject.AddComponent<UNetTransport>();
@@ -102,9 +101,6 @@ public IEnumerator RpcQueueUnitTest()
102101

103102
GameObject.DestroyImmediate(playerObject);
104103
GameObject.DestroyImmediate(networkManagerObject);
105-
#else
106-
yield return null;
107-
#endif
108104
}
109105
}
110106
}

0 commit comments

Comments
 (0)