Files
UnrealEngineUWP/Engine/Build/BatchFiles/RunUAT.sh
Joakim Lindqvist e7039d3d35 UBT and UAT now use .NET Core instead of Framework and Mono. This means that we use the same runtime on Windows, Linux and Mac. Further benefits including newer C# features and a lot of intresting features for the future around AOT and Tiered compilation.
Some behavior changes:
Output paths - Both tools are now output to a subdirectory of Binaries/Dotnet, I believe most hardcoded paths have been fixed up but there may be tools that will fail because of this.
UAT Plugin Building - As .NET Core does not support AppDomain unloading, how we build the plugins has changed quite a bit, these are now built before UAT is started rather then by UAT itself. If you just start UAT via RunUAT.bat/sh this should just continue to work.

#rb ben.marsh

[CL 14834347 by Joakim Lindqvist in ue5-main branch]
2020-12-02 06:57:13 -04:00

133 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
## Copyright Epic Games, Inc. All Rights Reserved.
##
## Unreal Engine 4 AutomationTool setup script
##
## This script is expecting to exist in the UE4/Engine/Build/BatchFiles directory. It will not work
## correctly if you copy it to a different location and run it.
echo
echo Running AutomationTool...
echo
TermHandler() {
GPID=$(ps -o pgid= $UATPid)
kill -TERM -$GPID 2> /dev/null
}
# loop over the arguments, quoting spaces to pass to UAT proper
Args=
i=0
for Arg in "$@"
do
# replace all ' ' with '\ '
# DISABLED UNTIL FURTHER INVESTIGATION - IT SEEMS IT WASN'T NEEDED AFTER ALL
# NewArg=${Arg// /\\ }
NewArg=$Arg
# append it to the array
Args[i]=$NewArg
# move to next array entry
i=$((i+1))
done
# put ourselves into Engine directory (two up from location of this script)
SCRIPT_DIR=$(cd "`dirname "$0"`" && pwd)
cd "$SCRIPT_DIR/../.."
UATDirectory=Binaries/DotNET/
UATCompileArg=-compile
if [ ! -f Build/BatchFiles/RunUAT.sh ]; then
echo "RunUAT ERROR: The script does not appear to be located in the "
echo "Engine/Build/BatchFiles directory. This script must be run from within that directory."
exit 1
fi
# see if we have the no compile arg
if echo "${Args[@]}" | grep -q -w -i "\-nocompile"; then
UATCompileArg=
else
UATCompileArg=-compile
fi
if [ -f Build/InstalledBuild.txt ]; then
UATCompileArg=
fi
EnvironmentType=-dotnet
UATDirectory=Binaries/DotNET/AutomationTool
if [ "$(uname)" = "Darwin" ]; then
# Setup Environment
source "$SCRIPT_DIR/Mac/SetupEnvironment.sh" $EnvironmentType "$SCRIPT_DIR/Mac"
fi
if [ "$(uname)" = "Linux" ]; then
# Setup Environment
source "$SCRIPT_DIR/Linux/SetupEnvironment.sh" $EnvironmentType "$SCRIPT_DIR/Linux"
fi
if [ "$UATCompileArg" = "-compile" ]; then
# see if the .csproj exists to be compiled
if [ ! -f Source/Programs/AutomationTool/AutomationTool.csproj ]; then
echo No project to compile, attempting to use precompiled AutomationTool
UATCompileArg=
else
echo Building AutomationTool...
dotnet msbuild -restore Source/Programs/AutomationTool/AutomationTool.csproj /property:Configuration=Development /property:AutomationToolProjectOnly=true /verbosity:quiet /nodeReuse:false /p:UseSharedCompilation=false
if [ $? -ne 0 ]; then
echo RunUAT ERROR: AutomationTool failed to compile.
exit 1
fi
echo Building AutomationTool Plugins...
dotnet msbuild -restore Source/Programs/AutomationTool/AutomationTool.proj /property:Configuration=Development /verbosity:quiet /nodeReuse:false /p:UseSharedCompilation=false
if [ $? -ne 0 ]; then
echo RunUAT ERROR: AutomationTool plugins failed to compile.
exit 1
fi
fi
fi
## Run AutomationTool
#run UAT
cd $UATDirectory
if [ -z "$uebp_LogFolder" ]; then
LogDir="$HOME/Library/Logs/Unreal Engine/LocalBuildLogs"
else
LogDir="$uebp_LogFolder"
fi
# if we are running under UE, we need to run this with the term handler (otherwise canceling a UAT job from the editor
# can leave mono, etc running in the background, which means we need the PID so we
# run it in the background
if [ "$UE_DesktopUnrealProcess" = "1" ]; then
# you can't set a dotted env var nicely in sh, but env will run a command with
# a list of env vars set, including dotted ones
echo Start UAT Non-Interactively: ./AutomationTool "${Args[@]}"
trap TermHandler SIGTERM SIGINT
env uebp_LogFolder="$LogDir" ./AutomationTool "${Args[@]}" &
UATPid=$!
wait $UATPid
else
# you can't set a dotted env var nicely in sh, but env will run a command with
# a list of env vars set, including dotted ones
echo Start UAT Interactively: ./AutomationTool "${Args[@]}"
env uebp_LogFolder="$LogDir" ./AutomationTool "${Args[@]}"
fi
UATReturn=$?
# @todo: Copy log files to somewhere useful
# if not "%uebp_LogFolder%" == "" copy log*.txt %uebp_LogFolder%\UAT_*.*
# if "%uebp_LogFolder%" == "" copy log*.txt c:\LocalBuildLogs\UAT_*.*
#cp log*.txt /var/log
if [ $UATReturn -ne 0 ]; then
echo RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: $UATReturn
exit $UATReturn
fi