/// <summary> /// Builds the specified solution item. /// </summary> /// <param name = "monitor">The monitor.</param> /// <param name = "item">The item.</param> /// <param name = "configuration">The configuration.</param> /// <returns>The build result.</returns> protected override BuildResult Build(IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration) { BuildResult result = new BuildResult (); // Pre-build monitor.BeginTask (GettextCatalog.GetString ("Pre-Building..."), 1); this.PreBuild (result, monitor, item, configuration); monitor.EndTask(); if (result.ErrorCount > 0) { return result; } // Build monitor.BeginTask (GettextCatalog.GetString ("Building"), 1); result.Append (base.Build (monitor, item, configuration)); monitor.EndTask(); if (result.ErrorCount > 0) { return result; } // Post-build monitor.BeginTask (GettextCatalog.GetString ("Post-Building..."), 1); this.PostBuild (result, monitor, item, configuration); monitor.EndTask(); return result; }
public IEnumerable <SearchResult> FindAll(Scope scope, IProgressMonitor monitor, string pattern, string replacePattern, FilterOptions filter) { if (filter.RegexSearch) { RegexOptions regexOptions = RegexOptions.Compiled; if (!filter.CaseSensitive) { regexOptions |= RegexOptions.IgnoreCase; } regex = new Regex(pattern, regexOptions); } IsRunning = true; FoundMatchesCount = SearchedFilesCount = 0; monitor.BeginTask(scope.GetDescription(filter, pattern, replacePattern), 50); try { int totalWork = scope.GetTotalWork(filter); int step = Math.Max(1, totalWork / 50); string content; foreach (FileProvider provider in scope.GetFiles(monitor, filter)) { if (monitor.IsCancelRequested) { yield break; } SearchedFilesCount++; try { content = provider.ReadString(); if (replacePattern != null) { provider.BeginReplace(content); } } catch (System.IO.FileNotFoundException) { MessageService.ShowError(string.Format(GettextCatalog.GetString("File {0} not found.")), provider.FileName); continue; } foreach (SearchResult result in FindAll(monitor, provider, content, pattern, replacePattern, filter)) { if (monitor.IsCancelRequested) { yield break; } FoundMatchesCount++; yield return(result); } if (replacePattern != null) { provider.EndReplace(); } if (SearchedFilesCount % step == 0) { monitor.Step(1); } } } finally { monitor.EndTask(); IsRunning = false; } }
void UpdateRepository(IProgressMonitor monitor, Uri baseUri, RepositoryRecord rr) { Uri absUri = new Uri(baseUri, rr.Url); monitor.BeginTask("Updating from " + absUri.ToString(), 2); Repository newRep; try { newRep = (Repository)service.Store.DownloadObject(monitor, absUri.ToString(), typeof(Repository)); } catch (Exception ex) { monitor.ReportError("Could not get information from repository" + ": " + absUri.ToString(), ex); return; } monitor.Step(1); foreach (ReferenceRepositoryEntry re in newRep.Repositories) { Uri refRepUri = new Uri(absUri, re.Url); string refRepUrl = refRepUri.ToString(); RepositoryRecord refRep = FindRepositoryRecord(refRepUrl); if (refRep == null) { refRep = RegisterRepository(refRepUrl, true); } if (refRep.LastModified < re.LastModified) { UpdateRepository(monitor, refRepUri, refRep); } } monitor.EndTask(); rr.UpdateCachedRepository(newRep); }
void InstallEntry(IProgressMonitor monitor, DeployContext ctx, SolutionItem entry, ConfigurationSelector configuration) { foreach (DeployFile df in DeployService.GetDeployFiles(ctx, new SolutionItem[] { entry }, configuration)) { string targetPath = df.ResolvedTargetFile; if (targetPath == null) { monitor.ReportWarning("Could not copy file '" + df.RelativeTargetPath + "': Unknown target directory."); continue; } CopyFile(monitor, df.SourcePath, df.ResolvedTargetFile, df.FileAttributes); } SolutionFolder c = entry as SolutionFolder; if (c != null) { monitor.BeginTask("Installing solution '" + c.Name + "'", c.Items.Count); foreach (SolutionItem ce in c.Items) { InstallEntry(monitor, ctx, ce, configuration); monitor.Step(1); } monitor.EndTask(); } }
/// <inheritdoc /> public override void ApplyPendingSettingsChanges(IElevationContext elevationContext, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Saving preferences.", 1)) { var preferencePanes = new List<PreferencePane>(GetPreferencePanes()); if (preferencePanes.Count == 0) return; double workPerPreferencePane = 1.0 / preferencePanes.Count; foreach (PreferencePane preferencePane in preferencePanes) { if (progressMonitor.IsCanceled) return; if (preferencePane.PendingSettingsChanges) { preferencePane.ApplyPendingSettingsChanges( preferencePane.RequiresElevation ? elevationContext : null, progressMonitor.CreateSubProgressMonitor(workPerPreferencePane)); } else { progressMonitor.Worked(workPerPreferencePane); } } } }
protected override SolutionEntityItem LoadSolutionItem (IProgressMonitor monitor, string fileName) { SolutionEntityItem entry = base.LoadSolutionItem (monitor, fileName); if (entry == null) return null; Project project = entry as Project; if (project == null) return entry; //Project MakefileData data = entry.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; if (data == null) return entry; monitor.BeginTask (GettextCatalog.GetString ("Updating project from Makefile"), 1); try { data.OwnerProject = project; if (data.SupportsIntegration) data.UpdateProject (monitor, false); monitor.Step (1); } catch (Exception e) { monitor.ReportError (GettextCatalog.GetString ( "Error loading Makefile for project {0}", project.Name), e); } finally { monitor.EndTask (); } entry.SetNeedsBuilding (false); return entry; }
protected internal override TestResult RunImpl(ITestCommand rootTestCommand, Model.Tree.TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Running tests.", rootTestCommand.TestCount)) { // Note: We do not check options.SkipTestExecution here because we want to build up // the tree of data-driven test steps. So we actually check it later on in the // PatternTestExecutor. This is different from framework adapters // at this time (because they do not generally support dynamically generated data-driven tests). Sandbox sandbox = new Sandbox(); EventHandler canceledHandler = delegate { sandbox.Abort(TestOutcome.Canceled, "The user canceled the test run."); }; try { progressMonitor.Canceled += canceledHandler; TestAssemblyExecutionParameters.Reset(); PatternTestExecutor executor = new PatternTestExecutor(options, progressMonitor, formatter, converter, environmentManager); // Inlined to minimize stack depth. var action = executor.CreateActionToRunTest(rootTestCommand, parentTestStep, sandbox, null); action.Run(); return action.Result; } finally { progressMonitor.Canceled -= canceledHandler; sandbox.Dispose(); } } }
internal void Initialize(IProgressMonitor monitor) { monitor.BeginTask(GettextCatalog.GetString("Initializing Main Window"), 4); try { Counters.Initialization.Trace("Creating DefaultWorkbench"); workbench = new DefaultWorkbench(); monitor.Step(1); Counters.Initialization.Trace("Initializing Workspace"); workbench.InitializeWorkspace(); monitor.Step(1); Counters.Initialization.Trace("Initializing Layout"); workbench.InitializeLayout(); monitor.Step(1); ((Gtk.Window)workbench).Visible = false; workbench.ActiveWorkbenchWindowChanged += new EventHandler(OnDocumentChanged); IdeApp.Workspace.StoringUserPreferences += OnStoringWorkspaceUserPreferences; IdeApp.Workspace.LoadingUserPreferences += OnLoadingWorkspaceUserPreferences; IdeApp.CommandService.ApplicationFocusOut += delegate(object o, EventArgs args) { SaveFileStatus(); }; IdeApp.CommandService.ApplicationFocusIn += delegate(object o, EventArgs args) { CheckFileStatus(); }; pads = null; // Make sure we get an up to date pad list. monitor.Step(1); } finally { monitor.EndTask(); } }
public static BuildResult UpdateCodeBehind (IProgressMonitor monitor, XibCodeBehind generator, IEnumerable<ProjectFile> items) { var result = new BuildResult (); var writer = MonoDevelop.DesignerSupport.CodeBehindWriter.CreateForProject (monitor, generator.Project); if (!writer.SupportsPartialTypes) { monitor.ReportWarning ("Cannot generate designer code, because CodeDom " + "provider does not support partial classes."); return result; } var files = generator.GetDesignerFilesNeedBuilding (items, false).ToList (); if (files.Count == 0) return result; monitor.BeginTask (GettextCatalog.GetString ("Updating CodeBehind files"), 0); foreach (var f in files) { try { generator.GenerateDesignerCode (writer, f.Key, f.Value); var relPath = f.Value.FilePath.ToRelative (generator.Project.BaseDirectory); monitor.Log.WriteLine (GettextCatalog.GetString ("Updated {0}", relPath)); } catch (Exception ex) { result = result ?? new BuildResult (); result.AddError (f.Key.FilePath, 0, 0, null, ex.Message); LoggingService.LogError (String.Format ("Error generating code for xib file '{0}'", f.Key.FilePath), ex); } } writer.WriteOpenFiles (); monitor.EndTask (); return result; }
internal protected override BuildResult OnRunTarget(IProgressMonitor monitor, string target, ConfigurationSelector configuration) { BuildResult result = null; monitor.BeginTask(null, Items.Count); try { foreach (WorkspaceItem it in Items) { BuildResult res = it.RunTarget(monitor, target, configuration); if (res != null) { if (result == null) { result = new BuildResult(); result.BuildCount = 0; } result.Append(res); } monitor.Step(1); } } finally { monitor.EndTask(); } return(result); }
private bool ApplySettingsChanges(IElevationContext elevationContext, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Applying changes.", 1)) { var tabs = new List <ControlPanelTab>(GetControlPanelTabs()); if (tabs.Count == 0) { return(true); } double workPerTab = 1.0 / tabs.Count; foreach (ControlPanelTab tab in tabs) { if (progressMonitor.IsCanceled) { return(false); } if (tab.PendingSettingsChanges) { tab.ApplyPendingSettingsChanges(tab.RequiresElevation ? elevationContext : null, progressMonitor.CreateSubProgressMonitor(workPerTab)); } else { progressMonitor.Worked(workPerTab); } } } return(true); }
public override void Uninstall(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Uninstalling TestDriven.Net Runner", 1)) { RemoveExistingRegistryKeys(progressMonitor); } }
protected override TestResult RunImpl(ITestCommand rootTestCommand, TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Verifying Specifications", rootTestCommand.TestCount)) { if (options.SkipTestExecution) { return(SkipAll(rootTestCommand, parentTestStep)); } else { ITestContext rootContext = rootTestCommand.StartPrimaryChildStep(parentTestStep); TestStep rootStep = rootContext.TestStep; TestOutcome outcome = TestOutcome.Passed; foreach (ITestCommand command in rootTestCommand.Children) { NSpecAssemblyTest assemblyTest = command.Test as NSpecAssemblyTest; if (assemblyTest == null) { continue; } var assemblyResult = this.RunAssembly(command, rootStep); outcome = outcome.CombineWith(assemblyResult.Outcome); } return(rootContext.FinishStep(outcome, null)); } } }
public XcodeSyncBackContext GetChanges(IProgressMonitor monitor, NSObjectInfoService infoService, DotNetProject project) { var ctx = new XcodeSyncBackContext(projectDir, syncTimeCache, infoService, project); var needsSync = new List <XcodeSyncedItem> (items.Where(i => i.NeedsSyncBack(monitor, ctx))); var knownFiles = GetKnownFiles(); if (Directory.Exists(projectDir)) { monitor.BeginTask("Scanning for newly-added files in the Xcode project...", 0); ScanForAddedFiles(monitor, ctx, knownFiles, projectDir, null); monitor.EndTask(); } if (needsSync.Count > 0) { monitor.BeginStepTask(GettextCatalog.GetString("Synchronizing changes made to known files in Xcode back to MonoDevelop..."), needsSync.Count, 1); for (int i = 0; i < needsSync.Count; i++) { var item = needsSync [i]; item.SyncBack(monitor, ctx); monitor.Step(1); } monitor.EndTask(); } return(ctx); }
public void CreateSchemaCommand() { try { TaskService.Errors.Clear(); string xml = Editor.Text; using (IProgressMonitor monitor = XmlEditorService.GetMonitor()) { XmlDocument doc = XmlEditorService.ValidateWellFormedness(monitor, xml, FileName); if (doc == null) { return; } monitor.BeginTask(GettextCatalog.GetString("Creating schema..."), 0); try { string schema = XmlEditorService.CreateSchema(xml); string fileName = XmlEditorService.GenerateFileName(FileName, "{0}.xsd"); IdeApp.Workbench.NewDocument(fileName, "application/xml", schema); monitor.ReportSuccess(GettextCatalog.GetString("Schema created.")); } catch (Exception ex) { string msg = GettextCatalog.GetString("Error creating XML schema."); LoggingService.LogError(msg, ex); monitor.ReportError(msg, ex); } } } catch (Exception ex) { MessageService.ShowError(ex.Message); } }
/// <inheritdoc /> protected override void Execute(UnmanagedTestRepository repository, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Exploring " + repository.FileName, 1)) { BuildTestModel(repository, progressMonitor); } }
public string SaveReportAs(Report report, string fileName, string format, IProgressMonitor progressMonitor) { var file = string.Empty; using (progressMonitor.BeginTask("Generating report", 100)) { var folderName = Path.GetDirectoryName(fileName); var reportContainer = new FileSystemReportContainer(folderName, Path.GetFileNameWithoutExtension(fileName)); var reportWriter = reportManager.CreateReportWriter(report, reportContainer); if (progressMonitor.IsCanceled) throw new OperationCanceledException(); // Delete the report if it already exists reportContainer.DeleteReport(); if (progressMonitor.IsCanceled) throw new OperationCanceledException(); progressMonitor.Worked(10); // Format the report var reportFormatterOptions = new ReportFormatterOptions(); using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(90)) reportManager.Format(reportWriter, format, reportFormatterOptions, subProgressMonitor); if (progressMonitor.IsCanceled) throw new OperationCanceledException(); if (reportWriter.ReportDocumentPaths.Count > 0) file = Path.Combine(folderName, reportWriter.ReportDocumentPaths[0]); } return file; }
/// <summary> /// Loads plugins by recursively searching the plugin paths for *.plugin files. /// </summary> /// <param name="pluginCallback">A function that receives plugin metadata as it /// becomes available, not null.</param> /// <param name="progressMonitor"></param> protected virtual void LoadPlugins(PluginCallback pluginCallback, IProgressMonitor progressMonitor) { if (pluginPaths.Count == 0) { return; } var uniquePluginFilePaths = new GallioHashSet <string>(); using (progressMonitor.BeginTask("Loading plugins", pluginPaths.Count)) { foreach (var pluginPath in pluginPaths) { using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1)) { var pluginDirectory = new DirectoryInfo(pluginPath); if (pluginDirectory.Exists) { LoadPluginsFromDirectory(pluginDirectory, uniquePluginFilePaths, pluginCallback, subProgressMonitor); } else { var pluginFile = new FileInfo(pluginPath); if (pluginFile.Exists) { LoadPluginsFromFile(pluginFile, uniquePluginFilePaths, pluginCallback, subProgressMonitor); } } } } } }
object ReadWorkspaceItemFile(FilePath fileName, IProgressMonitor monitor) { XmlTextReader reader = new XmlTextReader(new StreamReader(fileName)); try { monitor.BeginTask(string.Format(GettextCatalog.GetString("Loading workspace item: {0}"), fileName), 1); reader.MoveToContent(); XmlDataSerializer ser = new XmlDataSerializer(MD1ProjectService.DataContext); ser.SerializationContext.BaseFile = fileName; ser.SerializationContext.ProgressMonitor = monitor; WorkspaceItem entry = (WorkspaceItem)ser.Deserialize(reader, typeof(WorkspaceItem)); entry.ConvertToFormat(MD1ProjectService.FileFormat, false); entry.FileName = fileName; return(entry); } catch (Exception ex) { monitor.ReportError(string.Format(GettextCatalog.GetString("Could not load solution item: {0}"), fileName), ex); throw; } finally { monitor.EndTask(); reader.Close(); } }
protected override DataNode ReadChild(XmlReader reader, DataItem parent) { if (reader.LocalName == "Entries") { if (reader.IsEmptyElement) { reader.Skip(); return(null); } string basePath = Path.GetDirectoryName(baseFile); reader.ReadStartElement(); ArrayList files = new ArrayList(); while (MoveToNextElement(reader)) { string nodefile = reader.GetAttribute("filename"); nodefile = FileService.RelativeToAbsolutePath(basePath, nodefile); files.Add(nodefile); reader.Skip(); } monitor.BeginTask(GettextCatalog.GetString("Loading solution: {0}", baseFile), files.Count); try { foreach (string nodefile in files) { try { if (Path.GetExtension(nodefile).ToLower() == ".mds") { entries.Add(ReadSolutionFolder(nodefile, monitor)); } else { SolutionEntityItem entry = (SolutionEntityItem)Services.ProjectService.ReadSolutionItem(monitor, nodefile); entries.Add(entry); } } catch (Exception ex) { UnknownSolutionItem entry = new UnknownSolutionItem(); entry.FileName = nodefile; entry.LoadError = ex.Message; entries.Add(entry); monitor.ReportError(GettextCatalog.GetString("Could not load item: {0}", nodefile), ex); } monitor.Step(1); } } finally { monitor.EndTask(); } reader.ReadEndElement(); return(null); } return(base.ReadChild(reader, parent)); }
protected override void Execute(IntPtr bridgeFunc, IProgressMonitor subMonitor) { using (subMonitor.BeginTask("Exploring " + File.Name, 100)) { BoostTestExploreDelegate bridge = (BoostTestExploreDelegate)Marshal.GetDelegateForFunctionPointer( bridgeFunc, typeof(BoostTestExploreDelegate) ); VisitorDelegate visitTestCase = new VisitorDelegate(VisitTestCase); VisitorDelegate beginVisitTestSuite = new VisitorDelegate(BeginVisitTestSuite); VisitorDelegate endVisitTestSuite = new VisitorDelegate(EndVisitTestSuite); ErrorReporterDelegate errorReporter = new ErrorReporterDelegate((text) => Logger.Log(LogSeverity.Error, text)); bridge( File.FullName, visitTestCase, beginVisitTestSuite, endVisitTestSuite, errorReporter ); TestModelSerializer.PublishTestModel(TestModel, MessageSink); } }
private void MakeStaticLibrary(Project project, ProjectFileCollection projectFiles, CProjectConfiguration configuration, ProjectPackageCollection packages, CompilerResults cr, IProgressMonitor monitor, string outputName) { if (!NeedsUpdate(projectFiles, configuration, outputName)) { return; } string objectFiles = string.Join(" ", ObjectFiles(projectFiles, configuration, true)); string args = string.Format("rcs \"{0}\" {1}", outputName, objectFiles); monitor.BeginTask(GettextCatalog.GetString("Generating static library {0} from object files", Path.GetFileName(outputName)), 1); string errorOutput; int exitCode = ExecuteCommand("ar", args, Path.GetDirectoryName(outputName), monitor, out errorOutput); if (exitCode == 0) { monitor.Step(1); } monitor.EndTask(); ParseCompilerOutput(errorOutput, cr); ParseLinkerOutput(errorOutput, cr); CheckReturnCode(exitCode, cr); }
public void Save(string projectLocation, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Saving project", 100)) { eventAggregator.Send(this, new SavingProject()); if (string.IsNullOrEmpty(projectLocation)) { projectLocation = projectTreeModel.FileName; } var dir = Path.GetDirectoryName(projectLocation); if (fileSystem.DirectoryExists(dir) == false) { fileSystem.CreateDirectory(dir); } progressMonitor.Worked(10); testProjectManager.SaveProject(projectTreeModel.TestProject, new FileInfo(projectLocation)); progressMonitor.Worked(50); eventAggregator.Send(this, new ProjectSaved(projectLocation)); } }
private void ExploreOrRun(ITestIsolationContext testIsolationContext, TestPackage testPackage, TestExplorationOptions testExplorationOptions, TestExecutionOptions testExecutionOptions, IMessageSink messageSink, IProgressMonitor progressMonitor, string taskName) { using (progressMonitor.BeginTask(taskName, 1)) { if (progressMonitor.IsCanceled) { return; } FileInfo testDriverScriptFile = GetTestDriverScriptFile(testPackage); if (testDriverScriptFile == null) { return; } HostSetup hostSetup = CreateHostSetup(testPackage); ScriptRuntimeSetup scriptRuntimeSetup = CreateScriptRuntimeSetup(testPackage); string testDriverScriptPath = testDriverScriptFile.FullName; var remoteMessageSink = new RemoteMessageSink(messageSink); var remoteLogger = new RemoteLogger(logger); using (var remoteProgressMonitor = new RemoteProgressMonitor(progressMonitor.CreateSubProgressMonitor(1))) { testIsolationContext.RunIsolatedTask <ExploreOrRunTask>(hostSetup, (statusMessage) => progressMonitor.SetStatus(statusMessage), new object[] { testPackage, scriptRuntimeSetup, testDriverScriptPath, testExplorationOptions, testExecutionOptions, remoteMessageSink, remoteProgressMonitor, remoteLogger }); } } }
internal bool Build(IProgressMonitor monitor) { monitor.BeginTask("Package: " + Description, 1); DeployContext ctx = null; try { ctx = CreateDeployContext(); if (ctx != null) { ctx.FileFilter = this; } if (!OnBuild(monitor, ctx)) { monitor.AsyncOperation.Cancel(); return(false); } } catch (Exception ex) { monitor.ReportError("Package creation failed", ex); LoggingService.LogError("Package creation failed", ex); monitor.AsyncOperation.Cancel(); return(false); } finally { monitor.EndTask(); if (ctx != null) { ctx.Dispose(); } } return(true); }
public static BuildResult CompileXibFiles (IProgressMonitor monitor, IEnumerable<ProjectFile> files, FilePath outputRoot) { var result = new BuildResult (); var ibfiles = GetIBFilePairs (files, outputRoot).Where (NeedsBuilding).ToList (); if (ibfiles.Count > 0) { monitor.BeginTask (GettextCatalog.GetString ("Compiling interface definitions"), 0); foreach (var file in ibfiles) { file.EnsureOutputDirectory (); var args = new ProcessArgumentBuilder (); args.AddQuoted (file.Input); args.Add ("--compile"); args.AddQuoted (file.Output); var psi = new ProcessStartInfo ("ibtool", args.ToString ()); monitor.Log.WriteLine (psi.FileName + " " + psi.Arguments); psi.WorkingDirectory = outputRoot; string errorOutput; int code; try { code = ExecuteCommand (monitor, psi, out errorOutput); } catch (System.ComponentModel.Win32Exception ex) { LoggingService.LogError ("Error running ibtool", ex); result.AddError (null, 0, 0, null, "ibtool not found. Please ensure the Apple SDK is installed."); return result; } if (code != 0) { //FIXME: parse the plist that ibtool returns result.AddError (null, 0, 0, null, "ibtool returned error code " + code); } } monitor.EndTask (); } return result; }
protected override void OnClean(IProgressMonitor monitor, ConfigurationSelector configuration) { SetDirty(); ProjectConfiguration config = GetConfiguration(configuration) as ProjectConfiguration; if (config == null) { monitor.ReportError(GettextCatalog.GetString("Configuration '{0}' not found in project '{1}'", config.Id, Name), null); return; } monitor.BeginTask(GettextCatalog.GetString("Performing clean..."), 0); // Delete generated files foreach (FilePath file in GetOutputFiles(configuration)) { if (File.Exists(file)) { FileService.DeleteFile(file); if (file.ParentDirectory.CanonicalPath != config.OutputDirectory.CanonicalPath && Directory.GetFiles(file.ParentDirectory).Length == 0) { FileService.DeleteDirectory(file.ParentDirectory); } } } DeleteSupportFiles(monitor, configuration); DoClean(monitor, config.Selector); monitor.Log.WriteLine(); monitor.Log.WriteLine(GettextCatalog.GetString("Clean complete")); monitor.EndTask(); }
protected override TestResult RunImpl( ITestCommand rootTestCommand, TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor ) { using(progressMonitor.BeginTask( "Verifying Specifications", rootTestCommand.TestCount ) ) { if( options.SkipTestExecution ) { return SkipAll( rootTestCommand, parentTestStep ); } else { ITestContext rootContext = rootTestCommand.StartPrimaryChildStep( parentTestStep ); TestStep rootStep = rootContext.TestStep; TestOutcome outcome = TestOutcome.Passed; foreach( ITestCommand command in rootTestCommand.Children ) { NSpecAssemblyTest assemblyTest = command.Test as NSpecAssemblyTest; if( assemblyTest == null ) continue; var assemblyResult = this.RunAssembly( command, rootStep ); outcome = outcome.CombineWith( assemblyResult.Outcome ); } return rootContext.FinishStep( outcome, null ); } } }
private void SafeCopy(IPluginDescriptor plugin, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask(string.Format("Copying {0} plugin", plugin.PluginId), plugin.FilePaths.Count)) { var sourceFolder = Path.Combine(sourcePluginFolder, plugin.RecommendedInstallationPath); var targetFolder = Path.Combine(targetPluginFolder, plugin.RecommendedInstallationPath); foreach (var file in plugin.FilePaths) { var sourceFileInfo = new FileInfo(Path.Combine(sourceFolder, file)); var destination = new FileInfo(Path.Combine(targetFolder, file)); try { if (fileSystem.DirectoryExists(destination.DirectoryName) == false) fileSystem.CreateDirectory(destination.DirectoryName); fileSystem.CopyFile(sourceFileInfo.FullName, destination.FullName, true); } catch (Exception ex) { exceptionPolicy.Report(string.Format("Error copying file: {0}", file), ex); } } } }
/// <summary> /// Cleans the files produced by this solution item /// </summary> /// <param name='monitor'> /// A progress monitor /// </param> /// <param name='configuration'> /// Configuration to use to clean the project /// </param> public void Clean(IProgressMonitor monitor, ConfigurationSelector configuration) { ITimeTracker tt = Counters.BuildProjectTimer.BeginTiming("Cleaning " + Name); try { //SolutionFolder handles the begin/end task itself, don't duplicate if (this is SolutionFolder) { RunTarget(monitor, ProjectService.CleanTarget, configuration); return; } try { SolutionEntityItem it = this as SolutionEntityItem; SolutionItemConfiguration iconf = it != null?it.GetConfiguration(configuration) : null; string confName = iconf != null ? iconf.Id : configuration.ToString(); monitor.BeginTask(GettextCatalog.GetString("Cleaning: {0} ({1})", Name, confName), 1); RunTarget(monitor, ProjectService.CleanTarget, configuration); } finally { monitor.EndTask(); } } finally { tt.End(); } }
public void WriteFile (string file, object obj, MSBuildFileFormat format, bool saveProjects, IProgressMonitor monitor) { Solution sol = (Solution) obj; string tmpfilename = String.Empty; try { monitor.BeginTask (GettextCatalog.GetString ("Saving solution: {0}", file), 1); try { if (File.Exists (file)) tmpfilename = Path.GetTempFileName (); } catch (IOException) { } string baseDir = Path.GetDirectoryName (file); if (tmpfilename == String.Empty) { WriteFileInternal (file, sol, baseDir, format, saveProjects, monitor); } else { WriteFileInternal (tmpfilename, sol, baseDir, format, saveProjects, monitor); FileService.SystemRename (tmpfilename, file); } } catch (Exception ex) { monitor.ReportError (GettextCatalog.GetString ("Could not save solution: {0}", file), ex); LoggingService.LogError (GettextCatalog.GetString ("Could not save solution: {0}", file), ex); if (!String.IsNullOrEmpty (tmpfilename) && File.Exists (tmpfilename)) File.Delete (tmpfilename); throw; } finally { monitor.EndTask (); } }
/// <summary> /// Checks that the xml in this view is well-formed. /// </summary> public static XmlDocument ValidateWellFormedness(IProgressMonitor monitor, string xml, string fileName) { monitor.BeginTask(GettextCatalog.GetString("Validating XML..."), 1); bool error = false; XmlDocument doc = null; try { doc = new XmlDocument(); doc.LoadXml(xml); } catch (XmlException ex) { monitor.ReportError(ex.Message, ex); AddTask(fileName, ex.Message, ex.LinePosition, ex.LineNumber, TaskSeverity.Error); error = true; } if (error) { monitor.Log.WriteLine(GettextCatalog.GetString("Validation failed.")); TaskService.ShowErrors(); } else { monitor.Log.WriteLine(GettextCatalog.GetString("XML is valid.")); } monitor.EndTask(); return(error? null: doc); }
protected internal override TestResult RunImpl(ITestCommand rootTestCommand, TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Running tests.", rootTestCommand.TestCount)) { return RunTest(rootTestCommand, parentTestStep, options, progressMonitor); } }
/// <inheritdoc /> protected override TestResult RunImpl(ITestCommand rootTestCommand, TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor) { ThrowIfDisposed(); using (progressMonitor.BeginTask(Resources.MbUnit2TestController_RunningMbUnitTests, 1)) { if (progressMonitor.IsCanceled) return new TestResult(TestOutcome.Canceled); if (options.SkipTestExecution) { return SkipAll(rootTestCommand, parentTestStep); } else { IList<ITestCommand> testCommands = rootTestCommand.GetAllCommands(); using (InstrumentedFixtureRunner fixtureRunner = new InstrumentedFixtureRunner(fixtureExplorer, testCommands, progressMonitor, parentTestStep)) { return fixtureRunner.Run(); } } } }
public static BuildResult CompileXibFiles (IProgressMonitor monitor, IEnumerable<ProjectFile> files, FilePath outputRoot) { var result = new BuildResult (); var ibfiles = GetIBFilePairs (files, outputRoot).Where (NeedsBuilding).ToList (); if (ibfiles.Count > 0) { monitor.BeginTask (GettextCatalog.GetString ("Compiling interface definitions"), 0); foreach (var file in ibfiles) { file.EnsureOutputDirectory (); var psi = new ProcessStartInfo ("ibtool", String.Format ("\"{0}\" --compile \"{1}\"", file.Input, file.Output) ); monitor.Log.WriteLine (psi.FileName + " " + psi.Arguments); psi.WorkingDirectory = outputRoot; string errorOutput; int code; try { code = ExecuteCommand (monitor, psi, out errorOutput); } catch (System.ComponentModel.Win32Exception ex) { LoggingService.LogError ("Error running ibtool", ex); result.AddError (null, 0, 0, null, "ibtool not found. Please ensure the Apple SDK is installed."); return result; } if (code != 0) { //FIXME: parse the plist that ibtool returns result.AddError (null, 0, 0, null, "ibtool returned error code " + code); } } monitor.EndTask (); } return result; }
public override void Install(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Installing TestDriven.Net Runner", testFrameworkManager.TestFrameworkHandles.Count + 2)) { // Remove old registrations. RemoveExistingRegistryKeys(progressMonitor); progressMonitor.Worked(1); // Register Icarus string icarusPath = FindIcarusPath(); if (icarusPath != null) InstallRegistryKeysForIcarus(icarusPath, progressMonitor); progressMonitor.Worked(1); // Register frameworks foreach (ComponentHandle<ITestFramework, TestFrameworkTraits> testFrameworkHandle in testFrameworkManager.TestFrameworkHandles) { TestFrameworkTraits testFrameworkTraits = testFrameworkHandle.GetTraits(); TDNetRunnerInstallationMode installationMode = preferenceManager.GetInstallationModeForFramework(testFrameworkHandle.Id); if (installationMode != TDNetRunnerInstallationMode.Disabled) { int priority = installationMode == TDNetRunnerInstallationMode.Default ? 25 : 5; foreach (AssemblySignature frameworkAssembly in testFrameworkTraits.FrameworkAssemblies) { InstallRegistryKeysForFramework(testFrameworkTraits.Name, frameworkAssembly, priority, progressMonitor); } } progressMonitor.Worked(1); } } }
public void RunXslTransformCommand() { if (string.IsNullOrEmpty(stylesheetFileName)) { stylesheetFileName = XmlEditorService.BrowseForStylesheetFile(); if (string.IsNullOrEmpty(stylesheetFileName)) { return; } } using (IProgressMonitor monitor = XmlEditorService.GetMonitor()) { try { string xsltContent; try { xsltContent = GetFileContent(stylesheetFileName); } catch (System.IO.IOException) { monitor.ReportError( GettextCatalog.GetString("Error reading file '{0}'.", stylesheetFileName), null); return; } System.Xml.Xsl.XslTransform xslt = XmlEditorService.ValidateStylesheet(monitor, xsltContent, stylesheetFileName); if (xslt == null) { return; } XmlDocument doc = XmlEditorService.ValidateXml(monitor, Editor.Text, FileName); if (doc == null) { return; } string newFileName = XmlEditorService.GenerateFileName(FileName, "-transformed{0}.xml"); monitor.BeginTask(GettextCatalog.GetString("Executing transform..."), 1); using (XmlTextWriter output = XmlEditorService.CreateXmlTextWriter(Document)) { xslt.Transform(doc, null, output); IdeApp.Workbench.NewDocument( newFileName, "application/xml", output.ToString()); } monitor.ReportSuccess(GettextCatalog.GetString("Transform completed.")); monitor.EndTask(); } catch (Exception ex) { string msg = GettextCatalog.GetString("Could not run transform."); monitor.ReportError(msg, ex); monitor.EndTask(); } } }
static void ReparseProjectsInternal() { bool parsing = false; ParseProjectContent job; IProgressMonitor progressMonitor = StatusBarService.CreateProgressMonitor(); while (true) { // get next job lock (reParse1) { if (reParse1.Count > 0) { if (parsing) { progressMonitor.Done(); } parsing = false; job = reParse1.Dequeue(); } else if (reParse2.Count > 0) { if (!parsing) { int workAmount = 0; foreach (ParseProjectContent ppc in reParse2) { workAmount += ppc.GetInitializationWorkAmount(); } progressMonitor.BeginTask("${res:ICSharpCode.SharpDevelop.Internal.ParserService.Parsing}...", workAmount, false); } parsing = true; job = reParse2.Dequeue(); } else { // all jobs done reParseThread = null; if (parsing) { progressMonitor.Done(); } LoggingService.Info("reParse thread finished all jobs"); return; } } // execute job if (parsing) { LoggingService.Info("reparsing code for " + job.Project); job.ReInitialize2(progressMonitor); } else { LoggingService.Debug("reloading references for " + job.Project); job.ReInitialize1(progressMonitor); } } }
/// <summary> /// This method can be used in three modes: /// 1. Find references to classes (parentClass = targetClass, member = null, isLocal = false) /// 2. Find references to members (parentClass = parent, member = member, isLocal = false) /// 3. Find references to local variables (parentClass = parent, member = local var as field, isLocal = true) /// </summary> static List <Reference> RunFindReferences(IClass ownerClass, IMember member, bool isLocal, IProgressMonitor progressMonitor) { if (ParserService.LoadSolutionProjectsThreadRunning) { progressMonitor.ShowingDialog = true; MessageService.ShowMessage("${res:SharpDevelop.Refactoring.LoadSolutionProjectsThreadRunning}"); progressMonitor.ShowingDialog = false; return(null); } List <ProjectItem> files; if (isLocal) { files = new List <ProjectItem>(); files.Add(FindItem(ownerClass.CompilationUnit.FileName)); } else { ownerClass = ownerClass.GetCompoundClass(); files = GetPossibleFiles(ownerClass, member); } ParseableFileContentEnumerator enumerator = new ParseableFileContentEnumerator(files.ToArray()); List <Reference> references = new List <Reference>(); try { if (progressMonitor != null) { progressMonitor.BeginTask("${res:SharpDevelop.Refactoring.FindingReferences}", files.Count, true); } #if DEBUG if (System.Windows.Forms.Control.ModifierKeys == System.Windows.Forms.Keys.Control) { System.Diagnostics.Debugger.Break(); } #endif while (enumerator.MoveNext()) { if (progressMonitor != null) { progressMonitor.WorkDone = enumerator.Index; if (progressMonitor.IsCancelled) { return(null); } } AddReferences(references, ownerClass, member, isLocal, enumerator.CurrentFileName, enumerator.CurrentFileContent); } } finally { if (progressMonitor != null) { progressMonitor.Done(); } enumerator.Dispose(); } return(references); }
public void Execute(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Loading test package", 100)) { SetTestPackage(progressMonitor); ExploreTests(progressMonitor); } }
/// <inheritdoc /> protected override object Execute(InstallationConfiguration arguments, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Saving runtime configuration changes.", 1)) { arguments.SaveAdditionalPluginDirectoriesToRegistry(); return(null); } }
/// <inheritdoc /> protected override void ExploreImpl(ITestIsolationContext testIsolationContext, TestPackage testPackage, TestExplorationOptions testExplorationOptions, IMessageSink messageSink, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Exploring unsupported tests.", Math.Max(testPackage.Files.Count, 1))) { PublishTestModelFromFiles(testPackage.Files, messageSink, progressMonitor); } }
public ProgressMonitorWrapperJob (IAnalysisJob wrappedJob, string message) { this.wrappedJob = wrappedJob; monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (message, null, false); var work = wrappedJob.GetFiles ().Sum (f => wrappedJob.GetIssueProviders (f).Count ()); monitor.BeginTask (message, work); }
public void Execute(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Opening report", 100)) { if (!string.IsNullOrEmpty(FileName)) fileSystem.OpenFile(FileName); } }
public ProgressMonitorWrapperJob(IAnalysisJob wrappedJob, string message) { this.wrappedJob = wrappedJob; monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor(message, null, false); var work = wrappedJob.GetFiles().Sum(f => wrappedJob.GetIssueProviders(f).Count()); monitor.BeginTask(message, work); }
/// <inheritdoc /> sealed protected override void DescribeImpl(IReflectionPolicy reflectionPolicy, IList <ICodeElementInfo> codeElements, TestExplorationOptions testExplorationOptions, IMessageSink messageSink, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask(string.Format("Describing {0} tests.", FrameworkName), 100)) { progressMonitor.SetStatus("Building the test model."); GenerateTestModel(reflectionPolicy, codeElements, messageSink); } }
public void Execute(IProgressMonitor progressMonitor) { if (string.IsNullOrEmpty(FileName)) throw new Exception("No filename provided to delete."); using (progressMonitor.BeginTask("Deleting report", 100)) fileSystem.DeleteFile(FileName); }
public void Execute(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Saving project", 100)) { SaveCurrentTestFilter(progressMonitor); SaveProject(progressMonitor); SaveUserOptions(progressMonitor); } }
public void Execute(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask(Resources.OpeningProject, 100)) { ResetTestStatus(progressMonitor); OpenProject(progressMonitor); LoadPackage(progressMonitor); RestoreTestFilter(progressMonitor); } }
/// <inheritdoc /> public override void Install(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Installing report resources.", 1)) { using (var cssWriter = new StreamWriter(generatedCssFile.Open(FileMode.Create, FileAccess.Write, FileShare.None))) { GenerateTestKinds(cssWriter); } } }
public void Execute(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask(Resources.ComparePluginsCommand_Comparing_source_and_target_plugins, sourcePlugins.PluginDescriptors.Count)) { foreach (var plugin in sourcePlugins.PluginDescriptors) { } } }
public void Execute(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Reloading", 100)) { SaveCurrentState(progressMonitor); LoadPackage(progressMonitor); RestoreTestFilter(progressMonitor); if (optionsController.RunTestsAfterReload) RunTests(progressMonitor); } }
public void Execute(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask(Resources.UpdatePluginFolderCommand_Updating_list_of_plugins, 100)) { var registry = new Registry(); var pluginLoader = SetupPluginLoader(progressMonitor); var pluginCatalog = PopulateCatalog(progressMonitor, pluginLoader); ApplyCatalogToRegistry(progressMonitor, pluginCatalog, registry); PluginTreeModel.UpdatePluginList(registry); eventAggregator.Send(this, new PluginFolderUpdated(folder)); } }
/// <inheritdoc /> protected override void Execute(UnmanagedTestRepository repository, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Running " + repository.FileName, 4)) { progressMonitor.SetStatus("Building the test model."); BuildTestModel(repository, progressMonitor); progressMonitor.Worked(1); progressMonitor.SetStatus("Running the tests."); RunTests(repository, progressMonitor); progressMonitor.Worked(3); } }
public List<WorkItem> LoadByWorkItem(IProgressMonitor progress) { var ids = this.clientService.GetWorkItemIds(this.query, CachedMetaData.Instance.Fields); var list = new List<WorkItem>(); progress.BeginTask("Loading WorkItems", ids.Count); foreach (var id in ids) { list.Add(clientService.GetWorkItem(id)); progress.Step(1); } progress.EndTask(); return list; }
public void Execute(IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask(Resources.RunTestsCommand_Running_tests, 100)) { ResetTestStatus(progressMonitor); SaveLastRunFilter(progressMonitor); RunTests(progressMonitor); GenerateReport(progressMonitor); } }
public void Execute(IProgressMonitor progressMonitor) { if (files.Count == 0) return; using (progressMonitor.BeginTask("Copying files", files.Count)) { foreach (var file in files) { using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1)) CopyFile(subProgressMonitor, file); } } }
public void Execute(IProgressMonitor progressMonitor) { if (sourcePlugins.Count == 0) return; using (progressMonitor.BeginTask("Copying plugins", sourcePlugins.Count)) { foreach (var plugin in sourcePlugins) { using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1)) SafeCopy(plugin, subProgressMonitor); } } }
protected override TestResult RunImpl(ITestCommand rootTestCommand, TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask(Resources.XunitTestController_RunningXunitTests, rootTestCommand.TestCount)) { if (options.SkipTestExecution) { return SkipAll(rootTestCommand, parentTestStep); } else { return RunTest(rootTestCommand, parentTestStep, progressMonitor); } } }