Ejemplo n.º 1
0
 public override bool Match(BambooLogParser parser, Row row)
 {
     return
         (matchProjectStarted(parser, row) ||
          matchProjectRecord(parser, row) ||
          matchBuildFinished(parser, row));
 }
Ejemplo n.º 2
0
        public static BambooLog Parse(IEnumerable <string> lines)
        {
            var parser = new BambooLogParser();

            parser.run(lines);
            return(parser.log);
        }
Ejemplo n.º 3
0
 VSBuild getCurrentBuild(BambooLogParser parser)
 {
     if (parser.Stack.Count == 0)
     {
         return(null);
     }
     return(parser.Stack.Peek() as VSBuild);
 }
Ejemplo n.º 4
0
        private bool matchGTestParamFinished(BambooLogParser parser, Row row)
        {
            var match = regexGTestParamFinished.Match(row.Message);

            if (match.Success)
            {
                var test = (GTestCaseParametrized)parser.Stack.Peek();
                test.Milliseconds = match.Groups["Milliseconds"].Value;
                parser.Stack.Pop();
            }
            return(match.Success);
        }
Ejemplo n.º 5
0
 public override bool Match(BambooLogParser parser, Row row)
 {
     return
         (matchGTestRunStarted(parser, row) ||
          matchGTestRunFinished(parser, row) ||
          matchGTestCaseStarted(parser, row) ||
          matchGTestCaseFinished(parser, row) ||
          matchGTestParamStarted(parser, row) ||
          matchGTestParamFinished(parser, row) ||
          matchGTestStarted(parser, row) ||
          matchGTestFinished(parser, row));
 }
Ejemplo n.º 6
0
        private bool matchGTestParamStarted(BambooLogParser parser, Row row)
        {
            var match = regexGTestParamStarted.Match(row.Message);

            if (match.Success)
            {
                var test = new GTestCaseParametrized();
                test.Time = row.Time;
                setMatchedProperties(test, match.Groups, regexGTestParamStarted.GetGroupNames());
                parser.Stack.Peek().Add(test);
                parser.Stack.Push(test);
            }
            return(match.Success);
        }
Ejemplo n.º 7
0
        bool matchTaskStarted(BambooLogParser parser, Row row)
        {
            var match = regexTaskStarted.Match(row.Message);

            if (match.Success)
            {
                var task = new Task();
                task.Time = row.Time;
                setMatchedProperties(task, match.Groups, regexTaskStarted.GetGroupNames());
                parser.Stack.Peek().Add(task);
                parser.Stack.Push(task);
            }
            return(match.Success);
        }
Ejemplo n.º 8
0
        bool matchTaskFinished(BambooLogParser parser, Row row)
        {
            var match = regexTaskFinished.Match(row.Message);

            if (match.Success)
            {
                var task = (Task)parser.Stack.Peek();
                if (task.Name != match.Groups["Name"].Value)
                {
                    throw new Exception("Task name mismatch");
                }
                task.FinishTime = row.Time;
                task.Result     = match.Groups["Result"].Value;
                parser.Stack.Pop();
            }
            return(match.Success);
        }
Ejemplo n.º 9
0
        bool matchBuildStarted(BambooLogParser parser, Row row)
        {
            var match = regexBuildStarted.Match(row.Message);

            if (match.Success)
            {
                if (parser.Stack.Count > 0)
                {
                    throw new Exception("Stack.Count > 0");
                }
                var build = new Build();
                build.Time = row.Time;
                setMatchedProperties(build, match.Groups, regexBuildStarted.GetGroupNames());
                parser.Log.Add(build);
                parser.Stack.Push(build);
            }
            return(match.Success);
        }
Ejemplo n.º 10
0
        bool matchBuildFinished(BambooLogParser parser, Row row)
        {
            var build = getCurrentBuild(parser);

            if (build == null)
            {
                return(false);
            }
            var match = regexVSBuildFinished.Match(row.Message);

            if (match.Success)
            {
                var counters = match.Groups["Counters"].Value.Split(new string[] { ", " }, StringSplitOptions.None);
                foreach (var counter in counters)
                {
                    var counterMatch = regexCounter.Match(counter);
                    if (counterMatch.Success)
                    {
                        string value = counterMatch.Groups["Value"].Value;
                        switch (counterMatch.Groups["Name"].Value)
                        {
                        case "succeeded":
                            build.SucceededCount = value;
                            break;

                        case "failed":
                            build.FailedCount = value;
                            break;

                        case "skipped":
                            build.SkippedCount = value;
                            break;

                        case "up-to-date":
                            build.UpToDateCount = value;
                            break;
                        }
                    }
                }
                parser.Stack.Pop();
            }
            return(match.Success);
        }
Ejemplo n.º 11
0
        bool matchBuildFinished(BambooLogParser parser, Row row)
        {
            var match = regexBuildFinished.Match(row.Message);

            if (match.Success)
            {
                while (parser.Stack.Count > 1)
                {
                    parser.Stack.Pop().FinishTime = row.Time;
                }
                var build = (Build)parser.Stack.Peek();
                if (build.Id != match.Groups["Id"].Value)
                {
                    throw new Exception("Build id mismatch");
                }
                build.FinishTime = row.Time;
                parser.Stack.Pop();
            }
            return(match.Success);
        }
Ejemplo n.º 12
0
        bool matchProjectRecord(BambooLogParser parser, Row row)
        {
            var build = getCurrentBuild(parser);

            if (build == null)
            {
                return(false);
            }

            var match = regexBuildMessage.Match(row.Message);

            if (match.Success)
            {
                var record = new SimpleRecord();
                record.Kind    = row.Kind;
                record.Time    = row.Time;
                record.Message = match.Groups["Message"].Value;
                var projectNumber = match.Groups["Number"].Value;
                var project       = build.Projects[projectNumber];
                var errorMatch    = regexError.Match(record.Message);
                if (errorMatch.Success)
                {
                    switch (errorMatch.Groups["Severity"].Value)
                    {
                    case "warning":
                        record.Severity = MessageSeverity.Warning;
                        break;

                    case "error":
                    case "fatal error":
                        record.Severity = MessageSeverity.Error;
                        break;
                    }
                }
                project.Add(record);
                project.FinishTime = row.Time;
            }
            return(match.Success);
        }
Ejemplo n.º 13
0
        bool matchProjectStarted(BambooLogParser parser, Row row)
        {
            var match = regexVSProjectStarted.Match(row.Message);

            if (match.Success)
            {
                var build = getCurrentBuild(parser);
                if (build == null)
                {
                    build      = new VSBuild();
                    build.Time = row.Time;
                    parser.Stack.Peek().Add(build);
                    parser.Stack.Push(build);
                }

                var project = new VSProject();
                project.Time = row.Time;
                setMatchedProperties(project, match.Groups, regexVSProjectStarted.GetGroupNames());
                build.Projects.Add(project.Number, project);
                build.Add(project);
            }
            return(match.Success);
        }
Ejemplo n.º 14
0
 public abstract bool Match(BambooLogParser parser, Row row);
Ejemplo n.º 15
0
 public override bool Match(BambooLogParser parser, Row row)
 {
     return(matchTaskStarted(parser, row) || matchTaskFinished(parser, row));
 }