F0: fondamenta della soluzione, script, documenti e harness di test
- ViaFerrea.sln con Core e Protocol (net10.0 + net8.0), Server, Tools, Tests - Directory.Build.props con versione unica e warning come errori - Script build/test/check-nuget/publish-image (+ build.ps1) - Documenti: GUIDA, GDD, ARCHITECTURE, PROTOCOL (bozza), STATE, ADR 0001 - Harness di test interno con i primi test su Rng (xoshiro256**) - Immagini di riferimento 01-05 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
This commit is contained in:
36 files changed
+1647
-2
No files matched your search
@@ -0,0 +1,34 @@
|
||||
# Compila la soluzione su Windows (equivalente di scripts/build.sh).
|
||||
# Uso: ./scripts/build.ps1 [-Configuration Release] [-Client]
|
||||
param(
|
||||
[string]$Configuration = "Release",
|
||||
[switch]$Client,
|
||||
[switch]$Test
|
||||
)
|
||||
$ErrorActionPreference = "Stop"
|
||||
Set-Location (Join-Path $PSScriptRoot "..")
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = "1"
|
||||
$env:DOTNET_NOLOGO = "1"
|
||||
|
||||
# Regola: zero pacchetti NuGet fuori dal client Godot.
|
||||
$bad = Get-ChildItem -Recurse -Include *.csproj,*.props,*.targets |
|
||||
Where-Object { $_.FullName -notmatch '[\\/](client|bin|obj|\.git)[\\/]' } |
|
||||
Where-Object { Select-String -Path $_.FullName -Pattern '<PackageReference|<PackageVersion|<GlobalPackageReference' -Quiet }
|
||||
if ($bad) { $bad | ForEach-Object { Write-Error "Pacchetto NuGet in $($_.FullName)" }; exit 1 }
|
||||
|
||||
dotnet build ViaFerrea.sln -c $Configuration -nologo -v minimal
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
if ($Test) {
|
||||
dotnet run --project tests/ViaFerrea.Tests -c $Configuration --no-build
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
}
|
||||
|
||||
if ($Client) {
|
||||
# Il server locale viene pubblicato dentro la cartella del client esportato.
|
||||
dotnet publish src/ViaFerrea.Server -c $Configuration -r win-x64 --self-contained true -o client/ViaFerrea.Client/export/windows/server
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
dotnet build client/ViaFerrea.Client/ViaFerrea.Client.csproj -c $Configuration
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
}
|
||||
Write-Host "build: ok ($Configuration)"
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Compila l'intera soluzione (Release per default) dopo il controllo dei pacchetti.
|
||||
# Uso: scripts/build.sh [Debug|Release]
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
config="${1:-Release}"
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1 DOTNET_NOLOGO=1
|
||||
|
||||
scripts/check-nuget.sh
|
||||
dotnet build ViaFerrea.sln -c "$config" -nologo -v minimal
|
||||
echo "build: ok ($config)"
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# Fallisce se un progetto .NET della soluzione contiene un PackageReference (regola: zero NuGet).
|
||||
# Il client Godot è escluso: il suo SDK è l'unica dipendenza esterna ammessa.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
found=0
|
||||
while IFS= read -r -d '' f; do
|
||||
if grep -qiE '<PackageReference|<PackageVersion|<GlobalPackageReference' "$f"; then
|
||||
echo "ERRORE: riferimento a pacchetto NuGet in $f" >&2
|
||||
grep -niE '<PackageReference|<PackageVersion|<GlobalPackageReference' "$f" >&2
|
||||
found=1
|
||||
fi
|
||||
done < <(find . \( -path ./client -o -path ./.git -o -name bin -o -name obj \) -prune -o \
|
||||
\( -name '*.csproj' -o -name '*.props' -o -name '*.targets' \) -print0)
|
||||
|
||||
if [ -f packages.config ] || [ -f Directory.Packages.props ]; then
|
||||
echo "ERRORE: gestione centralizzata dei pacchetti non ammessa" >&2
|
||||
found=1
|
||||
fi
|
||||
|
||||
if [ "$found" -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
echo "check-nuget: nessun pacchetto NuGet"
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# Costruisce l'immagine Docker del server con il tag della versione (da Directory.Build.props)
|
||||
# e "latest", poi la pubblica sul registry Gitea.
|
||||
# Uso: VF_REGISTRY=gitea.lan:3000/utente scripts/publish-image.sh [--no-push]
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
version="$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' Directory.Build.props | head -n1)"
|
||||
if [ -z "$version" ]; then
|
||||
echo "ERRORE: versione non trovata in Directory.Build.props" >&2
|
||||
exit 1
|
||||
fi
|
||||
registry="${VF_REGISTRY:-}"
|
||||
name="via-ferrea-server"
|
||||
image="${registry:+$registry/}$name"
|
||||
|
||||
docker build -f docker/Dockerfile -t "$image:$version" -t "$image:latest" .
|
||||
echo "immagine: $image:$version"
|
||||
|
||||
if [ "${1:-}" = "--no-push" ]; then
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "$registry" ]; then
|
||||
echo "VF_REGISTRY non impostato: immagine solo locale (usa --no-push per non vedere questo avviso)" >&2
|
||||
exit 0
|
||||
fi
|
||||
docker push "$image:$version"
|
||||
docker push "$image:latest"
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Esegue la validazione dei dati e tutti i test con l'harness interno.
|
||||
# Uso: scripts/test.sh [filtri...] [--skip-slow] [--serial]
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1 DOTNET_NOLOGO=1
|
||||
|
||||
scripts/check-nuget.sh
|
||||
dotnet build ViaFerrea.sln -c Release -nologo -v quiet
|
||||
if [ -f src/ViaFerrea.Tools/Commands/ValidateDataCommand.cs ]; then
|
||||
dotnet run --project src/ViaFerrea.Tools -c Release --no-build -- validate-data --data data
|
||||
fi
|
||||
dotnet run --project tests/ViaFerrea.Tests -c Release --no-build -- "$@"
|
||||
Reference in new issue
Block a user