internal static void OnBuildEnded() { expectedScenesNames = null; if (s_buildSession == null) { throw new System.InvalidOperationException("Build was not in progress"); } try { using (s_buildSession) { if (s_buildSession.deferAnalysis) { s_buildSession.PostProcessBuild(s_buildSession.buildTarget, s_buildSession.buildPath, scenes => { return(BuildLogParser.GetLastBuildAssetsSizes(EditorLogPath, scenes)); }); } else if (s_buildSession.buildTimer.IsRunning) { Log.Warning("The build seems to have failed or been interrupted"); } } } finally { s_buildSession = null; } }
public async Task GivenDataSourceWithFailedVerifyPackage_ShouldParseGroupItemsAndCodeParse() { var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_5.txt")); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 1); Assert.True(logParser.StageGroups[0].GroupStageNo == 2); Assert.True(logParser.StageGroups[0].IsStageFailure); Assert.False(logParser.StageGroups[0].IsStageSuccess); Assert.True(logParser.StageGroups[0].IsStageCompleted); Assert.True(logParser.StageGroups[0].StageGroupType == StageGroupType.VerifyPackages); var(success, message) = logParser.GetStatement(); Assert.True(message == "1 error entries(s) found in stage - Verify Packages"); Assert.False(success); var results = logParser.VerifyPackageResults; Assert.NotNull(results); Assert.True(results.GetErrors().Count == 1); Assert.True(results.GetErrors()[0].Item1 == 2); Assert.True(results.GetErrors()[0].Item2 == " MSB4057: the target"); var timeTaken = logParser.GetStageTimeTaken(StageGroupType.VerifyPackages); Assert.True(timeTaken?.Hours == 1); }
public async Task GivenDataSourceForGroups_ShouldParseAllGroupItems() { var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_2.txt")); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 3); Assert.True(logParser.StageGroups[0].GroupStageNo == 1); Assert.False(logParser.StageGroups[0].IsStageFailure); Assert.True(logParser.StageGroups[0].IsStageSuccess); Assert.True(logParser.StageGroups[0].IsStageCompleted); Assert.True(logParser.StageGroups[0].StageLineRange.Item1 == 1); Assert.True(logParser.StageGroups[0].StageLineRange.Item2 == 2); Assert.True(logParser.StageGroups[0].StageGroupType == StageGroupType.SvnUpdate); Assert.True(logParser.StageGroups[1].GroupStageNo == 2); Assert.False(logParser.StageGroups[1].IsStageFailure); Assert.True(logParser.StageGroups[1].IsStageSuccess); Assert.True(logParser.StageGroups[1].IsStageCompleted); Assert.True(logParser.StageGroups[1].StageLineRange.Item1 == 3); Assert.True(logParser.StageGroups[1].StageLineRange.Item2 == 4); Assert.True(logParser.StageGroups[1].StageGroupType == StageGroupType.VerifyPackages); Assert.True(logParser.StageGroups[2].GroupStageNo == 3); Assert.False(logParser.StageGroups[2].IsStageFailure); Assert.True(logParser.StageGroups[2].IsStageSuccess); Assert.True(logParser.StageGroups[2].IsStageCompleted); Assert.True(logParser.StageGroups[2].StageLineRange.Item1 == 5); Assert.True(logParser.StageGroups[2].StageLineRange.Item2 == 6); Assert.True(logParser.StageGroups[2].StageGroupType == StageGroupType.CodeBuild); var(success, message) = logParser.GetStatement(); Assert.True(message == "Solution build failed: 0 failed project(s), 0 error instance(s)"); Assert.False(success); }
public async Task GivenBlankPayload_ShouldGiveCorrectBuildStatement() { var logParser = new BuildLogParser("nonsense"); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 0); var(success, message) = logParser.GetStatement(); Assert.True(message == "No known build stages found in log"); Assert.False(success); }
public void Should_parse_missing_file_error() { var logParser = new BuildLogParser(); var quickfix = logParser.Parse( @" CSC : error CS2001: Source file 'Bootstrapper.cs' could not be found [C:\_src\OmniSharp\server\OmniSharp\OmniSharp.csproj]"); quickfix.Text.ShouldEqual( @"Source file ''Bootstrapper.cs'' could not be found [C:\_src\OmniSharp\server\OmniSharp\OmniSharp.csproj]"); quickfix.FileName.ShouldEqual("Bootstrapper.cs"); }
public void Should_parse_syntax_error() { var logParser = new BuildLogParser(); var quickfix = logParser.Parse( @" c:\_src\OmniSharp\server\OmniSharp\Program.cs(12,34): error CS1002: ; expected [C:\_src\OmniSharp\server\OmniSharp\OmniSharp.csproj]"); quickfix.FileName.ShouldEqual(@"c:\_src\OmniSharp\server\OmniSharp\Program.cs"); quickfix.Line.ShouldEqual(12); quickfix.Column.ShouldEqual(34); quickfix.Text.ShouldEqual( @"[error] ; expected"); }
public async Task Run(string payload, Action <string> progress) { var sync = new object(); buildLogParser = new BuildLogParser(payload); await buildLogParser.Parse((update) => { lock (sync) { progress?.Invoke(update); } }); }
public async Task GivenBuildCodePayload_ShouldParseCorrectly() { var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_7.txt")); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 1); var(success, message) = logParser.GetStatement(); Assert.True(message == "Solution build failed: 3 failed project(s), 13 error instance(s)"); Assert.False(success); var codeResults = logParser.CodeResults; Assert.True(codeResults.GetFailedProjectList().Count() == 3); }
public static void OnPostprocessBuild(BuildTarget target, string path) { if (!BetterBuildInfo.IsEnabled) { return; } if (!BuildInfoSettings.Instance.useLegacyCallbacks) { return; } if (s_buildSession == null) { Log.Error("Somehow the tool hasn't recognized that the build is in progress"); return; } if (UnityVersionAgnostic.AssetLogPrintedAfterPostProcessors) { Log.Debug("This Unity version prints assets usage *after* post processors are run (possibly a bug); deferring the analysis to the first editor update after the build."); s_buildSession.buildTarget = target; s_buildSession.buildPath = path; s_buildSession.deferAnalysis = true; } else { try { using (s_buildSession) { s_buildSession.PostProcessBuild(target, path, scenes => { return(BuildLogParser.GetLastBuildAssetsSizes(EditorLogPath, scenes)); }); } } finally { s_buildSession = null; } } return; }
public async Task GivenDataSourceForGroupsWithOneFailure_ShouldParseFailedGroupItems() { var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_3.txt")); await logParser.Parse((notification) => { }); Assert.True(logParser.StageGroups.Count == 1); Assert.True(logParser.StageGroups[0].GroupStageNo == 1); Assert.True(logParser.StageGroups[0].IsStageFailure); Assert.False(logParser.StageGroups[0].IsStageSuccess); Assert.True(logParser.StageGroups[0].IsStageCompleted); Assert.True(logParser.StageGroups[0].StageLineRange.Item1 == 1); Assert.True(logParser.StageGroups[0].StageLineRange.Item2 == 2); var(success, message) = logParser.GetStatement(); Assert.True(message == "0 error entries(s) found in stage - SVN Update"); Assert.False(success); }
private void OpenLogFileButton_OnClick(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog { CheckFileExists = true, CheckPathExists = true, Filter = "All files (*.*)|*.*", InitialDirectory = Path.Combine(Environment.CurrentDirectory, "Logs") }; if (ofd.ShowDialog(this) == true) { ProjectBuild rootProjectBuild = BuildLogParser.GetProjectBuild(ofd.FileName); this.Title = $"MSBuild Log Analyzer - {Path.GetFileName(ofd.FileName)}"; this.TimelineTab.SetRootProjectBuild(rootProjectBuild); this.ProjectSummaryTab.SetRootProjectBuild(rootProjectBuild); this.ProjectTimelineTab.SetRootProjectBuild(rootProjectBuild); this.TargetSummaryTab.SetRootProjectBuild(rootProjectBuild); } }