feat(core): add PluginLoader with collectible ALC

This commit is contained in:
Erik 2026-04-10 09:51:16 +02:00
parent 9dfbc05052
commit a7f0732026
8 changed files with 226 additions and 0 deletions

View file

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<!-- Private=false + ExcludeAssets=runtime is CRITICAL: prevents the fixture
from copying AcDream.Plugin.Abstractions.dll next to itself, which
would cause type-identity mismatch when the ALC loads the fixture
and the host already has the abstractions loaded. -->
<ProjectReference Include="..\..\src\AcDream.Plugin.Abstractions\AcDream.Plugin.Abstractions.csproj">
<Private>false</Private>
<ExcludeAssets>runtime</ExcludeAssets>
</ProjectReference>
</ItemGroup>
</Project>

View file

@ -0,0 +1,20 @@
using AcDream.Plugin.Abstractions;
namespace AcDream.Core.Tests.Fixtures.HelloPlugin;
public sealed class HelloPlugin : IAcDreamPlugin
{
public int InitializeCount { get; private set; }
public int EnableCount { get; private set; }
public int DisableCount { get; private set; }
public IPluginHost? ReceivedHost { get; private set; }
public void Initialize(IPluginHost host)
{
ReceivedHost = host;
InitializeCount++;
}
public void Enable() => EnableCount++;
public void Disable() => DisableCount++;
}