Files

23 lines
2.2 KiB
PowerShell

param([string]$CMake='')
$ErrorActionPreference='Stop'
$root=(Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
if(-not $CMake){$CMake='C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe'}
$proofRoot=Join-Path $root 'Builds/IndependentCoreProof'
New-Item -ItemType Directory -Force $proofRoot | Out-Null
# Only the portable source tree is present. No Source/, .uproject, UHT or UBT is copied.
Copy-Item -LiteralPath (Join-Path $root 'gameFramework') -Destination $proofRoot -Recurse -Force
$removed=@()
Get-ChildItem Env: | Where-Object {$_.Name -match '^(UE_|UNREAL|UBT)'} | ForEach-Object {$removed+=$_.Name;Remove-Item -LiteralPath ('Env:'+$_.Name)}
& $CMake -S (Join-Path $proofRoot 'gameFramework') -B (Join-Path $proofRoot 'build') -G 'Visual Studio 17 2022' -A x64
if($LASTEXITCODE -ne 0){throw 'Independent configure failed'}
& $CMake --build (Join-Path $proofRoot 'build') --config Release --parallel 2
if($LASTEXITCODE -ne 0){throw 'Independent compilation failed'}
& (Join-Path (Split-Path $CMake) 'ctest.exe') --test-dir (Join-Path $proofRoot 'build') -C Release --output-on-failure
if($LASTEXITCODE -ne 0){throw 'Independent CTest failed'}
& (Join-Path $proofRoot 'build/Release/gameFrameworkTests.exe') (Join-Path $root 'Docs/QA/UE-Migration/independent-tests.json')
if($LASTEXITCODE -ne 0){throw 'Independent behavioral tests failed'}
$dependencyFiles=Get-ChildItem (Join-Path $proofRoot 'build') -Recurse -Filter 'CL.read.1.tlog'
$engineDependencies=@($dependencyFiles | Select-String -Pattern 'EPIC GAMES','UNREALENGINE','ENGINE\SOURCE' -SimpleMatch)
if($engineDependencies.Count){throw 'Unexpected engine dependency in compiler trace'}
[ordered]@{passed=$true;sourceTree=(Join-Path $proofRoot 'gameFramework');configuration='VS2022 x64 C++20 /MD Release';removedEngineEnvironmentNames=$removed;compilerDependencyTraces=$dependencyFiles.Count;engineDependencies=0;scope='Copied core-only tree, engine variables removed, CMake/MSVC/CTest only. UE remains installed on this workstation; no claim of a second clean machine.'} | ConvertTo-Json -Depth 5 | Set-Content -Encoding utf8 (Join-Path $root 'Docs/QA/UE-Migration/independent-build.json')