From 4b9f03c9d7ebb5870b02e69c43e3d38784bef5d1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 23 May 2026 09:17:34 +0200 Subject: [PATCH] Continuo con le modifiche e i test --- IOB-WIN-FORM/Iob/Generic.cs | 28 +++++++++------------------ build_all_par.ps1 | 38 +++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/IOB-WIN-FORM/Iob/Generic.cs b/IOB-WIN-FORM/Iob/Generic.cs index a3bd2c16..a5a05a83 100644 --- a/IOB-WIN-FORM/Iob/Generic.cs +++ b/IOB-WIN-FORM/Iob/Generic.cs @@ -1129,25 +1129,15 @@ namespace IOB_WIN_FORM.Iob case taskType.forceSetPzCount: // recupero dati da memMap... - if (memMap != null && memMap.mMapWrite != null) - { - if (memMap.mMapWrite.ContainsKey(iKey)) - { - dataConf currMem = memMap.mMapWrite[iKey]; - string addr = currMem.memAddr; - taskVal = $"SET task: {iKey} --> {item.Value} | mem: {currMem.memAddr} - {currMem.size} byte"; - // salvo il nuovo valore nella memoria... così prox invio lo trasmetterà - memMap.mMapWrite[iKey].value = item.Value; - } - else - { - taskVal = $"NO DATA MEM, SET task: {iKey} --> {item.Value}"; - } - } - else - { - taskVal = $"NO BankConf found, SET task: {iKey} --> {item.Value}"; - } + if (machineCommService.WriteToMemMap(iKey, item.Value)) + { + taskVal = $"SET task: {iKey} --> {item.Value} | mem: [Updated via MachineComm]"; + } + else + { + taskVal = $"NO DATA MEM, SET task: {iKey} --> {item.Value}"; + } + lgInfo($"Chiamata forceSetPzCount: taskVal: {taskVal}"); break; diff --git a/build_all_par.ps1 b/build_all_par.ps1 index d9f17b5d..f98d89ae 100644 --- a/build_all_par.ps1 +++ b/build_all_par.ps1 @@ -2,13 +2,13 @@ $pattern = "IOB-WIN-*.sln" $sharedProjectPath = ".\IOB-WIN-FORM\IOB-WIN-FORM.csproj" -# Nuova modalità per l'agente -$agentMode = $args[0] -eq "--agent" +# Controllo robusto del parametro --agent (cerca in tutti gli argomenti passati) +$agentMode = $args -contains "--agent" # Avvia il cronometro per calcolare il tempo totale $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() -# 1. Trova l'MSBuild ufficiale di Visual Studio 2022 (Gestione installazioni multiple corretta) +# 1. Trova l'MSBuild ufficiale di Visual Studio 2022 $vsPaths = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -version "[17.0,18.0)" -products * -requires Microsoft.Component.MSBuild -property installationPath if (-not $vsPaths) { if ($agentMode) { exit 1 } @@ -36,11 +36,18 @@ if (-not $agentMode) { Write-Host "🚀 Trovate $($solutions.Count) soluzioni univoche." -ForegroundColor Magenta } -# FASE 1: Compilazione preventiva del progetto comune (Usando MSBuild) +# FASE 1: Compilazione preventiva del progetto comune if (Test-Path $sharedProjectPath) { if (-not $agentMode) { Write-Host "`n📦 Fase 1: Compilazione del progetto comune condiviso..." -ForegroundColor Cyan } - # Usiamo Release e x86 come da istruzioni AGENTS.md - & $msbuildPath $sharedProjectPath /p:Configuration=Release /v:m + + # AGGIORNAMENTO: Se siamo in agentMode silenziamo completamente MSBuild (/v:q) e ridirigiamo l'output + if ($agentMode) { + & $msbuildPath $sharedProjectPath /p:Configuration=Release /v:q /nologo > $null 2>&1 + } + else { + & $msbuildPath $sharedProjectPath /p:Configuration=Release /v:m /nologo + } + if ($LASTEXITCODE -ne 0) { if (-not $agentMode) { Write-Host "❌ Errore critico: Impossibile compilare il progetto comune. Interruzione." -ForegroundColor Red } exit 1 @@ -59,9 +66,8 @@ $parallelResults = $solutions | ForEach-Object -Parallel { $solPath = $_.FullName $msb = $using:msbuildPath - # Esegue MSBuild nativo catturando i log - # Usiamo Release e x86 per coerenza con le specifiche del progetto - $log = & $msb $solPath /p:Configuration=Release /m:1 /p:BuildInParallel=false /v:m 2>&1 + # Aggiunto /nologo per evitare intestazioni ripetute nei log interni + $log = & $msb $solPath /p:Configuration=Release /m:1 /p:BuildInParallel=false /v:m /nologo 2>&1 [PSCustomObject]@{ Name = $solName @@ -96,12 +102,9 @@ if ($failedToRetry.Count -gt 0) { foreach ($failedRes in $failedToRetry) { if (-not $agentMode) { Write-Host "⏳ Ripristino e compilazione sequenziale: $($failedRes.Name)..." -ForegroundColor Cyan } - # 1. Forza un Restore pulito delle dipendenze per questa soluzione - & $msbuildPath $failedRes.FullName /t:Restore /v:m > $null - # 2. Pulisce eventuali residui corrotti - & $msbuildPath $failedRes.FullName /t:Clean /v:m /p:Configuration=Release > $null - # 3. Riprova la Build reale - $retryLog = & $msbuildPath $failedRes.FullName /t:Build /p:Configuration=Release /v:m 2>&1 + & $msbuildPath $failedRes.FullName /t:Restore /v:q /nologo > $null 2>&1 + & $msbuildPath $failedRes.FullName /t:Clean /v:q /p:Configuration=Release /nologo > $null 2>&1 + $retryLog = & $msbuildPath $failedRes.FullName /t:Build /p:Configuration=Release /v:m /nologo 2>&1 if ($LASTEXITCODE -eq 0) { if (-not $agentMode) { Write-Host "✅ FALSO ALLARME: $($failedRes.Name) compilata correttamente in sequenziale!" -ForegroundColor Green } @@ -109,7 +112,6 @@ if ($failedToRetry.Count -gt 0) { } else { if (-not $agentMode) { Write-Host "❌ ERRORE REALE: $($failedRes.Name) è fallita anche in sequenziale." -ForegroundColor Red } - # Sovrascriviamo l'oggetto inserendo il log del fallimento sequenziale (più pulito) $failedRes.Log = $retryLog } } @@ -151,5 +153,5 @@ if (-not $agentMode) { Write-Host "==================================================" -ForegroundColor Magenta } -# Exit code per l'agente -if ($failCount -gt 0) { exit 1 } else { exit 0 } +# Exit code standard per ambienti automatizzati (0 = Successo, 1 = Fallimento) +if ($failCount -gt 0) { exit 1 } else { exit 0 } \ No newline at end of file