/// <summary> /// Collect test compilation errors /// </summary> public void DisplayTestCompilationErrors(TestProjectPlan projectPlan) { Package.ErrorList.Clear(); var errorFound = false; foreach (var plan in projectPlan.TestFilePlans) { foreach (var error in plan.Errors) { errorFound = true; var errorTask = new ErrorTask { Category = TaskCategory.User, ErrorCategory = TaskErrorCategory.Error, HierarchyItem = Package.CodeManager.CurrentHierarchy, Document = error.Filename ?? plan.Filename, Line = error.Line, Column = error.Column, Text = error.ErrorCode == null ? error.Message : $"{error.ErrorCode}: {error.Message}", CanDelete = true }; errorTask.Navigate += ErrorTaskOnNavigate; Package.ErrorList.AddErrorTask(errorTask); } } if (errorFound) { Package.ApplicationObject.ExecuteCommand("View.ErrorList"); } }
/// <summary> /// Compiles the code. /// </summary> /// <returns>True, if compilation successful; otherwise, false</returns> /// <param name="createLog">Signs if build log should be created</param> public TestProjectPlan CompileAllFiles(bool createLog = true) { Package.ErrorList.Clear(); var result = new TestProjectPlan(); var testFiles = Package.CodeDiscoverySolution.CurrentProject.Z80TestProjectItems; if (testFiles.Count == 0) { return(result); } var testManager = Package.TestManager; var start = DateTime.Now; var pane = OutputWindow.GetPane <Z80BuildOutputPane>(); if (createLog) { pane.WriteLine("Z80 Test Compiler"); } foreach (var file in testFiles) { var filename = file.Filename; if (createLog) { pane.WriteLine($"Compiling {filename}"); } var testPlan = testManager.CompileFile(filename); result.Add(testPlan); } if (createLog) { var duration = (DateTime.Now - start).TotalMilliseconds; pane.WriteLine($"Compile time: {duration}ms"); } return(result); }