// Copyright Epic Games, Inc. All Rights Reserved.
using AutomationTool;
using EpicGames.Core;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using System.Xml;
namespace AutomationTool.Tasks
{
///
/// Parameters for a spawn task
///
public class AwsTaskParameters
{
///
/// Arguments for the newly created process.
///
[TaskParameter(Optional = true)]
public string Arguments;
///
/// Environment variables
///
[TaskParameter(Optional = true)]
public string Environment;
///
/// File to read environment from
///
[TaskParameter(Optional = true)]
public string EnvironmentFile;
///
/// Write output to the log
///
[TaskParameter(Optional = true)]
public bool LogOutput = false;
}
///
/// Spawns AWS CLI and waits for it to complete.
///
[TaskElement("Aws", typeof(AwsTaskParameters))]
public class AwsTask : SpawnTaskBase
{
///
/// Parameters for this task
///
AwsTaskParameters Parameters;
///
/// Construct an AWS CLI task
///
/// Parameters for the task
public AwsTask(AwsTaskParameters InParameters)
{
Parameters = InParameters;
}
///
/// Execute the task.
///
/// Information about the current job
/// Set of build products produced by this node.
/// Mapping from tag names to the set of files they include
public override async Task ExecuteAsync(JobContext Job, HashSet BuildProducts, Dictionary> TagNameToFileSet)
{
await SpawnTaskBase.ExecuteAsync("aws", Parameters.Arguments, EnvVars: ParseEnvVars(Parameters.Environment, Parameters.EnvironmentFile), LogOutput: Parameters.LogOutput);
}
///
/// Output this task out to an XML writer.
///
public override void Write(XmlWriter Writer)
{
Write(Writer, Parameters);
}
///
/// Find all the tags which are used as inputs to this task
///
/// The tag names which are read by this task
public override IEnumerable FindConsumedTagNames()
{
yield break;
}
///
/// Find all the tags which are modified by this task
///
/// The tag names which are modified by this task
public override IEnumerable FindProducedTagNames()
{
yield break;
}
}
}