# ============================================================================== # ClassNotify P1 RC1 Clean Build from Frozen Snapshot Archive # Source Snapshot: 20260922-122540-F11B5273 # ============================================================================== $ErrorActionPreference = "Stop" $expectedArchiveSha256 = "DD791D37877FAD0B1415A50B56B1A5E320CB3D56A5F37214DF94EE660B81281A" $expectedSourceTextSha256 = "BDD5BAF1163713A84DF7FF7E4E23DA74BAA6673850F94F97562F225CE748F99C" $snapshotId = "20260922-122540-F11B5273" $root = "C:\Users\Administrator\.gemini\antigravity\scratch\ClassNotify" $archivePath = Join-Path $root "latest.zip" $cleanWorkDir = "C:\Users\Administrator\.gemini\antigravity\scratch\rc1_clean_build" $outputArtifactsDir = Join-Path $root "rc_artifacts" Write-Host "==========================================================" -ForegroundColor Cyan Write-Host " ClassNotify P1 RC1 Clean Build from Frozen Archive " -ForegroundColor Cyan Write-Host " Snapshot: $snapshotId" -ForegroundColor Cyan Write-Host "==========================================================" -ForegroundColor Cyan # Step 1: Verify Archive Integrity Write-Host "`n[1/6] Verifying latest.zip cryptographic integrity..." -ForegroundColor Yellow if (-not (Test-Path $archivePath)) { throw "Archive not found: $archivePath" } $actualArchiveHash = (Get-FileHash -Path $archivePath -Algorithm SHA256).Hash.ToUpper() if ($actualArchiveHash -ne $expectedArchiveSha256) { throw "Archive SHA256 mismatch! Expected: $expectedArchiveSha256, Got: $actualArchiveHash" } Write-Host " Archive SHA256 Verified: $actualArchiveHash" -ForegroundColor Green # Step 2: Clean extraction to fresh workspace Write-Host "`n[2/6] Extracting to clean isolated workspace: $cleanWorkDir..." -ForegroundColor Yellow if (Test-Path $cleanWorkDir) { Remove-Item $cleanWorkDir -Recurse -Force } New-Item -ItemType Directory -Path $cleanWorkDir -Force | Out-Null Expand-Archive -Path $archivePath -DestinationPath $cleanWorkDir -Force Write-Host " Extraction completed." -ForegroundColor Green # Step 3: Link/copy node_modules for web build Write-Host "`n[3/6] Setting up web dependencies..." -ForegroundColor Yellow $srcNodeModules = Join-Path $root "src\Web\ClassNotify.Web\node_modules" $destNodeModules = Join-Path $cleanWorkDir "src\Web\ClassNotify.Web\node_modules" if (Test-Path $srcNodeModules) { cmd /c mklink /J "$destNodeModules" "$srcNodeModules" Write-Host " Linked node_modules via junction: $destNodeModules" -ForegroundColor Green } else { throw "Source node_modules not found at $srcNodeModules" } # Ensure destination rc_artifacts exists if (Test-Path $outputArtifactsDir) { Remove-Item $outputArtifactsDir -Recurse -Force } New-Item -ItemType Directory -Path $outputArtifactsDir -Force | Out-Null $dotnet = "C:\Program Files\dotnet\dotnet.exe" $dotnetVersion = (& $dotnet --version).Trim() Write-Host " .NET SDK Version: $dotnetVersion" -ForegroundColor Cyan # Step 4: Build Web Assets Write-Host "`n[4/6] Building Web assets..." -ForegroundColor Yellow Push-Location (Join-Path $cleanWorkDir "src\Web\ClassNotify.Web") try { npm run build if ($LASTEXITCODE -ne 0) { throw "npm run build failed" } } finally { Pop-Location } $cleanWwwroot = Join-Path $cleanWorkDir "src\Server\ClassNotify.Server\wwwroot" $webZip = Join-Path $outputArtifactsDir "ClassNotify.Web-assets.zip" Compress-Archive -Path "$cleanWwwroot\*" -DestinationPath $webZip -CompressionLevel Optimal $webHash = (Get-FileHash -Path $webZip -Algorithm SHA256).Hash.ToUpper() $webSize = (Get-Item $webZip).Length $webSizeMb = [math]::Round($webSize / 1MB, 2) Write-Host " ClassNotify.Web-assets.zip created: $webSizeMb MB (SHA256: $webHash)" -ForegroundColor Green # Step 5: Build Server (linux-arm64 self-contained) Write-Host "`n[5/6] Building Server (linux-arm64, self-contained)..." -ForegroundColor Yellow $serverStaging = Join-Path $cleanWorkDir "server_staging" if (Test-Path $serverStaging) { Remove-Item $serverStaging -Recurse -Force } & $dotnet publish (Join-Path $cleanWorkDir "src\Server\ClassNotify.Server\ClassNotify.Server.csproj") ` -c Release -r linux-arm64 --self-contained true -o $serverStaging if ($LASTEXITCODE -ne 0) { throw "Server publish failed" } $serverTarGz = Join-Path $outputArtifactsDir "ClassNotify.Server-linux-arm64.tar.gz" Push-Location $serverStaging try { tar -czf $serverTarGz * } finally { Pop-Location } Remove-Item $serverStaging -Recurse -Force $serverHash = (Get-FileHash -Path $serverTarGz -Algorithm SHA256).Hash.ToUpper() $serverSize = (Get-Item $serverTarGz).Length $serverSizeMb = [math]::Round($serverSize / 1MB, 2) Write-Host " ClassNotify.Server-linux-arm64.tar.gz created: $serverSizeMb MB (SHA256: $serverHash)" -ForegroundColor Green # Step 6: Build Windows Binaries & Installer Write-Host "`n[6/6] Building Windows Service, Client, and Installer..." -ForegroundColor Yellow $cleanStagingDir = Join-Path $cleanWorkDir "staging" $cleanServiceStaging = Join-Path $cleanStagingDir "service" $cleanClientStaging = Join-Path $cleanStagingDir "client" $cleanPayloadStaging = Join-Path $cleanStagingDir "payload" $cleanDistDir = Join-Path $cleanWorkDir "dist" $cleanResourcesDir = Join-Path $cleanWorkDir "src\Windows\ClassNotify.Setup\Resources" $cleanPayloadZip = Join-Path $cleanResourcesDir "payload.zip" New-Item -ItemType Directory -Path $cleanServiceStaging -Force | Out-Null New-Item -ItemType Directory -Path $cleanClientStaging -Force | Out-Null New-Item -ItemType Directory -Path $cleanPayloadStaging -Force | Out-Null New-Item -ItemType Directory -Path $cleanResourcesDir -Force | Out-Null New-Item -ItemType Directory -Path $cleanDistDir -Force | Out-Null # Publish Service Write-Host " Publishing ClassNotify.Service..." -ForegroundColor Yellow & $dotnet publish (Join-Path $cleanWorkDir "src\Windows\ClassNotify.Service\ClassNotify.Service.csproj") ` -c Release -r win-x64 --self-contained true -o $cleanServiceStaging if ($LASTEXITCODE -ne 0) { throw "ClassNotify.Service publish failed" } # Publish Client Write-Host " Publishing ClassNotify.Client..." -ForegroundColor Yellow & $dotnet publish (Join-Path $cleanWorkDir "src\Windows\ClassNotify.Client\ClassNotify.Client.csproj") ` -c Release -r win-x64 --self-contained true -o $cleanClientStaging if ($LASTEXITCODE -ne 0) { throw "ClassNotify.Client publish failed" } if (Test-Path "$cleanClientStaging\runtimes\win\lib\net8.0\System.Speech.dll") { Copy-Item "$cleanClientStaging\runtimes\win\lib\net8.0\System.Speech.dll" "$cleanClientStaging\System.Speech.dll" -Force } # Assemble payload Copy-Item -Path $cleanServiceStaging -Destination (Join-Path $cleanPayloadStaging "Service") -Recurse -Force Copy-Item -Path $cleanClientStaging -Destination (Join-Path $cleanPayloadStaging "Client") -Recurse -Force if (Test-Path $cleanPayloadZip) { Remove-Item $cleanPayloadZip -Force } Compress-Archive -Path "$cleanPayloadStaging\*" -DestinationPath $cleanPayloadZip -CompressionLevel Optimal # Publish Setup Write-Host " Publishing ClassNotify.Setup..." -ForegroundColor Yellow & $dotnet publish (Join-Path $cleanWorkDir "src\Windows\ClassNotify.Setup\ClassNotify.Setup.csproj") ` -c Release -r win-x64 --self-contained true ` -p:PublishSingleFile=true ` -p:IncludeNativeLibrariesForSelfExtract=true ` -p:EnableCompressionInSingleFile=true ` -o $cleanDistDir if ($LASTEXITCODE -ne 0) { throw "ClassNotify.Setup packaging failed" } $cleanBuiltExe = Join-Path $cleanDistDir "ClassNotify.Setup.exe" $cleanFinalExe = Join-Path $cleanDistDir "ClassNotifySetup.exe" if (Test-Path $cleanBuiltExe) { Move-Item -Path $cleanBuiltExe -Destination $cleanFinalExe -Force } # Copy Windows artifacts to rc_artifacts $rcSetup = Join-Path $outputArtifactsDir "ClassNotifySetup.exe" Copy-Item $cleanFinalExe $rcSetup -Force $rcServiceExe = Join-Path $outputArtifactsDir "ClassNotify.Service.exe" Copy-Item (Join-Path $cleanServiceStaging "ClassNotify.Service.exe") $rcServiceExe -Force $rcClientExe = Join-Path $outputArtifactsDir "ClassNotify.Client.exe" Copy-Item (Join-Path $cleanClientStaging "ClassNotify.Client.exe") $rcClientExe -Force # Also update root staging so local scripts can use them $rootStagingDir = Join-Path $root "staging" if (Test-Path $rootStagingDir) { Remove-Item $rootStagingDir -Recurse -Force } Copy-Item $cleanStagingDir $rootStagingDir -Recurse -Force # Compute hashes and sizes $setupHash = (Get-FileHash -Path $rcSetup -Algorithm SHA256).Hash.ToUpper() $setupSize = (Get-Item $rcSetup).Length $setupSizeMb = [math]::Round($setupSize / 1MB, 2) $serviceExeHash = (Get-FileHash -Path $rcServiceExe -Algorithm SHA256).Hash.ToUpper() $serviceExeSize = (Get-Item $rcServiceExe).Length $serviceExeSizeMb = [math]::Round($serviceExeSize / 1MB, 2) $clientExeHash = (Get-FileHash -Path $rcClientExe -Algorithm SHA256).Hash.ToUpper() $clientExeSize = (Get-Item $rcClientExe).Length $clientExeSizeMb = [math]::Round($clientExeSize / 1MB, 2) $buildTimestamp = (Get-Date).ToString("o") $buildMachine = $env:COMPUTERNAME # Generate P1_RC1_BUILD_MANIFEST.json $buildManifestObj = [ordered]@{ releaseCandidate = "P1-RC1" sourceSnapshotId = $snapshotId sourceTextSha256 = $expectedSourceTextSha256 sourceArchiveSha256 = $expectedArchiveSha256 gitCommit = "NOT_CAPTURED" authoritativeSourceIdentity = "SnapshotId ($snapshotId) + Source SHA256 ($expectedSourceTextSha256)" commercialAcceptanceScope = "Windows Classroom Client + Web Management Console (Production Initial Release). Android Teacher App is explicitly deferred to P2 and excluded from P1 RC1 Commercial Acceptance Scope." buildSource = "Clean extraction of immutable snapshot archive latest.zip" productionSourceModified = $false buildTimestamp = $buildTimestamp buildMachine = $buildMachine dotnetSdk = $dotnetVersion artifactBaseUrl = "https://audit.paradise.eu.org/rc1/" artifacts = [ordered]@{ "ClassNotifySetup.exe" = [ordered]@{ fileName = "ClassNotifySetup.exe" description = "Windows Classroom Client & Service Installer (Single-File Self-Contained)" sizeBytes = $setupSize sizeMb = $setupSizeMb sha256 = $setupHash url = "https://audit.paradise.eu.org/rc1/ClassNotifySetup.exe" snapshotUrl = "https://audit.paradise.eu.org/snapshot/$snapshotId/ClassNotifySetup.exe" } "ClassNotify.Service.exe" = [ordered]@{ fileName = "ClassNotify.Service.exe" description = "Windows Background Management Service (win-x64 self-contained)" sizeBytes = $serviceExeSize sizeMb = $serviceExeSizeMb sha256 = $serviceExeHash url = "https://audit.paradise.eu.org/rc1/ClassNotify.Service.exe" snapshotUrl = "https://audit.paradise.eu.org/snapshot/$snapshotId/ClassNotify.Service.exe" } "ClassNotify.Client.exe" = [ordered]@{ fileName = "ClassNotify.Client.exe" description = "Windows Classroom Interactive UI Client (win-x64 self-contained)" sizeBytes = $clientExeSize sizeMb = $clientExeSizeMb sha256 = $clientExeHash url = "https://audit.paradise.eu.org/rc1/ClassNotify.Client.exe" snapshotUrl = "https://audit.paradise.eu.org/snapshot/$snapshotId/ClassNotify.Client.exe" } "ClassNotify.Server-linux-arm64.tar.gz" = [ordered]@{ fileName = "ClassNotify.Server-linux-arm64.tar.gz" description = "ClassNotify Server Production Release Tarball (linux-arm64 self-contained)" sizeBytes = $serverSize sizeMb = $serverSizeMb sha256 = $serverHash url = "https://audit.paradise.eu.org/rc1/ClassNotify.Server-linux-arm64.tar.gz" snapshotUrl = "https://audit.paradise.eu.org/snapshot/$snapshotId/ClassNotify.Server-linux-arm64.tar.gz" } "ClassNotify.Web-assets.zip" = [ordered]@{ fileName = "ClassNotify.Web-assets.zip" description = "ClassNotify Web Production Assets (React/Vite compiled SPA bundle)" sizeBytes = $webSize sizeMb = $webSizeMb sha256 = $webHash url = "https://audit.paradise.eu.org/rc1/ClassNotify.Web-assets.zip" snapshotUrl = "https://audit.paradise.eu.org/snapshot/$snapshotId/ClassNotify.Web-assets.zip" } } } $buildManifestJson = $buildManifestObj | ConvertTo-Json -Depth 6 $manifestPathLocal = Join-Path $outputArtifactsDir "P1_RC1_BUILD_MANIFEST.json" [System.IO.File]::WriteAllText($manifestPathLocal, $buildManifestJson, (New-Object System.Text.UTF8Encoding($false))) $manifestPathRoot = Join-Path $root "P1_RC1_BUILD_MANIFEST.json" [System.IO.File]::WriteAllText($manifestPathRoot, $buildManifestJson, (New-Object System.Text.UTF8Encoding($false))) Write-Host "`n==========================================================" -ForegroundColor Green Write-Host " P1 RC1 Clean Build Completed Successfully! " -ForegroundColor Green Write-Host "==========================================================" -ForegroundColor Green Write-Host "Local Manifest: $manifestPathLocal" Write-Host "ClassNotifySetup.exe: $setupHash ($setupSizeMb MB)" Write-Host "ClassNotify.Service.exe: $serviceExeHash ($serviceExeSizeMb MB)" Write-Host "ClassNotify.Client.exe: $clientExeHash ($clientExeSizeMb MB)" Write-Host "ClassNotify.Server-linux-arm64.tar.gz: $serverHash ($serverSizeMb MB)" Write-Host "ClassNotify.Web-assets.zip: $webHash ($webSizeMb MB)" Write-Host "==========================================================" -ForegroundColor Green