/// <summary> /// Execute the task. /// </summary> /// <param name="Job">Information about the current job.</param> /// <param name="BuildProducts">Set of build products produced by this node.</param> /// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include.</param> public override void Execute(JobContext Job, HashSet <FileReference> BuildProducts, Dictionary <string, HashSet <FileReference> > TagNameToFileSet) { string FileText = Parameters.Text; // If any files or tagsets are provided, add them to the text output. if (!String.IsNullOrEmpty(Parameters.Files)) { if (!string.IsNullOrWhiteSpace(FileText)) { FileText += Environment.NewLine; } HashSet <FileReference> Files = ResolveFilespec(CommandUtils.RootDirectory, Parameters.Files, TagNameToFileSet); if (Files.Any()) { FileText += string.Join(Environment.NewLine, Files.Select(f => f.FullName)); } } // Make sure output folder exists. if (!DirectoryReference.Exists(Parameters.File.Directory)) { DirectoryReference.CreateDirectory(Parameters.File.Directory); } if (Parameters.Append) { CommandUtils.LogInformation(string.Format("Appending text to file '{0}': {1}", Parameters.File, FileText)); FileReference.AppendAllText(Parameters.File, Environment.NewLine + FileText); } else { CommandUtils.LogInformation(string.Format("Writing text to file '{0}': {1}", Parameters.File, FileText)); FileReference.WriteAllText(Parameters.File, FileText); } }