2019-12-26 23:01:54 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using AutomationTool;
|
|
|
|
|
using UnrealBuildTool;
|
2023-03-08 12:43:35 -05:00
|
|
|
using Microsoft.Extensions.Logging;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-07-22 20:27:06 -04:00
|
|
|
namespace AutomationScripts
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-07-22 20:27:06 -04:00
|
|
|
public partial class Project : CommandUtils
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-07-22 20:27:06 -04:00
|
|
|
public static void Deploy(ProjectParams Params)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-07-22 20:27:06 -04:00
|
|
|
Params.ValidateAndLog();
|
|
|
|
|
if (!Params.Deploy)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-07-22 20:27:06 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-08 12:43:35 -05:00
|
|
|
Logger.LogInformation("********** DEPLOY COMMAND STARTED **********");
|
2022-05-05 03:40:01 -04:00
|
|
|
var StartTime = DateTime.UtcNow;
|
2021-07-22 20:27:06 -04:00
|
|
|
|
|
|
|
|
if (!Params.NoClient)
|
|
|
|
|
{
|
|
|
|
|
var DeployContextList = CreateDeploymentContext(Params, false, false);
|
|
|
|
|
foreach (var SC in DeployContextList)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-07-22 20:27:06 -04:00
|
|
|
if (SC.StageTargetPlatform.DeployViaUFE)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-07-22 20:27:06 -04:00
|
|
|
string ClientCmdLine = "-run=Deploy ";
|
|
|
|
|
ClientCmdLine += "-Device=" + string.Join("+", Params.Devices) + " ";
|
|
|
|
|
ClientCmdLine += "-Targetplatform=" + SC.StageTargetPlatform.PlatformType.ToString() + " ";
|
|
|
|
|
ClientCmdLine += "-SourceDir=\"" + CombinePaths(Params.BaseStageDirectory, SC.StageTargetPlatform.PlatformType.ToString()) + "\" ";
|
|
|
|
|
string ClientApp = CombinePaths(CmdEnv.LocalRoot, "Engine/Binaries/Win64/UnrealFrontend.exe");
|
|
|
|
|
|
2023-03-08 12:43:35 -05:00
|
|
|
Logger.LogInformation("Deploying via UFE:");
|
|
|
|
|
Logger.LogInformation("\tClientCmdLine: " + ClientCmdLine + "");
|
2021-07-22 20:27:06 -04:00
|
|
|
|
|
|
|
|
//@todo UAT: Consolidate running of external applications like UFE (See 'RunProjectCommand' for other instances)
|
|
|
|
|
PushDir(Path.GetDirectoryName(ClientApp));
|
|
|
|
|
// Always start client process and don't wait for exit.
|
|
|
|
|
IProcessResult ClientProcess = Run(ClientApp, ClientCmdLine, null, ERunOptions.NoWaitForExit);
|
|
|
|
|
PopDir();
|
|
|
|
|
if (ClientProcess != null)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-07-22 20:27:06 -04:00
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
}
|
|
|
|
|
while (ClientProcess.HasExited == false);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2021-07-22 20:27:06 -04:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-08-25 04:21:07 -04:00
|
|
|
if (SC.CustomDeployment == null || !SC.CustomDeployment.Deploy(Params, SC))
|
|
|
|
|
{
|
|
|
|
|
SC.StageTargetPlatform.Deploy(Params, SC);
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
2021-07-22 20:27:06 -04:00
|
|
|
}
|
|
|
|
|
if (Params.DedicatedServer)
|
|
|
|
|
{
|
|
|
|
|
ProjectParams ServerParams = new ProjectParams(Params);
|
|
|
|
|
ServerParams.Devices = new ParamList<string>(ServerParams.ServerDevice);
|
|
|
|
|
var DeployContextList = CreateDeploymentContext(ServerParams, true, false);
|
|
|
|
|
foreach (var SC in DeployContextList)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2021-07-22 20:27:06 -04:00
|
|
|
SC.StageTargetPlatform.Deploy(ServerParams, SC);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
2014-09-18 18:55:01 -04:00
|
|
|
|
2023-03-08 12:43:35 -05:00
|
|
|
Logger.LogInformation("Deploy command time: {0:0.00} s", (DateTime.UtcNow - StartTime).TotalMilliseconds / 1000);
|
|
|
|
|
Logger.LogInformation("********** DEPLOY COMMAND COMPLETED **********");
|
2021-07-22 20:27:06 -04:00
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|