23 lines
925 B
C#
23 lines
925 B
C#
#nullable enable
|
|
|
|
using System.Collections.Generic;
|
|
using Unity.CompilationPipeline.Common.Diagnostics;
|
|
using Unity.CompilationPipeline.Common.ILPostProcessing;
|
|
|
|
namespace ShrinkShared.CodeGen
|
|
{
|
|
public sealed class ShrinkRegistryILPostProcessor : ILPostProcessor
|
|
{
|
|
public override ILPostProcessor GetInstance() => this;
|
|
|
|
public override bool WillProcess(ICompiledAssembly compiledAssembly) =>
|
|
UnityShrinkCodeGenAdapter.ReferencesAny(compiledAssembly,
|
|
"ShrinkCommand.Runtime", "ShrinkNetwork.Runtime", "ShrinkApp.Core.Runtime");
|
|
|
|
public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly) =>
|
|
WillProcess(compiledAssembly)
|
|
? UnityShrinkCodeGenAdapter.Process(compiledAssembly, "ShrinkShared.CodeGen")
|
|
: new ILPostProcessResult(compiledAssembly.InMemoryAssembly, new List<DiagnosticMessage>());
|
|
}
|
|
}
|