# Build de l'application Windows autonome (Plesna Gérance). # # À lancer depuis la racine du projet, dans PowerShell, sur une machine Windows : # # powershell -ExecutionPolicy Bypass -File packaging\build_windows.ps1 # # Prérequis sur la machine de build (PAS sur la machine de l'utilisateur final) : # - Python >= 3.10 et uv (https://docs.astral.sh/uv/) # - Node.js >= 22 (pour builder le frontend) # - (optionnel) Inno Setup 6 pour produire l'installeur .exe # # Résultat : # dist\PlesnaGerance.exe (exécutable autonome) # dist\PlesnaGerance-Setup.exe (installeur, si Inno Setup présent) $ErrorActionPreference = "Stop" $Root = Split-Path -Parent $PSScriptRoot Set-Location $Root Write-Host "==> 1/4 Build du frontend" -ForegroundColor Cyan Set-Location (Join-Path $Root "frontend") npm ci npm run build Set-Location $Root Write-Host "==> 2/4 Installation des dependances Python (desktop + build)" -ForegroundColor Cyan uv sync --group desktop --group build Write-Host "==> 3/4 Empaquetage PyInstaller" -ForegroundColor Cyan uv run pyinstaller packaging\plesna_gerance.spec --noconfirm --clean $Exe = Join-Path $Root "dist\PlesnaGerance.exe" if (-not (Test-Path $Exe)) { throw "Echec : $Exe introuvable." } Write-Host " OK -> $Exe" -ForegroundColor Green Write-Host "==> 4/4 Construction de l'installeur (Inno Setup)" -ForegroundColor Cyan $IsccCandidates = @( "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe", "${env:ProgramFiles}\Inno Setup 6\ISCC.exe" ) $Iscc = $IsccCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1 if ($Iscc) { & $Iscc "packaging\installer.iss" Write-Host " OK -> dist\PlesnaGerance-Setup.exe" -ForegroundColor Green } else { Write-Host " Inno Setup non trouve : etape installeur ignoree." -ForegroundColor Yellow Write-Host " (L'executable dist\PlesnaGerance.exe est utilisable tel quel.)" -ForegroundColor Yellow } Write-Host "`nTermine." -ForegroundColor Green