59 lines
2.2 KiB
PowerShell
59 lines
2.2 KiB
PowerShell
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$GodotExe,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$MakeNsisExe
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$projectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
|
|
$gameExe = Join-Path $projectRoot "build\windows\Void-Bastion.exe"
|
|
$installer = Join-Path $projectRoot "dist\Void-Bastion-Setup-x64.exe"
|
|
$installerScript = Join-Path $PSScriptRoot "installer.nsi"
|
|
$projectFile = Join-Path $projectRoot "project.godot"
|
|
|
|
foreach ($requiredFile in @($GodotExe, $MakeNsisExe, $installerScript)) {
|
|
if (-not (Test-Path -LiteralPath $requiredFile -PathType Leaf)) {
|
|
throw "Benötigte Datei fehlt: $requiredFile"
|
|
}
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path (Split-Path $gameExe), (Split-Path $installer) | Out-Null
|
|
|
|
$projectConfiguration = Get-Content -LiteralPath $projectFile -Raw
|
|
$releaseConfiguration = $projectConfiguration -replace '(?m)^_MCPGameBridge=.*\r?\n?', ''
|
|
$releaseConfiguration = $releaseConfiguration -replace '"res://addons/agent_tools/plugin\.cfg",\s*', ''
|
|
|
|
try {
|
|
# Die lokale MCP-Laufzeit ist ein Entwicklungswerkzeug und wird vom
|
|
# Exportfilter ausgeschlossen. Deshalb dürfen weder ihr Autoload-Verweis
|
|
# noch das Editor-Plugin in der veröffentlichten project.binary verbleiben.
|
|
Set-Content -LiteralPath $projectFile -Value $releaseConfiguration -NoNewline
|
|
& $GodotExe --headless --path $projectRoot --export-release "Windows x64" $gameExe
|
|
if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $gameExe)) {
|
|
throw "Der Godot-Windows-Export ist fehlgeschlagen."
|
|
}
|
|
}
|
|
finally {
|
|
Set-Content -LiteralPath $projectFile -Value $projectConfiguration -NoNewline
|
|
}
|
|
|
|
Push-Location $PSScriptRoot
|
|
try {
|
|
& $MakeNsisExe $installerScript
|
|
if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $installer)) {
|
|
throw "Die Installer-Erstellung mit NSIS ist fehlgeschlagen."
|
|
}
|
|
}
|
|
finally {
|
|
Pop-Location
|
|
}
|
|
|
|
$installerFile = Get-Item -LiteralPath $installer
|
|
$hash = Get-FileHash -Algorithm SHA256 -LiteralPath $installer
|
|
Write-Host "Windows-Installer erfolgreich erstellt:"
|
|
Write-Host " Datei: $($installerFile.FullName)"
|
|
Write-Host " Größe: $([math]::Round($installerFile.Length / 1MB, 1)) MiB"
|
|
Write-Host " SHA256: $($hash.Hash)"
|