feat: add Godot C# compatibility and shared codegen weaving
Validate ShrinkSDK Workspace / unity (push) Failing after 3m18s
Validate ShrinkSDK Workspace / unity (push) Failing after 3m18s
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ShrinkCommand;
|
||||
using ShrinkEventBus;
|
||||
using ShrinkNetwork;
|
||||
using ShrinkSDK.Runtime;
|
||||
|
||||
var assembly = typeof(Program).Assembly;
|
||||
var marker = assembly.GetCustomAttributes(typeof(ShrinkCodeGenWovenAttribute), false)
|
||||
.Cast<ShrinkCodeGenWovenAttribute>().SingleOrDefault()
|
||||
?? throw new InvalidOperationException("buildTransitive CodeGen did not run.");
|
||||
using var binding = EventBus.Attach(new NuGetSubscriber());
|
||||
EventBus.Post(new NuGetEvent());
|
||||
if (NuGetSubscriber.Calls != 1 || NuGetStaticSubscriber.Calls != 1)
|
||||
throw new InvalidOperationException("NuGet EventBus weaving failed.");
|
||||
if (assembly.GetCustomAttributes(typeof(ShrinkCommandStaticRegistryAttribute), false).Length != 1 ||
|
||||
assembly.GetCustomAttributes(typeof(ShrinkNetworkMessageRegistryAttribute), false).Length != 1)
|
||||
throw new InvalidOperationException("NuGet registries are missing.");
|
||||
Console.WriteLine($"PASS NuGet buildTransitive CodeGen {marker.WeaverVersion}");
|
||||
|
||||
public readonly struct NuGetEvent : IShrinkEvent { }
|
||||
|
||||
[ShrinkEventSubscriber]
|
||||
public sealed class NuGetSubscriber
|
||||
{
|
||||
public static int Calls;
|
||||
[ShrinkSubscribe] private void Handle(NuGetEvent value) => Calls++;
|
||||
}
|
||||
|
||||
[ShrinkEventSubscriber]
|
||||
public static class NuGetStaticSubscriber
|
||||
{
|
||||
public static int Calls;
|
||||
[ShrinkSubscribe] private static void Handle(NuGetEvent value) => Calls++;
|
||||
}
|
||||
|
||||
[ShrinkCommandSubscriber]
|
||||
public static class NuGetCommands
|
||||
{
|
||||
[ShrinkCommand("nuget/smoke")] public static void Smoke() { }
|
||||
}
|
||||
|
||||
[ShrinkNetworkMessage(43001, "nuget/smoke")]
|
||||
public sealed class NuGetMessage : IShrinkNetworkMessage { }
|
||||
Reference in New Issue
Block a user