RunUAT

RunUAT

#Overview

name: RunUAT

This variable is created as a Console Variable (cvar).

It is referenced in 10 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of RunUAT is to execute Unreal Automation Tool (UAT) commands from within the Unreal Engine editor environment. UAT is a command-line tool used for various automation tasks in Unreal Engine, such as building, cooking, and packaging projects.

RunUAT is primarily used in the TurnkeySupport module, which is part of the Editor subsystem. This module provides support for various platform-specific tasks and build processes.

The value of this function is not set as a variable, but rather it’s a method that takes parameters to execute specific UAT commands. It’s called in various contexts within the TurnkeySupport module to perform tasks such as:

  1. Preparing content for debugging
  2. Cooking and packaging projects
  3. Executing custom builds
  4. Installing SDKs
  5. Setting device auto-software updates

RunUAT interacts with several other functions and systems, including:

  1. IUATHelperModule for creating UAT tasks
  2. FProjectBuildSettings for build configurations
  3. UPlatformsMenuSettings for platform-specific settings

Developers should be aware of the following when using RunUAT:

  1. It’s only available in the editor environment (#if WITH_EDITOR)
  2. It requires proper command line parameters to execute specific tasks
  3. It can be used for platform-specific operations (iOS, tvOS, etc.)
  4. It often involves analytics events for tracking task execution

Best practices when using RunUAT include:

  1. Properly constructing command lines with all necessary parameters
  2. Handling the result callback to process the output of the UAT command
  3. Using appropriate task names and icons for better user feedback
  4. Considering platform-specific requirements when constructing commands
  5. Being aware of the potential impact on project settings and configurations

When using RunUAT, developers should ensure they have a good understanding of the specific UAT command they’re executing and its potential impact on the project.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeyEditorSupport.cpp:226

Scope (from outer to inner):

file
function     void FTurnkeyEditorSupport::RunUAT

Source code excerpt:

}

void FTurnkeyEditorSupport::RunUAT(const FString& CommandLine, const FText& PlatformDisplayName, const FText& TaskName, const FText& TaskShortName, const FSlateBrush* TaskIcon, const TArray<FAnalyticsEventAttribute>* OptionalAnalyticsParamArray, TFunction<void(FString, double)> ResultCallback)
{
#if WITH_EDITOR
	IUATHelperModule::Get().CreateUatTask(CommandLine, PlatformDisplayName, TaskName, TaskShortName, TaskIcon, OptionalAnalyticsParamArray, ResultCallback);
#else
	unimplemented();
#endif

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeyEditorSupport.h:19

Scope (from outer to inner):

file
class        class FTurnkeyEditorSupport

Source code excerpt:

	static void SaveAll();
	static bool DoesProjectHaveCode();
	static void RunUAT(const FString& CommandLine, const FText& PlatformDisplayName, const FText& TaskName, const FText& TaskShortName, const struct FSlateBrush* TaskIcon, const TArray<struct FAnalyticsEventAttribute>* OptionalAnalyticsParamArray = nullptr, TFunction<void(FString, double)> ResultCallback=TFunction<void(FString, double)>());

	static bool ShowOKCancelDialog(FText Message, FText Title);
	static void ShowRestartToast();
	static bool CheckSupportedPlatforms(FName IniPlatformName);
	static void ShowInstallationHelp(FName IniPlatformName, FString DocLink);
	static bool IsPIERunning();

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:527

Scope (from outer to inner):

file
class        class FTurnkeySupportCallbacks
function     static void CookOrPackage

Source code excerpt:

				 {
					 FString OtherCommandLine = FString::Printf(TEXT("SetSecondaryRemoteMac -platform=%s -ProjectFilePath=%s"), *IniPlatformName.ToString().ToLower(), *ProjectPath);
					 FTurnkeyEditorSupport::RunUAT(OtherCommandLine, PlatformInfo->DisplayName, ContentPrepDescription, ContentPrepTaskName, ContentPrepIcon, &AnalyticsParamArray);
				 }
				 else
				 {
					 FString CommandLine = FString::Printf(TEXT("WrangleContentForDebugging -platform=%s -ProjectFilePath=%s"), *IniPlatformName.ToString().ToLower(), *ProjectPath);
					 FTurnkeyEditorSupport::RunUAT(CommandLine, PlatformInfo->DisplayName, ContentPrepDescription, ContentPrepTaskName, ContentPrepIcon, &AnalyticsParamArray);
				 }

				 return;
             }
#elif PLATFORM_MAC
		 if (IniPlatformName == TEXT("IOS") || IniPlatformName == TEXT("TvOS"))
		 {
			 FString CommandLine = FString::Printf(TEXT("WrangleContentForDebugging -platform=%s -ProjectFilePath=%s"), *IniPlatformName.ToString().ToLower(), *ProjectPath);
			 FTurnkeyEditorSupport::RunUAT(CommandLine, PlatformInfo->DisplayName, ContentPrepDescription, ContentPrepTaskName, ContentPrepIcon, &AnalyticsParamArray);
			 return;
		 }
