using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnrealBuildTool; namespace AutomationTool.Tasks { /// /// Parameters for the version task /// public class SetVersionTaskParameters { /// /// The changelist to set in the version files /// [TaskParameter] public int Change; /// /// The branch string /// [TaskParameter] public string Branch; /// /// Whether to set the IS_LICENSEE_VERSION flag to true /// [TaskParameter(Optional = true)] public bool Licensee; /// /// If set, don't actually write to the files - just return the version files that would be updated. Useful for local builds. /// [TaskParameter(Optional = true)] public bool SkipWrite; } /// /// Task which updates the version files in the current branch /// [TaskElement("SetVersion", typeof(SetVersionTaskParameters))] public class SetVersionTask : CustomTask { /// /// Parameters for the task /// SetVersionTaskParameters Parameters; /// /// Construct a version task /// /// Parameters for this task public SetVersionTask(SetVersionTaskParameters 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 /// True if the task succeeded public override bool Execute(JobContext Job, HashSet BuildProducts, Dictionary> TagNameToFileSet) { List FileNames = UE4Build.StaticUpdateVersionFiles(Parameters.Change, Parameters.Branch, Parameters.Licensee, !Parameters.SkipWrite); BuildProducts.UnionWith(FileNames.Select(x => new FileReference(x))); return true; } } }