Files
UnrealEngineUWP/Engine/Build/BatchFiles/RunUAT.sh
Wes Hunt 7fa290bb33 Summary: running UAT from VS is simpler and faster.
UEB-261 - Ensure that compiling AutomationTool in VS will compile all other Automation Projects
* Just set AutomationTool as your startup project and pass the command to execute.
* VS will build the script modules at build time, instead of every time at runtime.
* To make this happen, "UBT.exe -ProjectFiles" now generates a companion AutomationTool.csproj.References that make AutomationTool depend on all Automation modules.
* AutomationTool.exe defaults to not building script modules at runtime. Pass -compile if you want to dynamically build them.
* Without the .references file, AutomationTool will only build itself and you will need to pass -compile.
* RunUAT.bat still works that same, defaulting to runtime compilation and supporting -nocompile flag. It then passes -compile (or nothing) to AutomationTool.

Other
* All Automation projects target .Net 4.5. Some already were and had hard dependencies on them (Rocket and SyncGithub -> Octokit). Now that AutomationTool directly depends on them, everything had to use .Net 4.5.
* Decoupled logic for -NoCompile and -NoCompileEditor. The flags are still confusing, but -NoCompile is no longer linked to -NoCompileEditor.
* Had to leave in stub support in UAT for -NoCompile else RunUAT.bat passes it along and UAT complains that it doesn't understand it.
* Added a CommandUtils.Run option to support run command, but still output the run duration.
* Reduced the verbosity when UAT.proj is run from dozens of lines per module to a single Module -> Output line. It was looking like there were problems, but it was just msbuild spew.
#codereview:ben.marsh

[CL 2615060 by Wes Hunt in Main branch]
2015-07-09 10:15:37 -04:00

109 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
## Copyright 1998-2015 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
# 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 -i "\-nocompile"; then
UATCompileArg=
else
UATCompileArg=-compile
fi
if [ "$(uname)" = "Darwin" ]; then
# Setup Mono
source "`dirname "$0"`/Mac/SetupMono.sh" "`dirname "$0"`/Mac"
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
if [ -f "$UATDirectory/AutomationTool.exe" ]; then
echo AutomationTool exists: Deleting
rm -f $UATDirectory/AutomationTool.exe
if [ -d "$UATDirectory/AutomationScripts" ]; then
echo Deleting all AutomationScript dlls
rm -rf $UATDirectory/AutomationScripts
fi
fi
echo Compiling AutomationTool with xbuild
ARGS="/p:Configuration=Development /p:Platform=AnyCPU /verbosity:quiet /nologo"
ARGS="${ARGS} /p:TargetFrameworkProfile="
echo "xbuild Source/Programs/AutomationTool/AutomationTool.csproj $ARGS"
xbuild Source/Programs/AutomationTool/AutomationTool.csproj $ARGS
# make sure it succeeded
if [ $? -ne 0 ]; then
echo RunUAT ERROR: AutomationTool failed to compile.
exit 1
else
echo Compilation Succeeded
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
# 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: mono AutomationTool.exe "${Args[@]}"
env uebp_LogFolder="$LogDir" mono AutomationTool.exe "${Args[@]}" $UATCompileArg
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.
exit $UATReturn
fi