using AutomationTool;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnrealBuildTool;
namespace BuildGraph.Tasks
{
///
/// Parameters for a task that strips symbols from a set of files
///
public class SignTaskParameters
{
///
/// The directory to find files in
///
[TaskParameter(Optional = true)]
public string BaseDir;
///
/// List of file specifications separated by semicolons (eg. *.cpp;Engine/.../*.bat), or the name of a tag set
///
[TaskParameter]
public string Files;
}
///
/// Task which strips symbols from a set of files
///
[TaskElement("Sign", typeof(SignTaskParameters))]
public class SignTask : CustomTask
{
///
/// Parameters for this task
///
SignTaskParameters Parameters;
///
/// Construct a spawn task
///
/// Parameters for the task
public SignTask(SignTaskParameters 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)
{
// Get the base directory
DirectoryReference BaseDir = ResolveDirectory(Parameters.BaseDir);
// Find the matching files
FileReference[] Files = ResolveFilespec(BaseDir, Parameters.Files, TagNameToFileSet).OrderBy(x => x.FullName).ToArray();
// Sign all the files
CodeSign.SignMultipleFilesIfEXEOrDLL(Files.Select(x => x.FullName).ToList(), true);
return true;
}
}
}