76 lines
2.5 KiB
PowerShell
76 lines
2.5 KiB
PowerShell
|
|
Write-Host "AZA Desktop EXE Build gestartet..."
|
||
|
|
|
||
|
|
$projectRoot = $PSScriptRoot
|
||
|
|
$specFile = Join-Path $projectRoot "aza_desktop.spec"
|
||
|
|
|
||
|
|
Set-Location $projectRoot
|
||
|
|
|
||
|
|
# --- Pre-Build-Validierung: Produktivwerte pruefen ---
|
||
|
|
Write-Host ""
|
||
|
|
Write-Host "Pre-Build-Validierung..."
|
||
|
|
|
||
|
|
$urlFile = Join-Path $projectRoot "backend_url.txt"
|
||
|
|
if (-not (Test-Path $urlFile)) {
|
||
|
|
Write-Error "ABBRUCH: backend_url.txt nicht gefunden. Datei muss die produktive Backend-URL enthalten."
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
$urlContent = (Get-Content $urlFile -Raw).Trim()
|
||
|
|
if ($urlContent -match "127\.0\.0\.1|localhost|0\.0\.0\.0") {
|
||
|
|
Write-Error "ABBRUCH: backend_url.txt enthaelt eine lokale Adresse ($urlContent). Bitte auf die produktive URL setzen (z.B. https://api.aza-medwork.ch)."
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
if (-not $urlContent) {
|
||
|
|
Write-Error "ABBRUCH: backend_url.txt ist leer. Bitte die produktive Backend-URL eintragen."
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
Write-Host " backend_url.txt OK: $urlContent"
|
||
|
|
|
||
|
|
$tokenFile = Join-Path $projectRoot "backend_token.txt"
|
||
|
|
if (-not (Test-Path $tokenFile)) {
|
||
|
|
Write-Error "ABBRUCH: backend_token.txt nicht gefunden. Datei muss den produktiven API-Token enthalten."
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
$tokenContent = (Get-Content $tokenFile -Raw).Trim()
|
||
|
|
if (-not $tokenContent) {
|
||
|
|
Write-Error "ABBRUCH: backend_token.txt ist leer. Bitte den produktiven API-Token eintragen."
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
if ($tokenContent -match "CHANGE_ME") {
|
||
|
|
Write-Error "ABBRUCH: backend_token.txt enthaelt einen Platzhalter ($tokenContent). Bitte den echten produktiven Token eintragen."
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
Write-Host " backend_token.txt OK (Token vorhanden, kein Platzhalter)"
|
||
|
|
Write-Host ""
|
||
|
|
|
||
|
|
Write-Host "PyInstaller Installation prüfen..."
|
||
|
|
pip install pyinstaller --quiet
|
||
|
|
|
||
|
|
Write-Host "Alte Build-Artefakte werden bereinigt..."
|
||
|
|
if (Test-Path (Join-Path $projectRoot "build")) {
|
||
|
|
Remove-Item (Join-Path $projectRoot "build") -Recurse -Force
|
||
|
|
}
|
||
|
|
if (Test-Path (Join-Path $projectRoot "dist\aza_desktop")) {
|
||
|
|
Remove-Item (Join-Path $projectRoot "dist\aza_desktop") -Recurse -Force
|
||
|
|
}
|
||
|
|
|
||
|
|
Write-Host "EXE wird aus aza_desktop.spec gebaut..."
|
||
|
|
pyinstaller --noconfirm $specFile
|
||
|
|
|
||
|
|
if ($LASTEXITCODE -ne 0) {
|
||
|
|
Write-Error "PyInstaller Build fehlgeschlagen."
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
|
||
|
|
$exePath = Join-Path $projectRoot "dist\aza_desktop\aza_desktop.exe"
|
||
|
|
if (-not (Test-Path $exePath)) {
|
||
|
|
Write-Error "Build wurde beendet, aber die EXE wurde nicht gefunden: $exePath"
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
|
||
|
|
Write-Host ""
|
||
|
|
Write-Host "Build fertig."
|
||
|
|
Write-Host "Die Desktop-App liegt in:"
|
||
|
|
Write-Host "$projectRoot\dist\aza_desktop\"
|
||
|
|
Write-Host "EXE:"
|
||
|
|
Write-Host $exePath
|