Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Turnkey/Turnkey.Automation.cs
Josh Adams 60c8673e12 - Updated Turnkey studio settings (split into separate .xml file so it can be read without trying to hunt down server files, added idea of what platforms are supported by the studio). Set Epic settings
- Return more info from Turnkey so callers can know if Turnkey can install full or autosdks (based on studio settings)
- Added idea of project settings having custom builds that can be run from Turnkey (and with a later checkin, Platforms menu in the editor)
#rb ben.marsh (just the code that chains Automation commands, as seen in ExecuteBuild)

[CL 14916239 by Josh Adams in ue5-main branch]
2020-12-14 14:46:33 -04:00

108 lines
2.6 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using Tools.DotNETCommon;
using UnrealBuildTool;
using AutomationTool;
using System.Threading;
namespace Turnkey
{
class Turnkey : BuildCommand
{
public override ExitCode Execute()
{
// Thread t = new Thread(Turnkey.ThreadProc);
// Console.WriteLine("Before setting apartment state: {0}",
// t.GetApartmentState());
//
// t.SetApartmentState(ApartmentState.STA);
// Console.WriteLine("After setting apartment state: {0}",
// t.GetApartmentState());
//
// t.Start(this);
// t.Join();
ThreadProc(this);
return TurnkeyUtils.ExitCode;
}
private static void ThreadProc(object Data)
{
BuildCommand Build = (BuildCommand)Data;
IOProvider IOProvider;
if (Build.ParseParam("EditorIO"))
{
IOProvider = new HybridIOProvider();
}
else
{
string ReportFilename = Build.ParseParamValue("ReportFilename");
if (!string.IsNullOrEmpty(ReportFilename))
{
IOProvider = new ReportIOProvider(ReportFilename);
}
else
{
IOProvider = new ConsoleIOProvider();
}
}
Turnkey.Execute(IOProvider, Build);
}
public static AutomationTool.ExitCode Execute(IOProvider IOProvider, BuildCommand CommandUtilHelper)
{
// cache some settings for other classes
TurnkeyUtils.SetVariable("EngineDir", EngineDirectory.FullName);
TurnkeyUtils.SetVariable("Project", CommandUtilHelper.ParseParamValue("Project="));
TurnkeyUtils.Initialize(IOProvider, CommandUtilHelper);
TurnkeySettings.Initialize();
// Microsoft.Win32.SystemEvents.UserPreferenceChanged += new Microsoft.Win32.UserPreferenceChangedEventHandler((sender, args) => TurnkeyUtils.Log("Got a change! {0}", args.Category));
Console.CancelKeyPress += delegate
{
TurnkeyUtils.CleanupPaths();
TurnkeyUtils.Log("");
TurnkeyUtils.Log("If you installed an SDK, you should NOT \"Terminate batch job\"!");
TurnkeyUtils.Log("");
TurnkeyUtils.ExitCode = ExitCode.Success;
};
try
{
// supplied command
string SuppliedCommand = TurnkeyUtils.CommandUtilHelper.ParseParamValue("Command", null);
if (SuppliedCommand != null)
{
TurnkeyCommand.ExecuteCommand(SuppliedCommand);
}
else
{
// no command will prompt
while (TurnkeyCommand.ExecuteCommand())
{
TurnkeyUtils.Log("");
}
}
}
catch (Exception Ex)
{
TurnkeyUtils.Log("Turnkey exception: {0}", Ex.ToString());
}
finally
{
TurnkeyUtils.CleanupPaths();
}
return TurnkeyUtils.ExitCode;
}
}
}