# SPDX-License-Identifier: MPL-2.0 # Messages en ASCII : compatible Windows PowerShell 5.1 sans BOM. <# .SYNOPSIS Build unifie (ADR 0010) : Godot, C++, interface, puis bin\\\. .DESCRIPTION Pour chaque type demande : 1. Godot (LibGodot) via build-godot.ps1, seulement si sa bibliotheque manque (template_debug pour debug, template_release pour release, rien pour asan) ; 2. le preset CMake via build.ps1 (compilation et tests) ; 3. arret des processus SEQUA lances depuis bin\\\ (Studio, Core, rendu) : Windows refuse de remplacer un fichier en cours d'utilisation ; 4. cmake --install vers bin\\\. L'interface (studio\ui) est construite une fois, avant le premier type. Lancer ensuite : bin\windows-x64\\studio\sequa-studio.exe .PARAMETER Type debug (defaut), release, asan, ou all (les trois). .PARAMETER NoTests Compile sans lancer les tests. .PARAMETER Godot Reconstruit Godot meme si sa bibliotheque existe (apres une modification du fork). .PARAMETER SkipGodot Ne construit jamais Godot (echoue a la configuration s'il manque). .PARAMETER SkipUi Ne construit pas l'interface (installe studio\ui\dist s'il existe). .PARAMETER NoStop Echoue au lieu d'arreter les processus SEQUA qui tournent depuis le dossier vise. .PARAMETER Clean Supprime build\ et bin\\ avant de construire. .PARAMETER Help Affiche cette aide. .EXAMPLE .\scripts\build-all.ps1 .EXAMPLE .\scripts\build-all.ps1 -Type all -NoTests #> [CmdletBinding()] param( [ValidateSet("debug", "release", "asan", "all")] [string]$Type = "debug", [switch]$NoTests, [switch]$Godot, [switch]$SkipGodot, [switch]$SkipUi, [switch]$NoStop, [switch]$Clean, [Alias("h", "?")] [switch]$Help ) if ($Help) { Get-Help $PSCommandPath -Detailed exit 0 } $ErrorActionPreference = "Stop" $root = Split-Path -Parent $PSScriptRoot $platform = "windows-x64" $types = if ($Type -eq "all") { @("debug", "release", "asan") } else { @($Type) } $presets = @{ debug = "windows-msvc-debug"; release = "windows-msvc-release"; asan = "windows-msvc-asan" } $godotTargets = @{ debug = "template_debug"; release = "template_release"; asan = $null } function Invoke-Step([string]$label, [scriptblock]$cmd) { Write-Host "==> $label" -ForegroundColor Cyan & $cmd if ($LASTEXITCODE -ne 0) { throw "Echec : $label (code $LASTEXITCODE)" } } function Build-Ui { $ui = Join-Path $root "studio\ui" Push-Location $ui try { if (-not (Test-Path (Join-Path $ui "node_modules"))) { Invoke-Step "studio\ui : npm ci" { npm ci } } Invoke-Step "studio\ui : npm run build" { npm run build } } finally { Pop-Location } } function Build-Godot([string]$target) { $library = Join-Path $root "engines\godot\vendor\godot-src\bin\godot.windows.$target.x86_64.dll" if ((Test-Path $library) -and -not $Godot) { return } if ($SkipGodot) { return } Write-Host "==> Godot $target (10 a 20 min la premiere fois)" -ForegroundColor Cyan & (Join-Path $PSScriptRoot "build-godot.ps1") -Target $target } # Processus SEQUA lances depuis $dir : executable dans $dir, ou Core (copie fantome) # dont la ligne de commande designe $dir par --sequa-root. function Get-SequaProcesses([string]$dir) { $prefix = [IO.Path]::GetFullPath($dir).TrimEnd('\') + '\' Get-CimInstance Win32_Process -Filter "Name LIKE 'sequa-%'" | Where-Object { ($_.ExecutablePath -and $_.ExecutablePath.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) -or ($_.CommandLine -and $_.CommandLine.IndexOf($prefix.TrimEnd('\'), [StringComparison]::OrdinalIgnoreCase) -ge 0) } } function Stop-SequaProcesses([string]$dir) { $running = @(Get-SequaProcesses $dir) if ($running.Count -eq 0) { return } $names = ($running | ForEach-Object { "$($_.Name) (pid $($_.ProcessId))" }) -join ", " if ($NoStop) { throw "Processus SEQUA en cours depuis $dir : $names (-NoStop)" } Write-Host "==> arret : $names" -ForegroundColor Yellow foreach ($process in $running) { Stop-Process -Id $process.ProcessId -Force -ErrorAction SilentlyContinue } foreach ($process in $running) { Wait-Process -Id $process.ProcessId -Timeout 10 -ErrorAction SilentlyContinue } } $start = Get-Date if (-not $SkipUi) { Build-Ui } foreach ($t in $types) { $preset = $presets[$t] $bin = Join-Path $root "bin\$platform\$t" $buildDir = Join-Path $root "build\$preset" if ($godotTargets[$t]) { Build-Godot $godotTargets[$t] } $buildArgs = @{ Preset = $preset } if ($NoTests) { $buildArgs.NoTests = $true } if ($Clean) { $buildArgs.Clean = $true } & (Join-Path $PSScriptRoot "build.ps1") @buildArgs Stop-SequaProcesses $bin if ($Clean -and (Test-Path $bin)) { Remove-Item -Recurse -Force $bin } # L'interface change de noms de fichiers a chaque build : pas de restes. $uiBin = Join-Path $bin "studio\ui" if (Test-Path $uiBin) { Remove-Item -Recurse -Force $uiBin } # cmake est dans le PATH depuis build.ps1 (CMake de Visual Studio). Invoke-Step "install $preset -> bin\$platform\$t" { cmake --install $buildDir --prefix $bin } } $elapsed = (Get-Date) - $start Write-Host ("==> termine en {0:N1} min" -f $elapsed.TotalMinutes) -ForegroundColor Green foreach ($t in $types) { Write-Host " bin\$platform\$t\studio\sequa-studio.exe" }