Files
moonwell-editor/scripts/package.ps1
T
sindoring f8d242977d Make editor installation independent of the developer machine
Add a project launcher, per-user settings and Play state, explicit env import, pinned Git engine dependencies and a Windows distribution script.

Validated on Windows x64: formatting, workspace Clippy, 41 tests, local realm security test and release launches outside the repository with profile preservation.

Co-Authored-By: Codex <noreply@openai.com>
2026-11-04 16:39:47 +04:00

29 lines
1.5 KiB
PowerShell

# 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
}