public override bool TryMatch(InputJob Job, InputJobStep JobStep, InputDiagnostic Diagnostic, List <BuildHealthIssue> Issues)
        {
            // Make sure we're running a step that this applies to
            if (JobStep.Name.IndexOf("Copyright", StringComparison.OrdinalIgnoreCase) == -1)
            {
                return(false);
            }

            // Find any files in compiler output format
            HashSet <string> SourceFileNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (Match FileMatch in Regex.Matches(Diagnostic.Message, @"^\s*(?:WARNING|ERROR):\s*([^ ]+\.[a-zA-Z]+):", RegexOptions.Multiline))
            {
                if (FileMatch.Success)
                {
                    SourceFileNames.Add(FileMatch.Groups[1].Value);
                }
            }

            // If we found any source files, create a diagnostic category for them
            if (SourceFileNames.Count > 0)
            {
                BuildHealthIssue Issue = new BuildHealthIssue(Category, Job.Url, new BuildHealthDiagnostic(JobStep.Name, Diagnostic.Message, Diagnostic.Url));
                Issue.FileNames.UnionWith(SourceFileNames);
                Issues.Add(Issue);
                return(true);
            }

            // Otherwise pass
            return(false);
        }
Esempio n. 2
0
        public override bool TryMatch(InputJob Job, InputJobStep JobStep, InputDiagnostic Diagnostic, List <BuildHealthIssue> Issues)
        {
            // Find any files in compiler output format
            HashSet <string> SourceFileNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (Match FileMatch in Regex.Matches(Diagnostic.Message, @"^\s*(?:In file included from\s*)?((?:[A-Za-z]:)?[^\s(:]+)[\(:]\d", RegexOptions.Multiline))
            {
                if (FileMatch.Success)
                {
                    string FileName = GetNormalizedFileName(FileMatch.Groups[1].Value, JobStep.BaseDirectory);
                    if (SourceFileExtensions.Any(x => FileName.EndsWith(x, StringComparison.OrdinalIgnoreCase)))
                    {
                        SourceFileNames.Add(FileName);
                    }
                }
            }

            // If we found any source files, create a diagnostic category for them
            if (SourceFileNames.Count > 0)
            {
                BuildHealthIssue Issue = new BuildHealthIssue(Category, Job.Url, new BuildHealthDiagnostic(JobStep.Name, ShortenPaths(Diagnostic.Message), Diagnostic.Url));
                Issue.FileNames.UnionWith(SourceFileNames);
                Issues.Add(Issue);
                return(true);
            }

            // Otherwise pass
            return(false);
        }
        public override bool TryMatch(InputJob Job, InputJobStep JobStep, InputDiagnostic Diagnostic, List <BuildHealthIssue> Issues)
        {
            string DefaultProject = String.Format("{0} (Unmatched)", Job.Project);

            BuildHealthIssue Issue = new BuildHealthIssue(DefaultProject, Category, Job.Url, new BuildHealthDiagnostic(JobStep.Name, JobStep.Url, Diagnostic.Message, Diagnostic.Url));

            Issue.Identifiers.Add(Diagnostic.Message);
            Issues.Add(Issue);

            return(true);
        }
