Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,31 @@

using Assembly = System.Reflection.Assembly;

using ILPPInterface = Unity.CompilationPipeline.Common.ILPostProcessing.ILPostProcessor;

namespace MLAPI.Editor.CodeGen
{
// There is a behaviour difference between 2019.4 and 2020+ codegen
Comment thread
mattwalsh-unity marked this conversation as resolved.
// that essentially does checking on the existence of ILPP vs if a CodeGen assembly
// is present. So in order to make sure ILPP runs properly in 2019.4 from a clean
// import of the project we add this dummy ILPP which forces the callback to made
// and meets the internal ScriptCompilation pipeline requirements
internal sealed class HackILPPToMakeThingsWork : ILPPInterface
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend against using the word "Hack" in any method name.

Copy link
Copy Markdown
Contributor

@0xFA11 0xFA11 Mar 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, let me try another name here.

Suggested change
internal sealed class HackILPPToMakeThingsWork : ILPPInterface
internal sealed class DefaultILPP : ILPPInterface

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultILPP would also look nice too!

Copy link
Copy Markdown
Contributor

@seanstolberg-unity seanstolberg-unity Mar 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like DefaultILPP the best

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to go with ILPP2019CodegenWorkaround

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me!

{
public override ILPPInterface GetInstance()
{
return this;
}

public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly)
{
return null;
}

public override bool WillProcess(ICompiledAssembly compiledAssembly) => compiledAssembly.References.Any(filePath => Path.GetFileNameWithoutExtension(filePath) == CodeGenHelpers.RuntimeAssemblyName);

}

internal static class ILPostProcessProgram
{
private static ILPostProcessor[] s_ILPostProcessors { get; set; }
Expand Down
4 changes: 0 additions & 4 deletions com.unity.multiplayer.mlapi/Tests/Runtime/RpcQueueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class RpcQueueTests
[UnityTest]
public IEnumerator RpcQueueUnitTest()
{
#if UNITY_2020_2_OR_NEWER // Disabling this test on 2019.4 due to ILPP issues on Yamato CI/CD runs
var networkManagerObject = new GameObject(nameof(NetworkManager));
m_NetworkManager = networkManagerObject.AddComponent<NetworkManager>();
var unetTransport = networkManagerObject.AddComponent<UNetTransport>();
Expand Down Expand Up @@ -102,9 +101,6 @@ public IEnumerator RpcQueueUnitTest()

GameObject.DestroyImmediate(playerObject);
GameObject.DestroyImmediate(networkManagerObject);
#else
yield return null;
#endif
}
}
}