// 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.Xml; namespace BuildGraph.Tasks { /// /// Parameters for a Docker task /// public class DockerTaskParameters { /// /// Docker command line arguments /// [TaskParameter] public string Arguments; /// /// Environment variables to set /// [TaskParameter(Optional = true)] public string Environment; /// /// File to read environment variables from /// [TaskParameter(Optional = true)] public string EnvironmentFile; /// /// Base directory for running the command /// [TaskParameter(Optional = true)] public string WorkingDir; } /// /// Spawns Docker and waits for it to complete. /// [TaskElement("Docker", typeof(DockerTaskParameters))] public class DockerTask : SpawnTaskBase { /// /// Parameters for this task /// DockerTaskParameters Parameters; /// /// Construct a Docker task /// /// Parameters for the task public DockerTask(DockerTaskParameters 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 void Execute(JobContext Job, HashSet BuildProducts, Dictionary> TagNameToFileSet) { Execute("docker", Parameters.Arguments, EnvVars: ParseEnvVars(Parameters.Environment, Parameters.EnvironmentFile), WorkingDir: Parameters.WorkingDir); } /// /// 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; } } }