mirror of
https://github.com/sinbad/UEScripts.git
synced 2025-02-23 13:15:23 +00:00
Actually building for Development Editor mode
This commit is contained in:
parent
a190a9b07e
commit
a9f604aa1a
@ -69,12 +69,13 @@ try {
|
|||||||
throw "Multiple Unreal project files found in $(Get-Location)! Aborting."
|
throw "Multiple Unreal project files found in $(Get-Location)! Aborting."
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Output "Building $uprojfile for $mode"
|
# In PS 6.0+ we could use Split-Path -LeafBase but let's stick with built-in PS 5.1
|
||||||
|
$uprojname = [System.IO.Path]::GetFileNameWithoutExtension($uprojfile)
|
||||||
|
Write-Output "Building $uprojname for $mode"
|
||||||
|
|
||||||
# Check version number of UE4 project so we know which version to run
|
# Check version number of UE4 project so we know which version to run
|
||||||
# We can read this from .uproject which is JSON
|
# We can read this from .uproject which is JSON
|
||||||
$uproject = Get-Content $uprojfile | ConvertFrom-Json
|
$uproject = Get-Content $uprojfile | ConvertFrom-Json
|
||||||
|
|
||||||
$uversion = $uproject.EngineAssociation
|
$uversion = $uproject.EngineAssociation
|
||||||
|
|
||||||
# UE4INSTALL env var should point at the root of the *specific version* of
|
# UE4INSTALL env var should point at the root of the *specific version* of
|
||||||
@ -92,29 +93,70 @@ try {
|
|||||||
$uinstall = Join-Path $uroot "UE_$uversion"
|
$uinstall = Join-Path $uroot "UE_$uversion"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test we can find RunUAT.bat
|
# Test we can find Build.bat
|
||||||
$uat = Join-Path "$uinstall" "Engine\Build\BatchFiles\RunUAT.bat"
|
$batchfolder = Join-Path "$uinstall" "Engine\Build\BatchFiles"
|
||||||
if (-not (Test-Path $uat -PathType Leaf)) {
|
$buildbat = Join-Path "$batchfolder" "Build.bat"
|
||||||
throw "Unreal Automation Tool doesn't exist at $uat : Aborting"
|
if (-not (Test-Path $buildbat -PathType Leaf)) {
|
||||||
|
throw "Build.bat missing at $buildbat : Aborting"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Verbose "Running $uat"
|
|
||||||
|
|
||||||
|
|
||||||
# Close UE4 as early as possible
|
# Close UE4 as early as possible
|
||||||
# if (-not $dryrun -and -not $nocloseeditor) {
|
if (-not $nocloseeditor) {
|
||||||
# # Check if Unity is running, if so try to shut it gracefully
|
# Check if UE4 is running, if so try to shut it gracefully
|
||||||
# $ue4proc = Get-Process UE4Editor | Where-Object {$_.MainWindowTitle -like "ue4localise*" }
|
# Filter by project name in main window title, it's always called "Project - Unreal Editor"
|
||||||
# if ($ue4proc) {
|
$ue4proc = Get-Process UE4Editor -ErrorAction SilentlyContinue | Where-Object {$_.MainWindowTitle -like "$uprojname*" }
|
||||||
# Write-Output "UE4 is currently running, trying to gracefully shut window "
|
if ($ue4proc) {
|
||||||
# $ue4proc.CloseMainWindow()
|
if ($dryrun) {
|
||||||
# Start-Sleep 5
|
Write-Output "UE4 project is currently open in editor, would have closed"
|
||||||
# if (!$ue4proc.HasExited) {
|
} else {
|
||||||
# throw "Couldn't close UE4 gracefully, aborting!"
|
Write-Output "UE4 project is currently open in editor, closing..."
|
||||||
# }
|
$ue4proc.CloseMainWindow() > $null
|
||||||
# }
|
Start-Sleep 5
|
||||||
# Remove-Variable ue4proc
|
if (!$ue4proc.HasExited) {
|
||||||
# }
|
throw "Couldn't close UE4 gracefully, aborting!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Verbose "UE4 project is not open in editor"
|
||||||
|
}
|
||||||
|
Remove-Variable ue4proc
|
||||||
|
}
|
||||||
|
|
||||||
|
$buildargs = ""
|
||||||
|
|
||||||
|
switch ($mode) {
|
||||||
|
'dev' {
|
||||||
|
# Stolen from the VS project settings because boy is this badly documented
|
||||||
|
# Target needs "Editor" on the end to make this "Development Editor"
|
||||||
|
# The -Project seems to be needed, as is the -FromMsBuild
|
||||||
|
# -Project has to point at the ABSOLUTE PATH of the uproject
|
||||||
|
$uprojfileabs = Join-Path "$(Get-Location)" $uprojfile
|
||||||
|
$buildargs = "${uprojname}Editor Win64 Development -Project=`"${uprojfileabs}`" -WaitMutex -FromMsBuild"
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
# TODO
|
||||||
|
# We probably want to use custom launch profiles for this
|
||||||
|
Write-Output "Mode '$mode' is not supported yet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($dryrun) {
|
||||||
|
Write-Output "Would run: build.bat $buildargs"
|
||||||
|
} else {
|
||||||
|
Write-Verbose "Running $buildbat $buildargs"
|
||||||
|
$process = (Start-Process $buildbat -ArgumentList $buildargs -PassThru)
|
||||||
|
# Spinwait since -Wait doesn't seem to work?
|
||||||
|
do {
|
||||||
|
Write-Host "." -NoNewline
|
||||||
|
start-sleep -Milliseconds 1000
|
||||||
|
} until ($process.HasExited)
|
||||||
|
|
||||||
|
if ($process.ExitCode -ne 0) {
|
||||||
|
$code = $process.ExitCode
|
||||||
|
throw "*** Build exited with code $code, see above"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Try to locate RunUAT.bat so we don't have to add UE4 version to PATH
|
# Try to locate RunUAT.bat so we don't have to add UE4 version to PATH
|
||||||
|
Loading…
x
Reference in New Issue
Block a user