Ship authenticated remote transports in Unity package
This commit is contained in:
parent
c194bd4cc8
commit
99458dbb57
28 changed files with 309 additions and 53 deletions
|
|
@ -9,9 +9,11 @@ $ErrorActionPreference = "Stop"
|
|||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$projectPath = Join-Path $repoRoot "src\GameCult.Mesh\GameCult.Mesh.csproj"
|
||||
$webSocketProjectPath = Join-Path $repoRoot "src\GameCult.Networking.WebSockets\GameCult.Networking.WebSockets.csproj"
|
||||
$quicProjectPath = Join-Path $repoRoot "src\GameCult.Mesh.Quic.Native\GameCult.Mesh.Quic.Native.csproj"
|
||||
$templateRoot = Join-Path $repoRoot "unity\org.gamecult.cultlib"
|
||||
$publishRoot = Join-Path $repoRoot "artifacts\unity-publish"
|
||||
$webSocketPublishRoot = Join-Path $repoRoot "artifacts\unity-websocket-publish"
|
||||
$quicPublishRoot = Join-Path $repoRoot "artifacts\unity-quic-publish"
|
||||
$quicNativeRoot = Join-Path $repoRoot "artifacts\unity-quic-native"
|
||||
$outputRoot = if ([System.IO.Path]::IsPathRooted($OutputDirectory)) {
|
||||
|
|
@ -27,11 +29,15 @@ if (Test-Path -LiteralPath $publishRoot) {
|
|||
if (Test-Path -LiteralPath $quicPublishRoot) {
|
||||
Remove-Item -LiteralPath $quicPublishRoot -Recurse -Force
|
||||
}
|
||||
if (Test-Path -LiteralPath $webSocketPublishRoot) {
|
||||
Remove-Item -LiteralPath $webSocketPublishRoot -Recurse -Force
|
||||
}
|
||||
if (Test-Path -LiteralPath $outputRoot) {
|
||||
Remove-Item -LiteralPath $outputRoot -Recurse -Force
|
||||
}
|
||||
|
||||
$publishArguments = @("publish", $projectPath, "-c", $Configuration, "-o", $publishRoot)
|
||||
$unityPackageVersion = (Get-Content -LiteralPath (Join-Path $templateRoot "package.json") -Raw | ConvertFrom-Json).version
|
||||
$publishArguments = @("publish", $projectPath, "-c", $Configuration, "-o", $publishRoot, "-p:CultLibPackageVersion=$unityPackageVersion")
|
||||
if (-not [string]::IsNullOrWhiteSpace($NuGetConfig)) {
|
||||
$publishArguments += "-p:RestoreConfigFile=$([IO.Path]::GetFullPath($NuGetConfig))"
|
||||
}
|
||||
|
|
@ -39,7 +45,15 @@ if (-not [string]::IsNullOrWhiteSpace($NuGetConfig)) {
|
|||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "CultLib publish failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
$quicPublishArguments = @("publish", $quicProjectPath, "-c", $Configuration, "-o", $quicPublishRoot)
|
||||
$webSocketPublishArguments = @("publish", $webSocketProjectPath, "-c", $Configuration, "-f", "netstandard2.1", "-o", $webSocketPublishRoot, "-p:CultLibPackageVersion=$unityPackageVersion")
|
||||
if (-not [string]::IsNullOrWhiteSpace($NuGetConfig)) {
|
||||
$webSocketPublishArguments += "-p:RestoreConfigFile=$([IO.Path]::GetFullPath($NuGetConfig))"
|
||||
}
|
||||
& dotnet @webSocketPublishArguments
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "CultLib WebSocket publish failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
$quicPublishArguments = @("publish", $quicProjectPath, "-c", $Configuration, "-o", $quicPublishRoot, "-p:CultLibPackageVersion=$unityPackageVersion")
|
||||
if (-not [string]::IsNullOrWhiteSpace($NuGetConfig)) {
|
||||
$quicPublishArguments += "-p:RestoreConfigFile=$([IO.Path]::GetFullPath($NuGetConfig))"
|
||||
}
|
||||
|
|
@ -63,6 +77,7 @@ $expectedAssemblies = @(
|
|||
"GameCult.Mesh.dll",
|
||||
"GameCult.Mesh.Quic.Native.dll",
|
||||
"GameCult.Networking.dll",
|
||||
"GameCult.Networking.WebSockets.dll",
|
||||
"Isopoh.Cryptography.Argon2.dll",
|
||||
"Isopoh.Cryptography.Blake2b.dll",
|
||||
"Isopoh.Cryptography.SecureArray.dll",
|
||||
|
|
@ -88,6 +103,9 @@ foreach ($assembly in Get-ChildItem -LiteralPath $publishRoot -Filter "*.dll") {
|
|||
foreach ($assembly in Get-ChildItem -LiteralPath $quicPublishRoot -Filter "*.dll") {
|
||||
$publishedByName[$assembly.Name] = $assembly
|
||||
}
|
||||
foreach ($assembly in Get-ChildItem -LiteralPath $webSocketPublishRoot -Filter "*.dll") {
|
||||
$publishedByName[$assembly.Name] = $assembly
|
||||
}
|
||||
foreach ($assemblyName in $expectedAssemblies) {
|
||||
if (-not $publishedByName.ContainsKey($assemblyName)) {
|
||||
throw "CultLib Unity package is missing expected assembly: $assemblyName"
|
||||
|
|
@ -112,6 +130,26 @@ New-Item -ItemType Directory -Force -Path (Join-Path $outputRoot "Third Party No
|
|||
Copy-Item -LiteralPath (Join-Path $quicNativeRoot "MSQUIC-LICENSE.txt") `
|
||||
-Destination (Join-Path $outputRoot "Third Party Notices\MSQUIC-LICENSE.txt")
|
||||
|
||||
$meshPackagePath = Join-Path $pluginRoot "GameCult.Mesh.dll"
|
||||
$meshPackageVersion = [Reflection.AssemblyName]::GetAssemblyName($meshPackagePath).Version.ToString()
|
||||
if ($meshPackageVersion -ne "$unityPackageVersion.0") {
|
||||
throw "Packaged GameCult.Mesh.dll version '$meshPackageVersion' does not match package '$unityPackageVersion'."
|
||||
}
|
||||
$meshPackageMetadata = [Text.Encoding]::UTF8.GetString([IO.File]::ReadAllBytes($meshPackagePath))
|
||||
foreach ($requiredType in @(
|
||||
"GameCult.Mesh.CultMeshAuthorityTrustPolicy",
|
||||
"GameCult.Mesh.CultMeshRouteCertificate",
|
||||
"GameCult.Mesh.CultMeshHttpsContentTransportConnector")) {
|
||||
if (-not $meshPackageMetadata.Contains($requiredType.Split('.')[-1])) {
|
||||
throw "Packaged GameCult.Mesh.dll is missing required API '$requiredType'."
|
||||
}
|
||||
}
|
||||
$webSocketPackageMetadata = [Text.Encoding]::UTF8.GetString(
|
||||
[IO.File]::ReadAllBytes((Join-Path $pluginRoot "GameCult.Networking.WebSockets.dll")))
|
||||
if (-not $webSocketPackageMetadata.Contains("CultNetWebSocketSchemaClient")) {
|
||||
throw "Packaged WebSocket assembly is missing the Unity-compatible CultNet client."
|
||||
}
|
||||
|
||||
if ($UpdateTemplate) {
|
||||
$templatePluginRoot = Join-Path $templateRoot "Runtime\Plugins"
|
||||
foreach ($assemblyName in $expectedAssemblies) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($sourceRevision)) {
|
|||
throw "Could not determine the CultLib source revision for local package identity."
|
||||
}
|
||||
$verificationNonce = [guid]::NewGuid().ToString("N").Substring(0, 8)
|
||||
$cultLibLocalVersion = "1.0.34-local.$sourceRevision.$verificationNonce"
|
||||
$cultLibLocalVersion = "1.0.35-local.$sourceRevision.$verificationNonce"
|
||||
$surfaceLocalVersion = "0.3.3-local.$sourceRevision.$verificationNonce"
|
||||
try {
|
||||
& (Join-Path $EveRoot "scripts\pack-dotnet-surface.ps1") `
|
||||
|
|
|
|||
Loading…
Reference in a new issue