Esempio n. 4
0
 /// <summary>
 /// Creates fingerprints from any matching diagnostics
 /// </summary>
 /// <param name="Job">The job that was run</param>
 /// <param name="JobStep">The job step that was run</param>
 /// <param name="Diagnostics">List of diagnostics that were produced by the build. Items should be removed from this list if they match.</param>
 /// <param name="Issues">List which receives all the matched issues.</param>
 public virtual void Match(InputJob Job, InputJobStep JobStep, List <InputDiagnostic> Diagnostics, List <BuildHealthIssue> Issues)
 {
     for (int Idx = 0; Idx < Diagnostics.Count; Idx++)
     {
         InputDiagnostic Diagnostic = Diagnostics[Idx];
         if (TryMatch(Job, JobStep, Diagnostic, Issues))
         {
             Diagnostics.RemoveAt(Idx);
             Idx--;
         }
     }
 }
        public override bool TryMatch(InputJob Job, InputJobStep JobStep, InputDiagnostic Diagnostic, List <BuildHealthIssue> Issues)
        {
            HashSet <string> FileNames = new HashSet <string>();

            foreach (Match Match in Regex.Matches(Diagnostic.Message, @"^\s*Log[a-zA-Z0-9]+:\s+(?:Error:|Warning:)\s+((?:[a-zA-Z]:)?[^:]+(?:.uasset|.umap)):\s*(.*)"))
            {
                FileNames.Add(GetNormalizedFileName(Match.Groups[1].Value, JobStep.BaseDirectory));
            }

            if (FileNames.Count > 0)
            {
                BuildHealthIssue Issue = new BuildHealthIssue(Job.Project, Category, Job.Url, new BuildHealthDiagnostic(JobStep.Name, JobStep.Url, Diagnostic.Message, Diagnostic.Url));
                Issue.FileNames.UnionWith(FileNames);
                Issues.Add(Issue);
                return(true);
            }
            return(false);
        }
        public override bool TryMatch(InputJob Job, InputJobStep JobStep, InputDiagnostic Diagnostic, List <BuildHealthIssue> Issues)
        {
            List <string> SymbolMatches = new List <string>();

            // Mac link error:
            //   Undefined symbols for architecture arm64:
            //     "Foo::Bar() const", referenced from:
            if (Regex.IsMatch(Diagnostic.Message, "^Undefined symbols"))
            {
                foreach (string Line in Diagnostic.Message.Split('\n'))
                {
                    Match SymbolMatch = Regex.Match(Line, "^  \"(.+)\"");
                    if (SymbolMatch.Success)
                    {
                        SymbolMatches.Add(SymbolMatch.Groups[1].Value);
                    }
                }
            }

            // Android link error:
            //   Foo.o:(.data.rel.ro + 0x5d88): undefined reference to `Foo::Bar()'
            Match UndefinedReference = Regex.Match(Diagnostic.Message, ": undefined reference to [`']([^`']+)");

            if (UndefinedReference.Success)
            {
                SymbolMatches.Add(UndefinedReference.Groups[1].Value);
            }

            // LLD link error:
            //   ld.lld.exe: error: undefined symbol: Foo::Bar() const
            Match LldMatch = Regex.Match(Diagnostic.Message, "error: undefined symbol:\\s*(.+)");

            if (LldMatch.Success)
            {
                SymbolMatches.Add(LldMatch.Groups[1].Value);
            }

            // Link error:
            //   Link: error: L0039: reference to undefined symbol `Foo::Bar() const' in file
            Match LinkMatch = Regex.Match(Diagnostic.Message, ": reference to undefined symbol [`']([^`']+)");

            if (LinkMatch.Success)
            {
                SymbolMatches.Add(LinkMatch.Groups[1].Value);
            }

            // Microsoft linker error:
            //   Foo.cpp.obj : error LNK2001: unresolved external symbol \"private: virtual void __cdecl UAssetManager::InitializeAssetBundlesFromMetadata_Recursive(class UStruct const *,void const *,struct FAssetBundleData &,class FName,class TSet<void const *,struct DefaultKeyFuncs<void const *,0>,class FDefaultSetAllocator> &)const \" (?InitializeAssetBundlesFromMetadata_Recursive@UAssetManager@@EEBAXPEBVUStruct@@PEBXAEAUFAssetBundleData@@VFName@@AEAV?$TSet@PEBXU?$DefaultKeyFuncs@PEBX$0A@@@VFDefaultSetAllocator@@@@@Z)",
            Match MicrosoftMatch = Regex.Match(Diagnostic.Message, ": unresolved external symbol \"([^\"]*)\"");

            if (MicrosoftMatch.Success)
            {
                SymbolMatches.Add(MicrosoftMatch.Groups[1].Value);
            }

            // Clean up all the symbol names
            SortedSet <string> SymbolNames = new SortedSet <string>(StringComparer.Ordinal);

            foreach (string SymbolMatch in SymbolMatches)
            {
                string SymbolName = SymbolMatch;

                // Remove any __declspec qualifiers
                SymbolName = Regex.Replace(SymbolName, "(?<![^a-zA-Z_])__declspec\\([^\\)]+\\)", "");

                // Remove any argument lists for functions (anything after the first paren)
                SymbolName = Regex.Replace(SymbolName, "\\(.*$", "");

                // Remove any decorators and type information (greedy match up to the last space)
                SymbolName = Regex.Replace(SymbolName, "^.* ", "");

                // Add it to the list
                SymbolNames.Add(SymbolName);
            }

            // If we found any symbol names, create a fingerprint for them
            if (SymbolNames.Count > 0)
            {
                BuildHealthIssue Issue = new BuildHealthIssue(Job.Project, Category, Job.Url, new BuildHealthDiagnostic(JobStep.Name, JobStep.Url, Diagnostic.Message, Diagnostic.Url));
                Issue.Identifiers.UnionWith(SymbolNames);
                Issues.Add(Issue);
                return(true);
            }

            // Otherwise pass
            return(false);
        }
Esempio n. 7
0
 /// <summary>
 /// Tries to create a fingerprint from an individual diagnostic.
 /// </summary>
 /// <param name="Job">The job that was run</param>
 /// <param name="JobStep">The job step that was run</param>
 /// <param name="Diagnostic">A diagnostic from the given job step</param>
 /// <param name="Issues">List which receives all the matched issues.</param>
 /// <returns>True if this diagnostic should be removed (usually because a fingerprint was created)</returns>
 public abstract bool TryMatch(InputJob Job, InputJobStep JobStep, InputDiagnostic Diagnostic, List <BuildHealthIssue> Issues);