Files
UnrealEngineUWP/Engine/Build/BatchFiles/RunUAT.bat
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

122 lines
3.6 KiB
Batchfile

@echo off
setlocal
echo Running AutomationTool...
rem ## Unreal Engine 4 AutomationTool setup script
rem ## Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
rem ## This script is expecting to exist in the UE4/Engine/Build/BatchFiles directory. It will not work correctly
rem ## if you copy it to a different location and run it.
set UATExecutable=AutomationToolLauncher.exe
set UATDirectory=Binaries\DotNET\
set UATCompileArg=-compile
rem ## Change the CWD to /Engine.
pushd %~dp0..\..\
if not exist Build\BatchFiles\RunUAT.bat goto Error_BatchFileInWrongLocation
rem ## Use the pre-compiled UAT scripts if -nocompile is specified in the command line
for %%P in (%*) do if /I "%%P" == "-nocompile" goto RunPrecompiled
rem ## check for force precompiled
if not "%ForcePrecompiledUAT%"=="" goto RunPrecompiled
if not exist Source\Programs\AutomationTool\AutomationTool.csproj goto RunPrecompiled
if not exist Source\Programs\AutomationToolLauncher\AutomationToolLauncher.csproj goto RunPrecompiled
rem ## Check to see if we're already running under a Visual Studio environment shell
if not "%INCLUDE%" == "" if not "%LIB%" == "" goto ReadyToCompile
echo path="%path%"
rem ## Check for Visual Studio 2013
pushd %~dp0
call GetVSComnToolsPath 12
popd
if "%VsComnToolsPath%" == "" goto NoVisualStudio2013Environment
call "%VsComnToolsPath%/../../VC/bin/x86_amd64/vcvarsx86_amd64.bat" >NUL
goto ReadyToCompile
rem ## Check for Visual Studio 2012
:NoVisualStudio2013Environment
pushd %~dp0
call GetVSComnToolsPath 11
popd
if "%VsComnToolsPath%" == "" goto RunPrecompiled
call "%VsComnToolsPath%/../../VC/bin/x86_amd64/vcvarsx86_amd64.bat" >NUL
goto ReadyToCompile
rem ## ok, well it doesn't look like visual studio is installed, let's try running the precompiled one.
:RunPrecompiled
if not exist Binaries\DotNET\AutomationTool.exe goto Error_NoFallbackExecutable
set UATCompileArg=
if not exist Binaries\DotNET\AutomationToolLauncher.exe set UATExecutable=AutomationTool.exe
goto DoRunUAT
:ReadyToCompile
msbuild /nologo /verbosity:quiet Source\Programs\AutomationToolLauncher\AutomationToolLauncher.csproj /property:Configuration=Development /property:Platform=AnyCPU
if not %ERRORLEVEL% == 0 goto Error_UATCompileFailed
msbuild /nologo /verbosity:quiet Source\Programs\AutomationTool\AutomationTool.csproj /property:Configuration=Development /property:Platform=AnyCPU
if not %ERRORLEVEL% == 0 goto Error_UATCompileFailed
rem ## Run AutomationTool
:DoRunUAT
pushd %UATDirectory%
%UATExecutable% %* %UATCompileArg%
if not %ERRORLEVEL% == 0 goto Error_UATFailed
popd
rem ## Success!
goto Exit
:Error_BatchFileInWrongLocation
echo RunUAT.bat ERROR: The batch file does not appear to be located in the /Engine/Build/BatchFiles directory. This script must be run from within that directory.
goto Exit_Failure
:Error_NoVisualStudioEnvironment
echo RunUAT.bat ERROR: A valid version of Visual Studio 2013 or Visual Studio 2012 does not appear to be installed.
goto Exit_Failure
:Error_NoFallbackExecutable
echo RunUAT.bat ERROR: Visual studio and/or AutomationTool.csproj was not found, nor was Engine\Binaries\DotNET\AutomationTool.exe. Can't run the automation tool.
goto Exit_Failure
:Error_UATCompileFailed
echo RunUAT.bat ERROR: AutomationTool failed to compile.
goto Exit_Failure
:Error_UATFailed
echo copying UAT log files...
if not "%uebp_LogFolder%" == "" copy log*.txt %uebp_LogFolder%\UAT_*.*
rem if "%uebp_LogFolder%" == "" copy log*.txt c:\LocalBuildLogs\UAT_*.*
popd
echo RunUAT.bat ERROR: AutomationTool was unable to run successfully.
goto Exit_Failure
:Exit_Failure
echo BUILD FAILED
popd
exit /B %ERRORLEVEL%
:Exit
rem ## Restore original CWD in case we change it
popd
exit /B 0