-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildServer.ps1
100 lines (86 loc) · 2.59 KB
/
BuildServer.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env pwsh
#Requires -Version 5
param([Parameter(Mandatory=$true)][string]$FolderName, [Parameter(Mandatory=$true)][string] $ProjectName, [Parameter(Mandatory=$true)] $EnginePath, [switch][bool]$Deploy)
$process = $null
trap {
if ($process -ne $null -and -not $process.HasExited) {
$process.Kill();
}
Write-Error $_
exit 1
}
$ProjectRoot = (Resolve-Path -Path (Join-Path $PSScriptRoot "..")).Path
Write-Host ">> INFO: Using Unreal Engine located at '$EnginePath'"
function Wait-For-Process-Exit($Process) {
while (!$Process.HasExited) {
Start-Sleep -Seconds 1
}
}
$ErrorActionPreference = "Stop"
$cwd = Get-Location
Write-Host ">> STEP: Clean output"
if (Test-Path "$ProjectRoot\$FolderName\OutputServer") {
Remove-Item -Recurse -Force "$ProjectRoot\$FolderName\OutputServer"
}
New-Item -ItemType Directory "$ProjectRoot\$FolderName\OutputServer"
Write-Host ">> STEP: Build editor"
Set-Content -Value "" -Path "$ProjectRoot\AgonesResources\Empty.txt"
$process = Start-Process `
-FilePath "$EnginePath\Engine\Binaries\DotNET\UnrealBuildTool.exe" `
-ArgumentList @(
"Development",
"Win64",
"-Project=`"$ProjectRoot\$FolderName\$ProjectName.uproject`"",
"-TargetType=Editor",
"-Progress",
"-NoHotReloadFromIDE"
) `
-NoNewWindow `
-PassThru
$handle = $process.Handle
Wait-For-Process-Exit -Process $process
if ($process.ExitCode -ne 0) {
Write-Error -Message ("General pre-build failed (got exit code: " + $process.ExitCode + ")!")
exit 1
}
Write-Host ">> STEP: Build server (Development)"
$process = Start-Process `
-FilePath "$EnginePath\Engine\Build\BatchFiles\RunUAT.bat" `
-ArgumentList @(
"BuildCookRun",
"-project=$ProjectRoot\$FolderName\$ProjectName.uproject",
"-noP4",
"-platform=Win64",
"-clientconfig=Development",
"-serverconfig=Development",
"-cook",
"-server",
"-serverplatform=Linux",
"-noclient",
"-allmaps",
"-build",
"-stage",
"-pak",
"-archive",
"-archivedirectory=$ProjectRoot\$FolderName\OutputServer",
"-unattended"
) `
-NoNewWindow `
-PassThru `
-RedirectStandardInput "$ProjectRoot\AgonesResources\Empty.txt"
$handle = $process.Handle
Wait-For-Process-Exit -Process $process
if ($process.ExitCode -ne 0) {
Write-Error -Message "General build failed!"
exit 1
}
if ($Deploy) {
Push-Location $PSScriptRoot
try {
& skaffold run
} finally {
Pop-Location
}
}
Write-Host ">> STEP: All done!"
exit 0