Files
Data-Coupler/Scripts/build-and-deploy.ps1
Alessio d042863a56 feat: Implementazione completa sistema schedulazione con intervalli personalizzati
- Aggiunto supporto schedulazione con intervalli flessibili (secondi/minuti/ore/giorni/settimane/mesi)
- Esteso modello ProfileSchedule con campi IntervalValue e IntervalUnit
- Ottimizzato ScheduledJobService per controlli ogni 30s con esecuzione parallela
- Implementata interfaccia UI completa con anteprima real-time in italiano
- Aggiunta migrazione database AddIntervalSchedulingFields
- Implementati metodi calcolo NextExecutionTime per intervalli
- Aggiunta gestione tracking anti-duplicati e cleanup automatico
- Creata documentazione completa (6 file, 2500+ righe)

Modifiche tecniche:
- ProfileSchedule.cs: Nuovi campi e metodi CalculateNextInterval/GetScheduleDescription
- ScheduledJobService.cs: Ridotto check interval a 30s, aggiunto parallel processing
- ProfileScheduleService.cs: Supporto calcolo intervalli in UpdateNextExecutionTimeAsync
- Scheduling.razor: Aggiunta sezione UI per configurazione intervalli
- Scheduling.razor.cs: Implementato GetIntervalPreview() e gestione stato campi
2025-10-02 01:12:39 +02:00

98 lines
3.6 KiB
PowerShell

# Script per build e deploy ottimizzato per Windows Service
# Eseguire da PowerShell come Amministratore
param(
[string]$OutputPath = "C:\Temp\Publish\Data_Coupler",
[string]$ServicePath = "C:\Services\DataCoupler",
[switch]$InstallService = $false,
[switch]$CleanBuild = $false
)
Write-Host "=== Data Coupler Build & Deploy Script ===" -ForegroundColor Cyan
Write-Host "Output Path: $OutputPath" -ForegroundColor Yellow
Write-Host "Service Path: $ServicePath" -ForegroundColor Yellow
try {
# Naviga alla directory del progetto
$projectRoot = Split-Path $PSScriptRoot -Parent
Set-Location $projectRoot
Write-Host "Directory progetto: $projectRoot" -ForegroundColor Green
# Clean build se richiesto
if ($CleanBuild) {
Write-Host "`nPulizia build precedenti..." -ForegroundColor Yellow
dotnet clean Data_Coupler.sln
}
# Build del progetto in modalità Release
Write-Host "`nBuild del progetto..." -ForegroundColor Green
$buildResult = dotnet publish Data_Coupler/Data_Coupler.csproj `
--configuration Release `
--output $OutputPath `
--self-contained true `
--runtime win-x64 `
--verbosity minimal `
-p:PublishSingleFile=false `
-p:PublishReadyToRun=true
if ($LASTEXITCODE -ne 0) {
throw "Errore durante il build del progetto"
}
Write-Host "Build completato con successo!" -ForegroundColor Green
# Verifica che l'eseguibile sia stato creato
$exePath = Join-Path $OutputPath "Data_Coupler.exe"
if (-not (Test-Path $exePath)) {
throw "File eseguibile non trovato: $exePath"
}
Write-Host "Eseguibile creato: $exePath" -ForegroundColor Green
# Crea la directory del servizio se non esiste
if (-not (Test-Path $ServicePath)) {
Write-Host "`nCreazione directory servizio: $ServicePath" -ForegroundColor Yellow
New-Item -ItemType Directory -Path $ServicePath -Force
}
# Copia i file nella directory del servizio
Write-Host "`nCopia file nella directory del servizio..." -ForegroundColor Yellow
Copy-Item -Path "$OutputPath\*" -Destination $ServicePath -Recurse -Force
Write-Host "File copiati in $ServicePath" -ForegroundColor Green
# Installa il servizio se richiesto
if ($InstallService) {
Write-Host "`nInstallazione del servizio Windows..." -ForegroundColor Cyan
$serviceExePath = Join-Path $ServicePath "Data_Coupler.exe"
$installScript = Join-Path $projectRoot "Scripts\install-service.ps1"
if (Test-Path $installScript) {
& $installScript -ServicePath $serviceExePath
} else {
Write-Warning "Script di installazione non trovato: $installScript"
Write-Host "Installa manualmente il servizio con:" -ForegroundColor Yellow
Write-Host "New-Service -Name 'DataCouplerService' -BinaryPathName '$serviceExePath' -StartupType Automatic" -ForegroundColor Cyan
}
}
Write-Host "`n=== Deploy completato con successo! ===" -ForegroundColor Green
Write-Host "Directory pubblicazione: $OutputPath" -ForegroundColor Cyan
Write-Host "Directory servizio: $ServicePath" -ForegroundColor Cyan
if ($InstallService) {
Write-Host "URL applicazione: http://localhost:7550" -ForegroundColor Magenta
} else {
Write-Host "Per installare il servizio, esegui con -InstallService" -ForegroundColor Yellow
}
}
catch {
Write-Error "Errore durante il deploy: $($_.Exception.Message)"
exit 1
}
finally {
# Torna alla directory originale
Pop-Location -ErrorAction SilentlyContinue
}