#endif
 		}
		else if (Mode == EPrepareContentMode::CookOnly)
		{

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:576

Scope (from outer to inner):

file
class        class FTurnkeySupportCallbacks
function     static void CookOrPackage

Source code excerpt:

		CommandLine.Appendf(TEXT("Turnkey %s BuildCookRun %s"), *TurnkeyParams, *BuildCookRunParams);

		FTurnkeyEditorSupport::RunUAT(CommandLine, PlatformInfo->DisplayName, ContentPrepDescription, ContentPrepTaskName, ContentPrepIcon, &AnalyticsParamArray);
	}

	static bool CanExecuteCustomBuild(FName IniPlatformName, FProjectBuildSettings Build)
	{
		if (GetTargetPlatformManager()->FindTargetPlatform(IniPlatformName.ToString()) == nullptr)
		{

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:661

Scope (from outer to inner):

file
class        class FTurnkeySupportCallbacks
function     static void ExecuteCustomBuild

Source code excerpt:

			CommandLine += GetLogAndReportCommandline(LogFilename, ReportFilename);

			FTurnkeyEditorSupport::RunUAT(CommandLine, PlatformInfo->DisplayName, LOCTEXT("Turnkey_GettingCommandLine", "Copying Commandline"), LOCTEXT("Turnkey_CustomTaskNameCmdLine", "CustomCommandLine"), nullptr /* TaskIcon */,
				[BuildName=Build.Name, ReportFilename](FString, double)
				{
					FString ReportContents;
					FFileHelper::LoadFileToString(ReportContents, *ReportFilename);
					UE_LOG(LogTurnkeySupport, Log, TEXT("Custom command '%s' gave commandline: %s"), *BuildName, *ReportContents);
					if (ReportContents.Len())

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:703

Scope (from outer to inner):

file
class        class FTurnkeySupportCallbacks
function     static void ExecuteCustomBuild

Source code excerpt:



			FTurnkeyEditorSupport::RunUAT(CommandLine, PlatformInfo->DisplayName, LOCTEXT("Turnkey_CustomTaskNameVerbose", "Executing Custom Build"), LOCTEXT("Turnkey_CustomTaskName", "Custom"), FAppStyle::GetBrush(TEXT("MainFrame.PackageProject")));
		}
	}

	static void SetPackageBuildConfiguration(const PlatformInfo::FTargetPlatformInfo* Info, EProjectPackagingBuildConfigurations BuildConfiguration)
	{
		UPlatformsMenuSettings* PlatformsSettings = GetMutableDefault<UPlatformsMenuSettings>();

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:892

Scope (from outer to inner):

file
function     static void TurnkeyInstallSdk

Source code excerpt:


	FText TaskName = LOCTEXT("InstallingSdk", "Installing Sdk");
	FTurnkeyEditorSupport::RunUAT(CommandLine, FText::FromString(IniPlatformName), TaskName, TaskName, FAppStyle::GetBrush(TEXT("MainFrame.PackageProject")), nullptr,
		[IniPlatformName](FString, double)
	{
		AsyncTask(ENamedThreads::GameThread, [IniPlatformName]()
		{

			// read in env var changes

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:1143

Scope (from outer to inner):

file
function     static void TurnkeySetDeviceAutoSoftwareUpdates

Source code excerpt:


	FText TaskName = LOCTEXT("SetDeviceAutoSoftwareUpdates", "Set device auto software updates");
	FTurnkeyEditorSupport::RunUAT(CommandLine, FText::FromString(PlatformName), TaskName, TaskName, FAppStyle::GetBrush(TEXT("MainFrame.PackageProject")), nullptr,
		[DeviceId](FString, double)
		{
			ITurnkeySupportModule::Get().UpdateSdkInfoForDevices(TArray<FString>{DeviceId});
		});	
}

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:2855

Scope (from outer to inner):

file
function     bool FTurnkeySupportModule::Exec_Editor

Source code excerpt:

		// run Turnkey via UAT. The Cmd is added at the end in case the user wants to run additional commands
		const FString CommandLine = FString::Printf( TEXT("Turnkey %s %s %s"), *ITurnkeyIOModule::Get().GetUATParams(), *FTurnkeyEditorSupport::GetUATOptions(), Cmd );
		FTurnkeyEditorSupport::RunUAT(CommandLine, FText::GetEmpty(), LOCTEXT("Turnkey_CustomTurnkeyName", "Executing Turnkey"), LOCTEXT("Turnkey_CustomTurnkeyShortName", "Turnkey"), FAppStyle::Get().GetBrush(TEXT("MainFrame.PackageProject")));
		return true;
	}
	else if ( FParse::Command( &Cmd, TEXT("RunUAT")) )
	{
		// run UAT directly. The Cmd is added at the start on the assumption that it contains the command to run
		const FString CommandLine = FString::Printf( TEXT("%s %s %s"), Cmd, *ITurnkeyIOModule::Get().GetUATParams(), *FTurnkeyEditorSupport::GetUATOptions() );
		FTurnkeyEditorSupport::RunUAT(CommandLine, FText::GetEmpty(), LOCTEXT("Turnkey_CustomUATName", "Executing Custom UAT Task"), LOCTEXT("Turnkey_CustomUATShortName", "UAT"), FAppStyle::Get().GetBrush(TEXT("MainFrame.PackageProject")));
		return true;
	}

	return false;
}
#endif

#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:438

Scope (from outer to inner):

file
function     class IOSRUNTIMESETTINGS_API UIOSRuntimeSettings : public UObject { public: GENERATED_UCLASS_BODY

Source code excerpt:


	// The team ID of the apple developer account to be used to autmatically sign IOS builds.
	// This can be overridden in Turnkey with "RunUAT Turnkey -command=ManageSettings"
	// This value is stripped out when making builds.
	UPROPERTY(GlobalConfig, EditAnywhere, Category = Build, meta = (ConfigHierarchyEditable))
	FString IOSTeamID;

	// The username/email to use when logging in to DevCenter with Turnkey.
	// This can be overridden in Turnkey with "RunUAT Turnkey -command=ManageSettings"
	// This value is stripped out when making builds.
	UPROPERTY(GlobalConfig, EditAnywhere, Category = Build, meta = (ConfigHierarchyEditable))
	FString DevCenterUsername;
	
	// The password to use when logging in to DevCenter with Turnkey. NOTE: This is saved in plaintext, and is meant for shared accounts!
	// This value is stripped out when making builds.