From 4a351d9b44a26fc8f627c3b129e93ab81bad0b82 Mon Sep 17 00:00:00 2001 From: codex Date: Mon, 10 Aug 2026 11:02:22 +0300 Subject: [PATCH] fix: accept schema-2 composite module manifests --- .../P_Rec_Annot/bundle/P_Rec_Annot.bundle/PackageContents.xml | 2 +- .../src/PRecAnnot.Plant3D2026/CompositeModuleManifest.cs | 4 +++- Plant3D2026/P_Rec_Annot/tools/Build-Bundle.ps1 | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Plant3D2026/P_Rec_Annot/bundle/P_Rec_Annot.bundle/PackageContents.xml b/Plant3D2026/P_Rec_Annot/bundle/P_Rec_Annot.bundle/PackageContents.xml index bf38ff2..cee1a9e 100644 --- a/Plant3D2026/P_Rec_Annot/bundle/P_Rec_Annot.bundle/PackageContents.xml +++ b/Plant3D2026/P_Rec_Annot/bundle/P_Rec_Annot.bundle/PackageContents.xml @@ -1,5 +1,5 @@ - + diff --git a/Plant3D2026/P_Rec_Annot/src/PRecAnnot.Plant3D2026/CompositeModuleManifest.cs b/Plant3D2026/P_Rec_Annot/src/PRecAnnot.Plant3D2026/CompositeModuleManifest.cs index 4d16cea..f960f4a 100644 --- a/Plant3D2026/P_Rec_Annot/src/PRecAnnot.Plant3D2026/CompositeModuleManifest.cs +++ b/Plant3D2026/P_Rec_Annot/src/PRecAnnot.Plant3D2026/CompositeModuleManifest.cs @@ -14,7 +14,9 @@ internal static class CompositeModuleManifest var path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(assemblyPath)!, "..", "module-manifest.json")); if (!File.Exists(path)) throw new InvalidOperationException("COMPOSITE_MODULE_MANIFEST_MISSING"); var manifest = JsonSerializer.Deserialize(File.ReadAllText(path), new JsonSerializerOptions { PropertyNameCaseInsensitive = true }) ?? throw new InvalidOperationException("COMPOSITE_MODULE_MANIFEST_INVALID"); - if (manifest.SchemaVersion != 1 || !string.Equals(manifest.Package, "P_Rec_Annot", StringComparison.Ordinal) || manifest.Modules.Count == 0) throw new InvalidOperationException("COMPOSITE_MODULE_MANIFEST_INVALID"); + // Schema 2 adds the package-wide file manifest while preserving the + // required composite module/assembly contract consumed here. + if (manifest.SchemaVersion is not (1 or 2) || !string.Equals(manifest.Package, "P_Rec_Annot", StringComparison.Ordinal) || manifest.Modules.Count == 0) throw new InvalidOperationException("COMPOSITE_MODULE_MANIFEST_INVALID"); foreach (var item in manifest.Assemblies.Where(value => value.Required)) { var file = Path.Combine(Path.GetDirectoryName(assemblyPath)!, item.Name); diff --git a/Plant3D2026/P_Rec_Annot/tools/Build-Bundle.ps1 b/Plant3D2026/P_Rec_Annot/tools/Build-Bundle.ps1 index e7aa63e..a6d3f86 100644 --- a/Plant3D2026/P_Rec_Annot/tools/Build-Bundle.ps1 +++ b/Plant3D2026/P_Rec_Annot/tools/Build-Bundle.ps1 @@ -16,6 +16,6 @@ $moduleManifestPath=Join-Path $bundleRoot 'Contents\module-manifest.json' $files=Get-ChildItem $bundleRoot -Recurse -File | Where-Object { $_.FullName -ne $moduleManifestPath } | Sort-Object FullName | ForEach-Object { [ordered]@{ relativePath=$_.FullName.Substring($bundleRoot.Length + 1).Replace('\','/'); sha256=(Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant(); required=$true } } -$manifest=[ordered]@{ schemaVersion=2; package='P_Rec_Annot'; version='0.2.9'; modules=$modules; assemblies=$assemblies; files=$files } +$manifest=[ordered]@{ schemaVersion=2; package='P_Rec_Annot'; version='0.2.10'; modules=$modules; assemblies=$assemblies; files=$files } $manifest | ConvertTo-Json -Depth 5 | Set-Content (Join-Path $bundleRoot 'Contents\module-manifest.json') -Encoding utf8 Write-Host 'Bundle assembly build completed; deployment is intentionally not performed.'