feat(headless): share immutable process content

This commit is contained in:
Erik 2026-07-27 08:37:24 +02:00
parent fbdb58a962
commit 12b500d383
11 changed files with 617 additions and 18 deletions

View file

@ -1,4 +1,5 @@
using DatReaderWriter;
using AcDream.Content;
using System.Reflection;
using System.Text.RegularExpressions;
@ -7,14 +8,20 @@ namespace AcDream.App.Tests;
public sealed class RuntimeDatAccessArchitectureTests
{
[Fact]
public void ProductionAppTypes_DoNotStoreOrAcceptRawDatCollection()
public void ProductionTypes_KeepRawDatCollectionInsideContentOwnerSeam()
{
Type rawType = typeof(DatReaderWriter.DatCollection);
Type ownerType = typeof(RuntimeDatCollection);
Type[] appTypes = typeof(RuntimeDatCollectionFactory).Assembly.GetTypes();
Type adapterType = typeof(DatCollectionAdapter);
Type[] productionTypes =
typeof(AcDream.App.Rendering.GameWindow).Assembly.GetTypes()
.Concat(typeof(RuntimeDatCollectionFactory).Assembly.GetTypes())
.Distinct()
.ToArray();
var violations = new List<string>();
foreach (Type type in appTypes.Where(type => type != ownerType))
foreach (Type type in productionTypes.Where(
type => type != ownerType && type != adapterType))
{
foreach (FieldInfo field in type.GetFields(
BindingFlags.Instance | BindingFlags.Static |
@ -54,9 +61,16 @@ public sealed class RuntimeDatAccessArchitectureTests
{
string root = FindRepoRoot();
string appRoot = Path.Combine(root, "src", "AcDream.App");
string contentRoot = Path.Combine(root, "src", "AcDream.Content");
string ownerPath = Path.GetFullPath(
Path.Combine(appRoot, "RuntimeDatCollectionFactory.cs"));
string[] sources = Directory.GetFiles(appRoot, "*.cs", SearchOption.AllDirectories);
Path.Combine(contentRoot, "RuntimeDatCollectionFactory.cs"));
string[] sources = Directory
.GetFiles(appRoot, "*.cs", SearchOption.AllDirectories)
.Concat(Directory.GetFiles(
contentRoot,
"*.cs",
SearchOption.AllDirectories))
.ToArray();
string[] rawCreates = FindMatchingFiles(sources, @"\bnew\s+DatCollection\s*\(");
string[] adapterCreates = FindMatchingFiles(sources, @"\bnew\s+DatCollectionAdapter\s*\(");