From 4fa80eeee3f2ab20baaa2960918fbbf96019abbe Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 10 Jul 2026 02:42:16 +0100 Subject: [PATCH] Own Unity lifecycle request contracts --- .../eve-runtime-capability.json | 11 ++--- scripts/build-capture-request.ps1 | 43 +++++++++++++++++++ scripts/build-release-request.ps1 | 31 +++++++++++++ 3 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 scripts/build-capture-request.ps1 create mode 100644 scripts/build-release-request.ps1 diff --git a/packages/org.gamecult.eve.unity-scene/eve-runtime-capability.json b/packages/org.gamecult.eve.unity-scene/eve-runtime-capability.json index fb41ac1..4f4842d 100644 --- a/packages/org.gamecult.eve.unity-scene/eve-runtime-capability.json +++ b/packages/org.gamecult.eve.unity-scene/eve-runtime-capability.json @@ -120,8 +120,8 @@ "tagPattern": "eveunity-scene-v{version}", "artifactKind": "upm-package", "requestSchema": "gamecult.eve.runtime_release_request.v1", - "requestBuilder": "tools/eveunity/eveunity-release-contract.mjs", - "artifactBuilder": "tools/eveunity/eveunity-release-artifact.mjs", + "requestBuilder": "scripts/build-release-request.ps1", + "artifactBuilder": "scripts/pack.ps1", "artifactPattern": "artifacts/eveunity-scene-release/{version}/org.gamecult.eve.unity-scene-{version}.tgz", "publishProof": "Tagged Unity scene package release is created from the EveUnity repository.", "requiredPackageDependencies": [ @@ -137,7 +137,8 @@ "evidencePaths": [ "packages/org.gamecult.eve.unity-scene/package.json", "packages/org.gamecult.eve.unity-scene/Runtime/GameCult.Eve.UnityScene.asmdef", - "scripts/pack.ps1" + "scripts/pack.ps1", + "scripts/build-release-request.ps1" ], "pendingProofs": [ "Cut and publish the first tagged EveUnity package release." @@ -175,7 +176,7 @@ "runtimeId": "unity-scene", "targetId": "unity-scene", "requestSchema": "gamecult.eve.runtime_capture_request.v1", - "requestBuilder": "tools/eveunity/eveunity-capture-contract.mjs", + "requestBuilder": "scripts/build-capture-request.ps1", "advertisementPath": "GameCult/Aetheria:web/fixtures/aetheria.provider-advertisement.json", "captureKind": "unity-scene-frame-png", "artifactKind": "png", @@ -194,7 +195,7 @@ "publishProof": "Unity scene screenshot or frame-capture PNG artifact is attached to the runtime conformance report from EveUnity." }, "evidencePaths": [ - + "scripts/build-capture-request.ps1" ], "pendingProofs": [ "Unity scene screenshot or frame-capture PNG artifact is attached to the runtime conformance report." diff --git a/scripts/build-capture-request.ps1 b/scripts/build-capture-request.ps1 new file mode 100644 index 0000000..01b6520 --- /dev/null +++ b/scripts/build-capture-request.ps1 @@ -0,0 +1,43 @@ +param( + [Parameter(Mandatory = $true)] + [string] $AdvertisementPath, + [string] $SurfaceId = "", + [string] $OutputPath = "artifacts\capture\request.json", + [string] $Stamp = "latest" +) + +$ErrorActionPreference = "Stop" +$repoRoot = Split-Path -Parent $PSScriptRoot +$capabilityPath = Join-Path $repoRoot "packages\org.gamecult.eve.unity-scene\eve-runtime-capability.json" +$capability = Get-Content -Raw $capabilityPath | ConvertFrom-Json +$advertisement = Get-Content -Raw $AdvertisementPath | ConvertFrom-Json +$contract = $capability.lifecycle.capture.captureContract +$surface = @($advertisement.surfaces) | Where-Object { + ([string]::IsNullOrWhiteSpace($SurfaceId) -or $_.surfaceId -eq $SurfaceId) -and + @($_.worldInteraction.loweringTargets) -contains $contract.targetId +} | Select-Object -First 1 +if ($null -eq $surface) { + throw "Provider does not advertise a $($contract.targetId) surface: $SurfaceId" +} +$absoluteOutput = if ([IO.Path]::IsPathRooted($OutputPath)) { $OutputPath } else { Join-Path $repoRoot $OutputPath } + +$request = [ordered]@{ + schema = $contract.requestSchema + ownerRepo = $contract.ownerRepo + runtimeId = $contract.runtimeId + targetId = $contract.targetId + providerId = $advertisement.providerId + surfaceId = $surface.surfaceId + projectionKind = $surface.worldInteraction.projectionKind + commandBoundary = $surface.worldInteraction.commandBoundary + receiptSchema = $surface.worldInteraction.receiptSchema + captureKind = $contract.captureKind + artifactKind = $contract.artifactKind + artifactPath = $contract.artifactPattern.Replace('{stamp}', $Stamp) + sourceAdvertisementPath = $AdvertisementPath +} + +New-Item -ItemType Directory -Force -Path (Split-Path -Parent $absoluteOutput) | Out-Null +$request | ConvertTo-Json -Depth 16 | Set-Content -LiteralPath $absoluteOutput +Write-Host $absoluteOutput + diff --git a/scripts/build-release-request.ps1 b/scripts/build-release-request.ps1 new file mode 100644 index 0000000..1d8b53a --- /dev/null +++ b/scripts/build-release-request.ps1 @@ -0,0 +1,31 @@ +param( + [string] $OutputPath = "artifacts\release\request.json" +) + +$ErrorActionPreference = "Stop" +$repoRoot = Split-Path -Parent $PSScriptRoot +$capabilityPath = Join-Path $repoRoot "packages\org.gamecult.eve.unity-scene\eve-runtime-capability.json" +$packagePath = Join-Path $repoRoot "packages\org.gamecult.eve.unity-scene\package.json" +$capability = Get-Content -Raw $capabilityPath | ConvertFrom-Json +$package = Get-Content -Raw $packagePath | ConvertFrom-Json +$contract = $capability.lifecycle.release.releaseContract +$absoluteOutput = if ([IO.Path]::IsPathRooted($OutputPath)) { $OutputPath } else { Join-Path $repoRoot $OutputPath } + +$request = [ordered]@{ + schema = $contract.requestSchema + ownerRepo = $contract.ownerRepo + repository = "GameCult/EveUnity" + packageName = $contract.packageName + version = $package.version + packageRoot = $contract.packageRoot + versionSource = $contract.versionSource + tagName = $contract.tagPattern.Replace('{version}', $package.version) + artifactKind = $contract.artifactKind + artifactPath = $contract.artifactPattern.Replace('{version}', $package.version) + dependencies = $package.dependencies +} + +New-Item -ItemType Directory -Force -Path (Split-Path -Parent $absoluteOutput) | Out-Null +$request | ConvertTo-Json -Depth 16 | Set-Content -LiteralPath $absoluteOutput +Write-Host $absoluteOutput +