80 lines
3 KiB
PowerShell
80 lines
3 KiB
PowerShell
|
|
<#
|
||
|
|
.SYNOPSIS
|
||
|
|
Empaquette LifePlay en DebugGame ou Development et depose les lanceurs de session.
|
||
|
|
|
||
|
|
.DESCRIPTION
|
||
|
|
N'utilise jamais -nodebuginfo : les PDB du projet sont recopies dans l'archive
|
||
|
|
(IncludeDebugFiles reste False dans DefaultGame.ini, le Shipping n'est pas touche).
|
||
|
|
Les .bat de Tools\debug sont copies a cote de Windows\LifePlay.exe.
|
||
|
|
|
||
|
|
.EXAMPLE
|
||
|
|
.\Tools\BuildDebug.ps1
|
||
|
|
.\Tools\BuildDebug.ps1 -Config Development
|
||
|
|
.\Tools\BuildDebug.ps1 -Config DebugGame -SkipBuild
|
||
|
|
#>
|
||
|
|
param(
|
||
|
|
[ValidateSet('DebugGame', 'Development')]
|
||
|
|
[string]$Config = 'DebugGame',
|
||
|
|
[string]$ArchiveDir = '',
|
||
|
|
[string]$UE = 'D:\Game\Launcher\Engine\UE_5.5\Engine',
|
||
|
|
[string]$ProjectRoot = (Split-Path $PSScriptRoot -Parent),
|
||
|
|
[switch]$SkipBuild
|
||
|
|
)
|
||
|
|
$ErrorActionPreference = 'Stop'
|
||
|
|
if (-not $ArchiveDir) {
|
||
|
|
$ArchiveDir = "D:\Game\LifePlay_Build_5.5_$Config"
|
||
|
|
}
|
||
|
|
|
||
|
|
$proj = Join-Path $ProjectRoot 'LifePlay.uproject'
|
||
|
|
$uat = Join-Path $UE 'Build\BatchFiles\RunUAT.bat'
|
||
|
|
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
||
|
|
$logDir = Join-Path $ProjectRoot 'Saved\Logs\portage'
|
||
|
|
New-Item -ItemType Directory -Force $logDir | Out-Null
|
||
|
|
$log = Join-Path $logDir "BuildDebug_${Config}_$stamp.log"
|
||
|
|
|
||
|
|
$buildFlag = ''
|
||
|
|
if (-not $SkipBuild) { $buildFlag = '-build ' }
|
||
|
|
|
||
|
|
# Pas de -nodebuginfo. -pak -iostore -compressed : reglages courants du projet (lot O2).
|
||
|
|
# Fichier .cmd : PowerShell couperait une ligne UAT mal quotee (meme parade que BuildMod.ps1).
|
||
|
|
$batch = [IO.Path]::ChangeExtension($log, '.cmd')
|
||
|
|
$cmd = "@call `"$uat`" BuildCookRun -project=`"$proj`" -platform=Win64 -clientconfig=$Config $buildFlag-cook -iterate -stage -pak -iostore -compressed -archive -archivedirectory=`"$ArchiveDir`" -unattended -utf8output -nop4 > `"$log`" 2>&1"
|
||
|
|
[IO.File]::WriteAllText($batch, $cmd + "`r`n@exit /b %ERRORLEVEL%`r`n", (New-Object Text.UTF8Encoding $false))
|
||
|
|
Write-Host "> $cmd"
|
||
|
|
$t0 = Get-Date
|
||
|
|
& cmd /c $batch
|
||
|
|
$code = $LASTEXITCODE
|
||
|
|
$dur = [int]((Get-Date) - $t0).TotalSeconds
|
||
|
|
Write-Host "UAT code=$code duree=${dur}s journal=$log"
|
||
|
|
if ($code -ne 0) { exit $code }
|
||
|
|
|
||
|
|
$win = Join-Path $ArchiveDir 'Windows'
|
||
|
|
$exe = Join-Path $win 'LifePlay.exe'
|
||
|
|
if (-not (Test-Path $exe)) {
|
||
|
|
$win = Join-Path $ArchiveDir 'WindowsNoEditor'
|
||
|
|
$exe = Join-Path $win 'LifePlay.exe'
|
||
|
|
}
|
||
|
|
if (-not (Test-Path $exe)) {
|
||
|
|
Write-Error "LifePlay.exe introuvable sous $ArchiveDir"
|
||
|
|
}
|
||
|
|
|
||
|
|
$batSrc = Join-Path $PSScriptRoot 'debug'
|
||
|
|
Copy-Item (Join-Path $batSrc '*.bat') $win -Force
|
||
|
|
Copy-Item (Join-Path $batSrc 'LifePlay_debug_ui.ps1') $win -Force
|
||
|
|
$staged = @(Get-ChildItem $win -Filter 'LifePlay_debug_*.bat')
|
||
|
|
Write-Host ("bats staged={0} -> {1}" -f $staged.Count, $win)
|
||
|
|
|
||
|
|
$bin = Join-Path $win 'LifePlay\Binaries\Win64'
|
||
|
|
New-Item -ItemType Directory -Force $bin | Out-Null
|
||
|
|
$pdbSrc = Join-Path $ProjectRoot 'Binaries\Win64'
|
||
|
|
$copied = 0
|
||
|
|
if (Test-Path $pdbSrc) {
|
||
|
|
Get-ChildItem $pdbSrc -Filter "*Win64-$Config.pdb" | ForEach-Object {
|
||
|
|
Copy-Item $_.FullName $bin -Force
|
||
|
|
$copied++
|
||
|
|
}
|
||
|
|
}
|
||
|
|
Write-Host "pdb copies=$copied -> $bin"
|
||
|
|
Write-Host "archive=$ArchiveDir exe=$exe"
|
||
|
|
exit 0
|