/// <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> /// <returns>True if the task succeeded</returns> public override bool Execute(JobContext Job, HashSet <FileReference> BuildProducts, Dictionary <string, HashSet <FileReference> > TagNameToFileSet) { // Get the base directory DirectoryReference BaseDir = ResolveDirectory(Parameters.BaseDir); // Parse all the exclude rules List <string> ExcludeRules = ParseRules(BaseDir, Parameters.Except ?? "", TagNameToFileSet); // Resolve the input list HashSet <FileReference> Files = ResolveFilespecWithExcludePatterns(BaseDir, Parameters.Files, ExcludeRules, TagNameToFileSet); // Limit to matches against the 'Filter' parameter, if set if (Parameters.Filter != null) { FileFilter Filter = new FileFilter(); Filter.AddRules(ParseRules(BaseDir, Parameters.Filter, TagNameToFileSet)); Files.RemoveWhere(x => !Filter.Matches(x.FullName)); } // Apply the tag to all the matching files foreach (string TagName in FindTagNamesFromList(Parameters.With)) { FindOrAddTagSet(TagNameToFileSet, TagName).UnionWith(Files); } return(true); }
/// <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) { // Get the base directory DirectoryReference BaseDir = Parameters.BaseDir ?? CommandUtils.RootDirectory; // Parse all the exclude rules List <string> ExcludeRules = ParseRules(BaseDir, Parameters.Except ?? "", TagNameToFileSet); // Resolve the input list HashSet <FileReference> Files = new HashSet <FileReference>(); if (!String.IsNullOrEmpty(Parameters.Files)) { Files.UnionWith(ResolveFilespecWithExcludePatterns(BaseDir, Parameters.Files, ExcludeRules, TagNameToFileSet)); } // Resolve the input file lists if (!String.IsNullOrEmpty(Parameters.FileLists)) { HashSet <FileReference> FileLists = ResolveFilespec(BaseDir, Parameters.FileLists, TagNameToFileSet); foreach (FileReference FileList in FileLists) { if (!FileReference.Exists(FileList)) { throw new AutomationException("Specified file list '{0}' does not exist", FileList); } string[] Lines = FileReference.ReadAllLines(FileList); foreach (string Line in Lines) { string TrimLine = Line.Trim(); if (TrimLine.Length > 0) { Files.Add(FileReference.Combine(BaseDir, TrimLine)); } } } } // Limit to matches against the 'Filter' parameter, if set if (Parameters.Filter != null) { FileFilter Filter = new FileFilter(); Filter.AddRules(ParseRules(BaseDir, Parameters.Filter, TagNameToFileSet)); Files.RemoveWhere(x => !Filter.Matches(x.FullName)); } // Apply the tag to all the matching files foreach (string TagName in FindTagNamesFromList(Parameters.With)) { FindOrAddTagSet(TagNameToFileSet, TagName).UnionWith(Files); } }
/// <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> /// <returns>True if the task succeeded</returns> public override bool Execute(JobContext Job, HashSet<FileReference> BuildProducts, Dictionary<string, HashSet<FileReference>> TagNameToFileSet) { // Get the base directory DirectoryReference BaseDir = ResolveDirectory(Parameters.BaseDir); // Parse all the exclude rules List<string> ExcludeRules = ParseRules(BaseDir, Parameters.Except ?? "", TagNameToFileSet); // Resolve the input list HashSet<FileReference> Files = ResolveFilespecWithExcludePatterns(BaseDir, Parameters.Files, ExcludeRules, TagNameToFileSet); // Limit to matches against the 'Filter' parameter, if set if(Parameters.Filter != null) { FileFilter Filter = new FileFilter(); Filter.AddRules(ParseRules(BaseDir, Parameters.Filter, TagNameToFileSet)); Files.RemoveWhere(x => !Filter.Matches(x.FullName)); } // Apply the tag to all the matching files foreach(string TagName in FindTagNamesFromList(Parameters.With)) { FindOrAddTagSet(TagNameToFileSet, TagName).UnionWith(Files); } return true; }