// Copyright Epic Games, Inc. All Rights Reserved. using System.Threading.Tasks; using EpicGames.Core; using Microsoft.Extensions.Logging; namespace UnrealBuildTool { /// /// Invokes the deployment handler for a target. /// [ToolMode("Deploy", ToolModeOptions.BuildPlatforms)] class DeployMode : ToolMode { /// /// If we are just running the deployment step, specifies the path to the given deployment settings /// [CommandLine("-Receipt", Required = true)] public FileReference? ReceiptFile = null; /// /// Execute the tool mode /// /// Command line arguments /// Exit code /// public override Task ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) { // Apply the arguments Arguments.ApplyTo(this); Arguments.CheckAllArgumentsUsed(); // Execute the deploy TargetReceipt Receipt = TargetReceipt.Read(ReceiptFile!); Logger.LogInformation("Deploying {ReceiptTargetName} {ReceiptPlatform} {ReceiptConfiguration}...", Receipt.TargetName, Receipt.Platform, Receipt.Configuration); UEBuildPlatform.GetBuildPlatform(Receipt.Platform).Deploy(Receipt); return Task.FromResult((int)CompilationResult.Succeeded); } } }