-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild.ps1
More file actions
130 lines (111 loc) · 4.06 KB
/
Build.ps1
File metadata and controls
130 lines (111 loc) · 4.06 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# JustLive Build Script
# Compiles the JustLive project using Unreal Engine 5.7
param(
[string]$Configuration = "Development Editor",
[string]$Platform = "Win64",
[switch]$Clean,
[switch]$Rebuild,
[switch]$HotReload,
[switch]$Open
)
$ErrorActionPreference = "Stop"
# Paths
$UE_PATH = "D:/Applications/UE_5.7"
$PROJECT_ROOT = $PSScriptRoot
$PROJECT_FILE = Join-Path $PROJECT_ROOT "JustLive.uproject"
$UBT_PATH = Join-Path $UE_PATH "Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe"
# Validate paths
if (-not (Test-Path $UE_PATH)) {
Write-Error "Unreal Engine not found at: $UE_PATH"
exit 1
}
if (-not (Test-Path $PROJECT_FILE)) {
Write-Error "Project file not found at: $PROJECT_FILE"
exit 1
}
if (-not (Test-Path $UBT_PATH)) {
Write-Error "UnrealBuildTool not found at: $UBT_PATH"
exit 1
}
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "JustLive Build Script" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Configuration: $Configuration" -ForegroundColor Yellow
Write-Host "Platform: $Platform" -ForegroundColor Yellow
Write-Host "Hot-Reload: $HotReload" -ForegroundColor Yellow
Write-Host "Project: $PROJECT_FILE" -ForegroundColor Yellow
Write-Host ""
# Clean if requested
if ($Clean -or $Rebuild) {
Write-Host "Cleaning build artifacts..." -ForegroundColor Yellow
$DirsToClean = @(
(Join-Path $PROJECT_ROOT "Binaries"),
(Join-Path $PROJECT_ROOT "Intermediate"),
(Join-Path $PROJECT_ROOT "Saved/Logs")
)
foreach ($dir in $DirsToClean) {
if (Test-Path $dir) {
Write-Host " Removing: $dir" -ForegroundColor Gray
Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue
}
}
Write-Host "Clean complete!" -ForegroundColor Green
Write-Host ""
}
# Auto-detect if Unreal Editor is running
if (-not $HotReload) {
$EditorProcess = Get-Process -Name "UnrealEditor*" -ErrorAction SilentlyContinue
if ($EditorProcess) {
Write-Host "⚠️ Unreal Editor is running - enabling HOT-RELOAD automatically" -ForegroundColor Yellow
$HotReload = $true
}
}
# Build the project
if ($HotReload) {
Write-Host "Building JustLive (HOT-RELOAD MODE - Editor can stay open)..." -ForegroundColor Yellow
} else {
Write-Host "Building JustLive (Standard build - close Editor first)..." -ForegroundColor Yellow
}
Write-Host ""
$BuildArgs = @(
"JustLiveEditor",
$Platform,
"Development",
"-Project=`"$PROJECT_FILE`"",
"-Progress",
"-MaxParallelActions=12"
)
# Add NoHotReloadFromIDE flag only if NOT doing hot-reload
if (-not $HotReload) {
$BuildArgs += "-NoHotReloadFromIDE"
}
Write-Host "Running: $UBT_PATH $($BuildArgs -join ' ')" -ForegroundColor Gray
Write-Host ""
& $UBT_PATH $BuildArgs
if ($LASTEXITCODE -eq 0) {
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "BUILD SUCCESSFUL!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
if ($HotReload) {
Write-Host "Hot-reload complete! Changes should be reflected in the Editor." -ForegroundColor Cyan
}
# Launch editor if --open flag is set
if ($Open) {
Write-Host ""
Write-Host "Launching Unreal Editor..." -ForegroundColor Cyan
$EditorPath = Join-Path $UE_PATH "Engine/Binaries/Win64/UnrealEditor.exe"
if (Test-Path $EditorPath) {
Start-Process -FilePath $EditorPath -ArgumentList "`"$PROJECT_FILE`""
Write-Host "Editor launched successfully!" -ForegroundColor Green
} else {
Write-Host "Warning: Editor executable not found at: $EditorPath" -ForegroundColor Yellow
}
}
} else {
Write-Host ""
Write-Host "========================================" -ForegroundColor Red
Write-Host "BUILD FAILED!" -ForegroundColor Red
Write-Host "========================================" -ForegroundColor Red
exit $LASTEXITCODE
}