Files
ShrinkShared.CodeGen/Editor/ShrinkRegistryILPostProcessor.cs
T
cneicy c669ee5956
Publish UPM package / publish (push) Successful in 2s
Publish NuGet packages / publish (push) Successful in 2m44s
feat(codegen): validate contracts and unify Unity weaving
2026-09-29 10:14:49 +08:00

24 lines
1005 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",
"ShrinkEventBus.Runtime", "ShrinkNetwork.Integration.EventBus");
public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly) =>
WillProcess(compiledAssembly)
? UnityShrinkCodeGenAdapter.Process(compiledAssembly, "ShrinkShared.CodeGen")
: new ILPostProcessResult(compiledAssembly.InMemoryAssembly, new List<DiagnosticMessage>());
}
}