CultLib/packages/cultmesh-kotlin/build.ps1
Libby cbb336f501
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Failing after 6m5s
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Successful in 26s
cultmesh-kotlin: decode write_admitted.v0 and error.v1, content hash, WriteTracker, vector replay
Strict decode of the two receipt frames (and error.v0), hello capability test,
the dedupe content hash and the client settle rules, ported from cultnet-ts.
write-receipt-vectors.json replays 38/38 (constants, contentHash, wire,
schemaInvalid, scenarios, v0 limit_reached); dedupe and blankFields are server
inputs and not run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 22:03:27 +00:00

32 lines
1.8 KiB
PowerShell

param(
[string] $KotlinHome = $(if ($env:KOTLIN_HOME) { $env:KOTLIN_HOME } else { "C:\Program Files\Android\Android Studio\plugins\Kotlin\kotlinc" }),
[string] $JavaHome = $(if ($env:KOTLIN_JAVA_HOME) { $env:KOTLIN_JAVA_HOME } elseif ($env:JAVA_HOME) { $env:JAVA_HOME } else { "C:\Program Files\Android\Android Studio\jbr" })
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
$src = Join-Path $PSScriptRoot "src\main\kotlin"
$out = Join-Path $repoRoot "artifacts\cultmesh-kotlin"
$jarPath = Join-Path $out "cultmesh-kotlin.jar"
$kotlinc = Join-Path $KotlinHome "bin\kotlinc.bat"
$kotlinStdlib = Join-Path $KotlinHome "lib\kotlin-stdlib.jar"
$java = Join-Path $JavaHome "bin\java.exe"
if (-not (Test-Path $kotlinc)) { throw "kotlinc not found: $kotlinc" }
if (-not (Test-Path $kotlinStdlib)) { throw "kotlin stdlib not found: $kotlinStdlib" }
if (-not (Test-Path $java)) { throw "java not found: $java" }
$env:JAVA_HOME = $JavaHome
$env:PATH = "$(Join-Path $JavaHome 'bin');$env:PATH"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $out
New-Item -ItemType Directory -Force $out | Out-Null
$sources = Get-ChildItem $src -Recurse -Filter *.kt | Select-Object -ExpandProperty FullName
& $kotlinc @sources -jvm-target 1.8 -classpath $kotlinStdlib -d $jarPath
if ($LASTEXITCODE -ne 0) { throw "kotlinc failed with exit code $LASTEXITCODE" }
& $java -cp "$jarPath;$kotlinStdlib" org.gamecult.cultmesh.CultMeshKt
if ($LASTEXITCODE -ne 0) { throw "cultmesh-kotlin self-test failed with exit code $LASTEXITCODE" }
$vectors = Join-Path $repoRoot "contracts\cultnet\interop\write-receipt-vectors.json"
& $java -cp "$jarPath;$kotlinStdlib" org.gamecult.cultmesh.CultMeshKt write-receipt-vectors $vectors
if ($LASTEXITCODE -ne 0) { throw "write-receipt vector replay failed with exit code $LASTEXITCODE" }
Write-Host "Built $jarPath"