/// <summary> /// Starts to run a build inside the SharpDevelop GUI. /// Only one build can run inside the GUI at one time. /// </summary> /// <param name="project">The project/solution to build.</param> /// <param name="options">The build options.</param> public static void BuildInGui(IBuildable project, BuildOptions options) { if (project == null) throw new ArgumentNullException("project"); if (options == null) throw new ArgumentNullException("options"); WorkbenchSingleton.AssertMainThread(); if (guiBuildCancellation != null) { BuildResults results = new BuildResults(); WorkbenchSingleton.StatusBar.SetMessage(Core.ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning")); BuildError error = new BuildError(null, Core.ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning")); results.Add(error); TaskService.Add(new Task(error)); results.Result = BuildResultCode.MSBuildAlreadyRunning; if (options.Callback != null) { options.Callback(results); } } else { guiBuildCancellation = new CancellationTokenSource(); IProgressMonitor progressMonitor = WorkbenchSingleton.StatusBar.CreateProgressMonitor(guiBuildCancellation.Token); guiBuildTrackedFeature = AnalyticsMonitorService.TrackFeature("ICSharpCode.SharpDevelop.Project.BuildEngine.Build"); WorkbenchSingleton.StatusBar.SetMessage(StringParser.Parse("${res:MainWindow.CompilerMessages.BuildVerb}...")); ProjectService.RaiseEventBuildStarted(new BuildEventArgs(project, options)); StartBuild(project, options, new MessageViewSink(TaskService.BuildMessageViewCategory, progressMonitor, WorkbenchSingleton.StatusBar)); } }
/// <summary> /// Starts to run a build inside the SharpDevelop GUI. /// Only one build can run inside the GUI at one time. /// </summary> /// <param name="project">The project/solution to build.</param> /// <param name="options">The build options.</param> public static void BuildInGui(IBuildable project, BuildOptions options) { if (project == null) { throw new ArgumentNullException("project"); } if (options == null) { throw new ArgumentNullException("options"); } WorkbenchSingleton.AssertMainThread(); if (guiBuildProgressMonitor != null) { BuildResults results = new BuildResults(); results.Add(new BuildError(null, Core.ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning"))); results.Result = BuildResultCode.MSBuildAlreadyRunning; if (options.Callback != null) { options.Callback(results); } } else { guiBuildProgressMonitor = new CancellableProgressMonitor(StatusBarService.CreateProgressMonitor()); Gui.WorkbenchSingleton.Workbench.GetPad(typeof(Gui.CompilerMessageView)).BringPadToFront(); GuiBuildStarted.RaiseEvent(null, new BuildEventArgs(project, options)); StartBuild(project, options, new MessageViewSink(TaskService.BuildMessageViewCategory), guiBuildProgressMonitor); } }
/// <summary> /// Starts to run a build inside the SharpDevelop GUI. /// Only one build can run inside the GUI at one time. /// </summary> /// <param name="project">The project/solution to build.</param> /// <param name="options">The build options.</param> public static void BuildInGui(IBuildable project, BuildOptions options) { if (project == null) { throw new ArgumentNullException("project"); } if (options == null) { throw new ArgumentNullException("options"); } WorkbenchSingleton.AssertMainThread(); if (guiBuildCancellation != null) { BuildResults results = new BuildResults(); WorkbenchSingleton.StatusBar.SetMessage(Core.ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning")); BuildError error = new BuildError(null, Core.ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning")); results.Add(error); TaskService.Add(new Task(error)); results.Result = BuildResultCode.MSBuildAlreadyRunning; if (options.Callback != null) { options.Callback(results); } } else { guiBuildCancellation = new CancellationTokenSource(); IProgressMonitor progressMonitor = WorkbenchSingleton.StatusBar.CreateProgressMonitor(guiBuildCancellation.Token); guiBuildTrackedFeature = AnalyticsMonitorService.TrackFeature("ICSharpCode.SharpDevelop.Project.BuildEngine.Build"); WorkbenchSingleton.StatusBar.SetMessage(StringParser.Parse("${res:MainWindow.CompilerMessages.BuildVerb}...")); ProjectService.RaiseEventBuildStarted(new BuildEventArgs(project, options)); StartBuild(project, options, new MessageViewSink(TaskService.BuildMessageViewCategory, progressMonitor, WorkbenchSingleton.StatusBar)); } }
public void Run(Solution solution, IProject project, BuildOptions options) { if (isRunning) { BuildResults results = new BuildResults(); results.Result = BuildResultCode.MSBuildAlreadyRunning; results.Add(new BuildError(null, ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning"))); if (options.Callback != null) { options.Callback(results); } } else { isRunning = true; Thread thread = new Thread(new BuildRun(solution, project, options, this).RunMainBuild); thread.Name = "MSBuildEngine main worker"; thread.SetApartmentState(ApartmentState.STA); thread.Start(); } }
/// <summary> /// Notifies the callback hooks that the build is done. /// </summary> void ReportDone() { if (combinedBuildFeedbackSink != null) { if (combinedBuildFeedbackSink is MessageViewSink) { // Special case GUI-builds so that they have more information available: // (non-GUI builds can get the same information from the options.Callback, // but the GUI cannot use the callback because the build options are set by // the code triggering the build) ((MessageViewSink)combinedBuildFeedbackSink).Done(rootProject, options, results); } else { combinedBuildFeedbackSink.Done(results.Result == BuildResultCode.Success); } } if (options.Callback != null) { Gui.WorkbenchSingleton.SafeThreadAsyncCall(delegate { options.Callback(results); }); } }
/// <summary> /// Starts to run a build inside the SharpDevelop GUI. /// Only one build can run inside the GUI at one time. /// </summary> /// <param name="project">The project/solution to build.</param> /// <param name="options">The build options.</param> public static void BuildInGui(IBuildable project, BuildOptions options) { if (project == null) throw new ArgumentNullException("project"); if (options == null) throw new ArgumentNullException("options"); WorkbenchSingleton.AssertMainThread(); if (guiBuildProgressMonitor != null) { BuildResults results = new BuildResults(); results.Add(new BuildError(null, Core.ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning"))); results.Result = BuildResultCode.MSBuildAlreadyRunning; if (options.Callback != null) { options.Callback(results); } } else { guiBuildProgressMonitor = new CancellableProgressMonitor(StatusBarService.CreateProgressMonitor()); Gui.WorkbenchSingleton.Workbench.GetPad(typeof(Gui.CompilerMessageView)).BringPadToFront(); GuiBuildStarted.RaiseEvent(null, new BuildEventArgs(project, options)); StartBuild(project, options, new MessageViewSink(TaskService.BuildMessageViewCategory), guiBuildProgressMonitor); } }
public void Run(Solution solution, IProject project, BuildOptions options) { if (isRunning) { BuildResults results = new BuildResults(); results.Result = BuildResultCode.MSBuildAlreadyRunning; results.Add(new BuildError(null, ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning"))); if (options.Callback != null) { options.Callback(results); } } else { isRunning = true; Thread thread = new Thread(new BuildRun(solution, project, options, this).RunMainBuild); thread.Name = "MSBuildEngine main worker"; thread.SetApartmentState(ApartmentState.STA); thread.Start(); } }