Remove runtime catalog legacy lookups
This commit is contained in:
parent
a29794232d
commit
9140f44cf7
6 changed files with 57 additions and 34 deletions
|
|
@ -12,6 +12,7 @@ RequirePackageSerializerBoundary(root);
|
|||
RequireTypedPendingCommitKeys(root);
|
||||
RequireTypedRuntimeFactionKeys(root);
|
||||
RequireTypedGalaxyFactionRelationships(root);
|
||||
RequireRuntimeCatalogKeyOnlyLookups(root);
|
||||
RequireEveRuntimeBootstrap(root);
|
||||
RequireNoRendererLocalConsole(root);
|
||||
RequireNoRendererLocalDebugPanels(root);
|
||||
|
|
@ -699,6 +700,40 @@ static void RequireTypedGalaxyFactionRelationships(string root)
|
|||
}
|
||||
}
|
||||
|
||||
static void RequireRuntimeCatalogKeyOnlyLookups(string root)
|
||||
{
|
||||
var checkedFiles = new[]
|
||||
{
|
||||
Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogSnapshot.cs"),
|
||||
Path.Combine(root, "Aetheria.State.Unity.Smoke", "Program.cs")
|
||||
};
|
||||
|
||||
var forbiddenSymbols = new[]
|
||||
{
|
||||
"_itemsByLegacyId",
|
||||
"_corporationsByLegacyId",
|
||||
"_nameFilesByLegacyId",
|
||||
"FindItemByLegacyId",
|
||||
"FindCorporationByLegacyId",
|
||||
"FindNameFileByLegacyId"
|
||||
};
|
||||
|
||||
var hits = checkedFiles
|
||||
.Where(File.Exists)
|
||||
.SelectMany(path => File.ReadLines(path)
|
||||
.Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line }))
|
||||
.Where(line => forbiddenSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal)))
|
||||
.Select(line => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {line.Line.Trim()}")
|
||||
.ToArray();
|
||||
|
||||
if (hits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Unity runtime catalog snapshot must expose typed-key lookups only; legacy-ID indexes belong to migration boundaries: " +
|
||||
string.Join("; ", hits));
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireEveRuntimeBootstrap(string root)
|
||||
{
|
||||
var bootstrapPath = Path.Combine(
|
||||
|
|
|
|||
Loading…
Reference in a new issue