# Build a distributable without developer settings, game assets or content projects. param([switch] $SkipBuild) $ErrorActionPreference = 'Stop' $packageRoot = Split-Path -Parent $PSScriptRoot Push-Location $packageRoot try { if (-not $SkipBuild) { & cargo build --locked --release -p editor-app -p editor-cli if ($LASTEXITCODE -ne 0) { throw 'Release build failed.' } } $packageId = 'moonwell-editor-windows-x64-' + (Get-Date -Format 'yyyyMMdd-HHmmss') $packageDir = Join-Path $packageRoot "dist/$packageId" if (Test-Path -LiteralPath $packageDir) { throw 'Package already exists.' } New-Item -ItemType Directory -Path "$packageDir/scripts" -Force | Out-Null Copy-Item -LiteralPath 'target/release/benilla-editor.exe', 'target/release/benilla-editor-cli.exe', 'LICENSE-MIT', 'LICENSE-APACHE', 'BENILLA_REV' -Destination $packageDir Copy-Item -LiteralPath 'scripts/prepare-play.ps1' -Destination "$packageDir/scripts" Copy-Item -LiteralPath 'docs/install.md' -Destination "$packageDir/README.md" $packageFiles = Get-ChildItem -LiteralPath $packageDir -File -Recurse $packageFiles | ForEach-Object { $relative = $_.FullName.Substring($packageDir.Length + 1) $hash = (Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant() "$hash $relative" } | Set-Content -LiteralPath "$packageDir/SHA256SUMS.txt" -Encoding UTF8 Compress-Archive -LiteralPath $packageDir -DestinationPath "$packageDir.zip" Write-Output "Package: $packageDir.zip" } finally { Pop-Location }