-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathue-blueprint-recompile.ps1
102 lines (82 loc) · 3.23 KB
/
ue-blueprint-recompile.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
101
102
# Blueprint bulk recompile helper
[CmdletBinding()] # Fail on unknown args
param (
# Optional source folder, assumed current folder
[string]$src,
# Optional subfolder of Content to parse, default "Blueprints"
[string]$bpdir = "Blueprints",
# Dry-run; does nothing but report what *would* have happened
[switch]$dryrun = $false,
[switch]$help = $false
)
. $PSScriptRoot\inc\platform.ps1
. $PSScriptRoot\inc\packageconfig.ps1
. $PSScriptRoot\inc\projectversion.ps1
. $PSScriptRoot\inc\uproject.ps1
. $PSScriptRoot\inc\filetools.ps1
# Include Git tools locking
. $PSScriptRoot\GitScripts\inc\locking.ps1
function Write-Usage {
Write-Output "Steve's Unreal Blueprint recompile tool"
Write-Output "Usage:"
Write-Output " ue-blueprint-recompile.ps1 [-src:sourcefolder] [-bpdir:blueprintdir] [-dryrun]"
Write-Output " "
Write-Output " -src : Source folder (current folder if omitted)"
Write-Output " -bpdir : Path to Blueprints relative to your Content dir, defaults to 'Blueprints'"
Write-Output " -dryrun : Don't perform any actual actions, just report on what you would do"
Write-Output " -help : Print this help"
Write-Output " "
Write-Output "Environment Variables:"
Write-Output " UEINSTALL : Use a specific UE install."
Write-Output " : Default is to find one based on project version, under UEROOT"
Write-Output " UEROOT : Parent folder of all binary Unreal installs (detects version). "
Write-Output " : Default C:\Program Files\Epic Games"
Write-Output " "
}
if ($src.Length -eq 0) {
$src = "."
Write-Verbose "-src not specified, assuming current directory"
}
$ErrorActionPreference = "Stop"
if ($help) {
Write-Usage
Exit 0
}
Write-Output "~-~-~ Unreal Blueprint Recompile Start ~-~-~"
try {
$config = Read-Package-Config -srcfolder:$src
$projfile = Get-Uproject-Filename -srcfolder:$src -config:$config
$proj = Read-Uproject $projfile
$ueVersion = Get-UE-Version $proj
$ueinstall = Get-UE-Install $ueVersion
Write-Output ""
Write-Output "Project File : $projfile"
Write-Output "UE Version : $ueVersion"
Write-Output "UE Install : $ueinstall"
Write-Output "Blueprint Dir : Content/$bpdir"
Write-Output ""
$bpfullpath = Join-Path $src "Content/$bpdir" -Resolve
$argList = [System.Collections.ArrayList]@()
$argList.Add("`"$projfile`"") > $null
$argList.Add("-run=ResavePackages") > $null
$argList.Add("-packagefolder=`"$bpfullpath`"") > $null
$argList.Add("-autocheckout") > $null
$ueEditorCmd = Get-UEEditorCmd $ueVersion $ueinstall
if ($dryrun) {
Write-Output "Would have run:"
Write-Output "> $ueEditorCmd $($argList -join " ")"
} else {
$proc = Start-Process $ueEditorCmd $argList -Wait -PassThru -NoNewWindow
if ($proc.ExitCode -ne 0) {
throw "Blueprint recompile build failed!"
}
}
} catch {
Write-Output $_.Exception.Message
Write-Output "~-~-~ Unreal Blueprint Recompile FAILED ~-~-~"
Exit 9
}
Write-Output "~-~-~ Unreal Blueprint Recompile OK ~-~-~"
if (!$dryrun) {
Write-Output "Reminder: You may need to commit and unlock Blueprint files"
}