internal ProjectServiceExtension GetNext (IBuildTarget item)
		{
			if (Next.SupportsItem (item))
				return Next;
			else
				return Next.GetNext (item);
		}
		public virtual object GetService (IBuildTarget item, Type type)
		{
			if (type.IsInstanceOfType (this))
				return this;
			else
				return GetNext (item).GetService (item, type);
		}
		public override bool SupportsItem (IBuildTarget item)
		{
			if (!IdeApp.IsInitialized)
				return false;
			
			DotNetProject project = item as DotNetProject;
			return project != null && GtkDesignInfo.HasDesignedObjects (project);
		}
        protected override BuildResult Build(MonoDevelop.Core.IProgressMonitor monitor, IBuildTarget item, ConfigurationSelector configuration)
        {
            try {
                return base.Build(monitor, item, configuration);
            } finally {

            }
        }
		public override BuildResult RunTarget (IProgressMonitor monitor, IBuildTarget item, string target, ConfigurationSelector configuration)
		{
			var solutionItem = item as SolutionItem;
			if (solutionItem == null)
				return base.RunTarget (monitor, item, target, configuration);

			return solutionItem.ParentSolution.Build (monitor, configuration);
		}
Example #6
0
		public void ClearErrors ()
		{
			errors.Clear ();
			warningCount = errorCount = 0;
			buildCount = 1;
			failedBuildCount = 0;
			compilerOutput = "";
			sourceTarget = null;
		}
		public override bool CanExecute (IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
		{
			var retval = false;
			if(item is DotNetProject)
			{
				var p = item as DotNetProject;
				retval = p.References.Any(y=>y.Reference.Contains("manos"));
			}
			return retval || base.CanExecute(item,context, configuration);
		}
Example #8
0
		public static IAsyncOperation Debug (this ProjectOperations opers, IBuildTarget entry)
		{
			if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
				return opers.CurrentRunOperation;

			ExecutionContext context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget);

			IAsyncOperation op = opers.Execute (entry, context);
			return op;
		}
		public override bool CanExecute (IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
		{
			// We check for DefaultExecutionHandlerFactory because the tests can't run using any other execution mode
			
			bool res = base.CanExecute (item, context, configuration);
			if (!res && (item is IWorkspaceObject)) {
				UnitTest test = NUnitService.Instance.FindRootTest ((IWorkspaceObject)item);
				return (test != null) && test.CanRun (context.ExecutionHandler);
			} else
				return res;
		}
		void HandleTreeSelectionChanged (object sender, EventArgs e)
		{
			TreeIter it;
			if (tree.Selection.GetSelected (out it))
				currentSelection = (IBuildTarget) store.GetValue (it, 2);
			else
				currentSelection = null;
			
			if (SelectionChanged != null)
				SelectionChanged (this, EventArgs.Empty);
		}
Example #11
0
		public static IAsyncOperation Profile (IProfiler profiler, IBuildTarget entry)
		{
			if (IdeApp.ProjectOperations.CurrentRunOperation != null
			       && !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
			       return IdeApp.ProjectOperations.CurrentRunOperation;
			
			SwitchWorkbenchContext (ProfileWorkbenchContext);
			ExecutionContext context = new ExecutionContext (profiler.GetDefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);
			
			return IdeApp.ProjectOperations.Execute (entry, context);
		}
		/// <summary>
		/// Launch Unity project
		/// </summary>
		public override void Execute (MonoDevelop.Core.IProgressMonitor monitor, IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
		{
			if (CanExecuteProject (item as Project, context)) {
				DispatchService.GuiDispatch (delegate {
					IdeApp.Workbench.CurrentLayout = "Debug";
					IdeApp.ProjectOperations.CurrentRunOperation = context.ExecutionHandler.Execute (new UnityExecutionCommand (item.BaseDirectory.FullPath), context.ConsoleFactory.CreateConsole (true));
				});
			} else {
				base.Execute (monitor, item, context, configuration);
			}
		}
		public static IAsyncOperation Debug (this ProjectOperations opers, IBuildTarget entry)
		{
			if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
				return opers.CurrentRunOperation;

			string oldLayout = IdeApp.Workbench.CurrentLayout;
			IdeApp.Workbench.CurrentLayout = "Debug";

			ExecutionContext context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget);

			IAsyncOperation op = opers.Execute (entry, context);
			op.Completed += delegate {
				Gtk.Application.Invoke (delegate {
					IdeApp.Workbench.CurrentLayout = oldLayout;
				});
			};
			return op;
		}
        void OnToggled(object sender, Gtk.ToggledArgs args)
        {
            TreeIter iter;

            store.GetIterFromString(out iter, args.Path);
            IBuildTarget ob = (IBuildTarget)store.GetValue(iter, 2);

            if (activeItems.Contains(ob))
            {
                activeItems.Remove(ob);
                if (CascadeCheckboxSelection)
                {
                    foreach (var i in GetAllChildren(ob))
                    {
                        activeItems.Remove(i);
                    }
                    SetSelection(iter, null, new HashSet <IBuildTarget> ());
                }
                else
                {
                    store.SetValue(iter, 3, false);
                }
            }
            else
            {
                activeItems.Add(ob);
                if (CascadeCheckboxSelection)
                {
                    foreach (var i in GetAllChildren(ob))
                    {
                        activeItems.Add(i);
                    }
                    SetSelection(iter, null, activeItems);
                }
                else
                {
                    store.SetValue(iter, 3, true);
                }
            }
            if (ActiveChanged != null)
            {
                ActiveChanged(this, EventArgs.Empty);
            }
        }
Example #15
0
        protected override void Run(object dataItem)
        {
            IExecutionHandler h      = ExecutionModeCommandService.GetExecutionModeForCommand(dataItem);
            IBuildTarget      target = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;

            if (h == null || !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
            {
                return;
            }

            var op = IdeApp.ProjectOperations.CheckAndBuildForExecute(target);

            op.Completed += delegate {
                if (op.Success)
                {
                    IdeApp.ProjectOperations.Execute(target, h);
                }
            };
        }
        void Fill()
        {
            IBuildTarget sel = SelectedItem;

            store.Clear();
            if (rootItem is RootWorkspace)
            {
                foreach (var item in ((RootWorkspace)rootItem).Items)
                {
                    AddEntry(TreeIter.Zero, item);
                }
                SelectedItem = sel;
            }
            else if (rootItem != null)
            {
                AddEntry(TreeIter.Zero, rootItem);
                SelectedItem = sel;
            }
        }
 IEnumerable <IBuildTarget> GetChildren(IBuildTarget item)
 {
     if (item is SolutionFolder)
     {
         return(((SolutionFolder)item).Items);
     }
     else if (item is Solution)
     {
         return(((Solution)item).RootFolder.Items);
     }
     else if (item is Workspace)
     {
         return(((Workspace)item).Items);
     }
     else
     {
         return(new IBuildTarget [0]);
     }
 }
Example #18
0
        /// <summary>
        /// Launch Unity project
        /// </summary>
        public override void Execute(IProgressMonitor monitor, IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
        {
            var project = item as Project;
            var target  = context.ExecutionTarget as UnityExecutionTarget;

            if (!CanExecuteProject(project) || target == null)
            {
                base.Execute(monitor, item, context, configuration);
                return;
            }

            if (target.Id.StartsWith("Unity.Instance"))
            {
                var processes            = UnityDebuggerEngine.GetAttachableProcesses();
                var unityEngineProcesses = processes.Where(p => p.Name.Contains(target.ProcessName)).ToArray();

                if (unityEngineProcesses.Length == 0)
                {
                    MessageService.ShowError(target.Name + " not found");
                    LoggingService.LogError(target.Name + " not found");
                }
                else if (unityEngineProcesses.Length == 1)
                {
                    DispatchService.GuiDispatch(delegate {
                        IdeApp.ProjectOperations.AttachToProcess(unityDebuggerEngine, unityEngineProcesses [0]);
                    });
                }
                else
                {
                    ShowAttachToProcessDialog();
                }
            }
            else if (target.Id == "Unity.AttachToProcess")
            {
                ShowAttachToProcessDialog();
            }
            else
            {
                MessageService.ShowError("UnityProjectServiceExtension: Unsupported target.Id: " + target.Id);
                MonoDevelop.Core.LoggingService.LogError("UnityProjectServiceExtension: Unsupported target.Id: " + target.Id);
                base.Execute(monitor, item, context, configuration);
            }
        }
		/// <summary>
		/// Launch project
		/// </summary>
		public override void Execute (MonoDevelop.Core.IProgressMonitor monitor, IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
		{
			if (CanExecuteProject (item as Project, context)) {
				DispatchService.GuiDispatch (delegate {

					foreach(var file in ((Project)item).Files)
					{
						string filePath = file.FilePath.ToString();
						if(filePath.Contains(@"Game\Scripts"))
						{
							WorkingDir = Path.Combine(filePath.Remove(filePath.LastIndexOf(@"Game\Scripts")), "Bin32");
							break;
						}
					}
					IdeApp.Workbench.CurrentLayout = "Debug";
					IdeApp.ProjectOperations.CurrentRunOperation = context.ExecutionHandler.Execute (new CryEngineExecutionCommand (item.BaseDirectory.FullPath), context.ConsoleFactory.CreateConsole (true));
				});
			} else {
				base.Execute (monitor, item, context, configuration);
			}
		}
Example #20
0
 protected override void Update(CommandInfo info)
 {
     if (IdeApp.Workspace.IsOpen)
     {
         IBuildTarget buildTarget = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;
         info.Enabled = ((buildTarget != null) && (IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted));
         if (buildTarget != null)
         {
             info.Text        = GettextCatalog.GetString("R_ebuild {0}", IdeApp.ProjectOperations.CurrentSelectedBuildTarget.Name.Replace("_", "__"));
             info.Description = GettextCatalog.GetString("Rebuild {0}", IdeApp.ProjectOperations.CurrentSelectedBuildTarget.Name);
         }
     }
     else
     {
         info.Enabled = ((IdeApp.Workbench.ActiveDocument != null) && (IdeApp.Workbench.ActiveDocument.IsBuildTarget) && (IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted));
         if (info.Enabled)
         {
             info.Text        = GettextCatalog.GetString("R_ebuild {0}", IdeApp.Workbench.ActiveDocument.FileName.FileName.Replace("_", "__"));
             info.Description = GettextCatalog.GetString("Rebuild {0}", IdeApp.Workbench.ActiveDocument.FileName);
         }
     }
 }
Example #21
0
        public override bool GetNeedsBuilding(IBuildTarget item, ConfigurationSelector configuration)
        {
            if (item is SolutionItem)
            {
                SolutionItem entry = (SolutionItem)item;
                // This is a cache to avoid unneeded recursive calls to GetNeedsBuilding.
                bool cleanCache = false;
                if (needsBuildingCache == null)
                {
                    needsBuildingCache = new Dictionary <SolutionItem, bool> ();
                    cleanCache         = true;
                }
                else
                {
                    bool res;
                    if (needsBuildingCache.TryGetValue(entry, out res))
                    {
                        return(res);
                    }
                }

                bool nb = entry.OnGetNeedsBuilding(configuration);

                needsBuildingCache [entry] = nb;
                if (cleanCache)
                {
                    needsBuildingCache = null;
                }
                return(nb);
            }
            else if (item is WorkspaceItem)
            {
                return(((WorkspaceItem)item).OnGetNeedsBuilding(configuration));
            }
            else
            {
                throw new InvalidOperationException("Unknown item type: " + item);
            }
        }
		public override void Execute (MonoDevelop.Core.IProgressMonitor monitor, IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
		{
			if (base.CanExecute (item, context, configuration)) {
				// It is executable by default
				base.Execute(monitor, item, context, configuration);
				return;
			} else if (item is IWorkspaceObject) {
				UnitTest test = NUnitService.Instance.FindRootTest ((IWorkspaceObject)item);
				if (test != null) {
					IAsyncOperation oper = null;
					DispatchService.GuiSyncDispatch (delegate {
						oper = NUnitService.Instance.RunTest (test, context.ExecutionHandler, false);
					});
//					if (oper != null) {
//						monitor.CancelRequested += delegate {
//							oper.Cancel ();
//						};
//						oper.WaitForCompleted ();
//					}
				}
			}
		}
        internal static CheckResult CheckBeforeDebugging(IBuildTarget target)
        {
            if (IdeApp.Preferences.BuildBeforeExecuting)
            {
                return(CheckResult.BuildBeforeRun);
            }

            if (!IdeApp.Workspace.NeedsBuilding())
            {
                return(CheckResult.Run);
            }

            AlertButton bBuild = new AlertButton(GettextCatalog.GetString("Build"));
            AlertButton bRun   = new AlertButton(Gtk.Stock.Execute, true);
            AlertButton res    = MessageService.AskQuestion(
                GettextCatalog.GetString("Outdated Debug Information"),
                GettextCatalog.GetString("The project you are executing has changes done after the last time it was compiled. The debug information may be outdated. Do you want to continue?"),
                2,
                AlertButton.Cancel,
                bBuild,
                bRun);

            // This call is a workaround for bug #6907. Without it, the main monodevelop window is left it a weird
            // drawing state after the message dialog is shown. This may be a gtk/mac issue. Still under research.
            DispatchService.RunPendingEvents();

            if (res == AlertButton.Cancel)
            {
                return(CheckResult.Cancel);
            }
            else if (res == bRun)
            {
                return(CheckResult.Run);
            }
            else
            {
                return(CheckResult.BuildBeforeRun);
            }
        }
		protected override BuildResult Build (IProgressMonitor monitor, IBuildTarget item, ConfigurationSelector configuration)
		{
			if (!(item is MonoDroidProject))
				return base.Build (monitor, item, configuration);

			MonoDroidProject project = (MonoDroidProject) item;
			TargetFramework requiredFramework = Runtime.SystemAssemblyService.GetTargetFramework ("4.0");

			// Check that we support 4.0 to infer we are at Mono 2.8 at least.
			if (!project.TargetRuntime.IsInstalled (requiredFramework)) {
				var message = "Mono 2.8 or newer is required.";
				MessageService.GenericAlert (MonoDevelop.Ide.Gui.Stock.MonoDevelop, message,
						"Mono 2.8 or newer is requiered. Please go to http://www.mono-project.com to update your installation.",
						AlertButton.Ok);

				var buildResult = new BuildResult ();
				buildResult.AddError (message);
				return buildResult;
			}

			return base.Build (monitor, item, configuration);
		}
Example #25
0
        public static IAsyncOperation Debug(this ProjectOperations opers, IBuildTarget entry)
        {
            if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
            {
                return(opers.CurrentRunOperation);
            }

            string oldLayout = IdeApp.Workbench.CurrentLayout;

            IdeApp.Workbench.CurrentLayout = "Debug";

            ExecutionContext context = new ExecutionContext(DebuggingService.GetExecutionHandler(), IdeApp.Workbench.ProgressMonitors);

            IAsyncOperation op = opers.Execute(entry, context);

            op.Completed += delegate {
                Gtk.Application.Invoke(delegate {
                    IdeApp.Workbench.CurrentLayout = oldLayout;
                });
            };
            return(op);
        }
Example #26
0
 /// <summary>
 /// Includes an IBuildTarget in the list of potential target build platforms.
 /// </summary>
 public static void RegisterBuildTarget(IBuildTarget target)
 {
     if (target == null)
     {
         throw new ArgumentNullException("Build targets cannot be null!");
     }
     if (string.IsNullOrEmpty(target.Name))
     {
         throw new ArgumentException("Build target names cannot be null or empty!");
     }
     foreach (IBuildTarget bt in _buildTargets)
     {
         if (bt == target)
         {
             return;                 // build target already registered, ignore it
         }
         if (bt.Name == target.Name) // otherwise, if two targets share the same name
         {
             throw new ArgumentException("Another build target with the same name ('" + target.Name + "') already exists.");
         }
     }
     _buildTargets.Add(target);
 }
Example #27
0
        public override BuildResult RunTarget(IProgressMonitor monitor, IBuildTarget item, string target, ConfigurationSelector configuration)
        {
            BuildResult res;

            if (item is WorkspaceItem)
            {
                res = ((WorkspaceItem)item).OnRunTarget(monitor, target, configuration);
            }
            else if (item is SolutionItem)
            {
                res = ((SolutionItem)item).OnRunTarget(monitor, target, configuration);
            }
            else
            {
                throw new InvalidOperationException("Unknown item type: " + item);
            }

            if (res != null)
            {
                res.SourceTarget = item;
            }
            return(res);
        }
Example #28
0
        protected override BuildResult Build(IProgressMonitor monitor, IBuildTarget item, ConfigurationSelector configuration)
        {
            BuildResult res;

            if (item is SolutionEntityItem)
            {
                SolutionEntityItem        entry = (SolutionEntityItem)item;
                SolutionItemConfiguration conf  = entry.GetConfiguration(configuration) as SolutionItemConfiguration;
                if (conf != null && conf.CustomCommands.HasCommands(CustomCommandType.Build))
                {
                    conf.CustomCommands.ExecuteCommand(monitor, entry, CustomCommandType.Build, configuration);
                    res = new BuildResult();
                }
                else
                {
                    res = entry.OnBuild(monitor, configuration);
                }
            }
            else if (item is WorkspaceItem)
            {
                res = ((WorkspaceItem)item).OnRunTarget(monitor, ProjectService.BuildTarget, configuration);
            }
            else if (item is SolutionItem)
            {
                res = ((SolutionItem)item).OnBuild(monitor, configuration);
            }
            else
            {
                throw new InvalidOperationException("Unknown item type: " + item);
            }

            if (res != null)
            {
                res.SourceTarget = item;
            }
            return(res);
        }
        private static IEnumerable <string> GetReferenceAliases(IBuildTarget target, string resultingFragmentName)
        {
            /*
             * Add ReferenceAlias"es
             * At some point, we might port the conversion so it doesn"t use the directly injected property,
             * but instead has a map to aliases and we"ll map accordingly and have references point to aliases instead
             */
            string sourcePath      = target.GetSourceFromPath(resultingFragmentName);
            string scriptName      = Path.GetFileNameWithoutExtension(sourcePath);
            string?sourceDirectory = Path.GetDirectoryName(sourcePath);

            if (sourceDirectory == null)
            {
                throw new NullableException(nameof(sourceDirectory));
            }
            string aliasesFile = Path.Combine(sourceDirectory, scriptName + ".aliases");

            string[] aliasesLines = File.ReadAllLines(aliasesFile);
            return(aliasesLines.Select(a => a.Trim()).Where(a => a != "").Select(a =>
            {
                //WTM:  Change:  This used to build an alias like this:
                //Alias_[FormID]_p
                //I changed it to generate this:
                //Alias_[EditorID]_p

                /*const string Alias_ = "Alias_";
                 * if (!trimmedAlias.StartsWith(Alias_)) { throw new ConversionException(nameof(trimmedAlias) + " did not start with " + Alias_ + ":  " + trimmedAlias); }
                 * string formIDString = trimmedAlias.Substring(Alias_.Length);
                 * int formID = Convert.ToInt32(formIDString, 16);
                 * string? edid = esmAnalyzer.GetEDIDByFormIDNullable(formID);
                 * string innerName = edid != null ? edid : formIDString;
                 * string propertyName = Alias_ + innerName;*/
                //WTM:  Note:  The above didn't work.  GECKFrontend couldn't seem to associate the properties correctly.
                return a;
            }).Distinct());
        }
 private static void GetBuildTargetAndPrefix(IBuildTarget qfBuildTarget, IBuildTarget tifBuildTarget, TES4Record record, out IBuildTarget buildTarget, out string prefix)
 {
     if (record.RecordType == TES4RecordType.QUST)
     {
         buildTarget = qfBuildTarget; prefix = TES5ReferenceFactory.qf_Prefix;
     }
     else if (record.RecordType == TES4RecordType.INFO)
     {
         buildTarget = tifBuildTarget; prefix = TES5ReferenceFactory.tif_Prefix;
     }
     else
     {
         throw new InvalidOperationException("Invalid record type:  " + record.RecordType.Name);
     }
 }
Example #31
0
 public virtual bool SupportsItem(IBuildTarget item)
 {
     return(true);
 }
Example #32
0
		public static DebuggerFeatures GetSupportedFeatures (IBuildTarget target)
		{
			FeatureCheckerHandlerFactory fc = new FeatureCheckerHandlerFactory ();
			ExecutionContext ctx = new ExecutionContext (fc, null);
			target.CanExecute (ctx, IdeApp.Workspace.ActiveConfiguration);
			return fc.SupportedFeatures;
		}
Example #33
0
		void CleanDone (IProgressMonitor monitor, IBuildTarget entry, ITimeTracker tt)
		{
			tt.Trace ("Begin reporting clean result");
			try {
				monitor.Log.WriteLine ();
				monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
				tt.Trace ("Reporting result");			
				monitor.ReportSuccess (GettextCatalog.GetString ("Clean successful."));
				OnEndClean (monitor, tt);
			} finally {
				monitor.Dispose ();
				tt.End ();
			}
		}
Example #34
0
		public IAsyncOperation Clean (IBuildTarget entry)
		{
			if (currentBuildOperation != null && !currentBuildOperation.IsCompleted) return currentBuildOperation;
			
			ITimeTracker tt = Counters.BuildItemTimer.BeginTiming ("Cleaning " + entry.Name);
			try {
				IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetCleanProgressMonitor ();
				OnStartClean (monitor, tt);
				DispatchService.ThreadDispatch (() => CleanAsync (entry, monitor, tt, false));
				
				currentBuildOperation = monitor.AsyncOperation;
				currentBuildOperationOwner = entry;
				currentBuildOperation.Completed += delegate {
					currentBuildOperationOwner = null;
				};
			}
			catch {
				tt.End ();
				throw;
			}
			
			return currentBuildOperation;
		}
Example #35
0
		public IAsyncOperation Execute (IBuildTarget entry)
		{
			return Execute (entry, Runtime.ProcessService.DefaultExecutionHandler);
		}
Example #36
0
		public bool CanExecute (IBuildTarget entry, IExecutionHandler handler)
		{
			ExecutionContext context = new ExecutionContext (handler, IdeApp.Workbench.ProgressMonitors);
			return entry.CanExecute (context, IdeApp.Workspace.ActiveConfiguration);
		}
Example #37
0
		internal static bool ContainsTarget (IBuildTarget owner, IBuildTarget target)
		{
			if (owner == target)
				return true;
			else if (target is RootWorkspace)
				return ContainsTarget (owner, IdeApp.ProjectOperations.CurrentSelectedSolution);
			else if (owner is WorkspaceItem)
				return ((WorkspaceItem)owner).ContainsItem (target);
			return false;
		}
        IEnumerable <IBuildTarget> GetAllChildren(IBuildTarget item)
        {
            IEnumerable <IBuildTarget> res = GetChildren(item);

            return(res.Concat(res.SelectMany(i => GetAllChildren(i))));
        }
 public static string GetRootBuildTargetPath(this IBuildTarget buildTarget)
 {
     return(Path.Combine(DataDirectory.GetBuildTargetsPath(), buildTarget.Name) + Path.DirectorySeparatorChar);
 }
        internal static async Task RunTest(UnitTest test, MonoDevelop.Projects.ExecutionContext context, bool buildOwnerObject, bool checkCurrentRunOperation, CancellationTokenSource cs)
        {
            string testName = test.FullName;

            if (buildOwnerObject)
            {
                IBuildTarget bt = test.OwnerObject as IBuildTarget;
                if (bt != null)
                {
                    if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
                    {
                        MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations();
                        await IdeApp.ProjectOperations.CurrentRunOperation.Task;
                    }

                    var res = await IdeApp.ProjectOperations.Build(bt, cs.Token).Task;

                    if (res.HasErrors)
                    {
                        return;
                    }

                    await RefreshTests(cs.Token);

                    test = SearchTest(testName);
                    if (test != null)
                    {
                        await RunTest(test, context, false, checkCurrentRunOperation, cs);
                    }
                    return;
                }
            }

            if (checkCurrentRunOperation && !IdeApp.ProjectOperations.ConfirmExecutionOperation())
            {
                return;
            }

            Pad resultsPad = IdeApp.Workbench.GetPad <TestResultsPad>();

            if (resultsPad == null)
            {
                resultsPad = IdeApp.Workbench.ShowPad(new TestResultsPad(), "MonoDevelop.UnitTesting.TestResultsPad", GettextCatalog.GetString("Test results"), "Bottom", "md-solution");
            }

            // Make the pad sticky while the tests are runnig, so the results pad is always visible (even if minimized)
            // That's required since when running in debug mode, the layout is automatically switched to debug.

            resultsPad.Sticky = true;
            resultsPad.BringToFront();

            TestSession session = new TestSession(test, context, (TestResultsPad)resultsPad.Content, cs);

            OnTestSessionStarting(new TestSessionEventArgs {
                Session = session, Test = test
            });

            if (checkCurrentRunOperation)
            {
                IdeApp.ProjectOperations.CurrentRunOperation = session;
            }

            try {
                await session.Start();
            } finally {
                resultsPad.Sticky = false;
            }
        }
Example #41
0
 public TestRunner(string testCase, IBuildTarget project, bool debug)
 {
     this.testCase = testCase;
     this.debug    = debug;
     this.project  = project;
 }
Example #42
0
		public IAsyncOperation Execute (IBuildTarget entry, ExecutionContext context)
		{
			if (currentRunOperation != null && !currentRunOperation.IsCompleted) return currentRunOperation;

			NullProgressMonitor monitor = new NullProgressMonitor ();

			DispatchService.ThreadDispatch (delegate {
				ExecuteSolutionItemAsync (monitor, entry, context);
			});
			currentRunOperation = monitor.AsyncOperation;
			currentRunOperationOwner = entry;
			currentRunOperation.Completed += delegate {
			 	DispatchService.GuiDispatch (() => {
					var error = monitor.Errors.FirstOrDefault ();
					if (error != null)
						IdeApp.Workbench.StatusBar.ShowError (error.Message);
					currentRunOperationOwner = null;
				});
			};
			return currentRunOperation;
		}
Example #43
0
		public bool IsRunning (IBuildTarget target)
		{
			return !currentRunOperation.IsCompleted && ContainsTarget (target, currentRunOperationOwner);
		}
        public override bool SupportsItem(IBuildTarget item)
        {
            AspNetAppProject aspProject = item as AspNetAppProject;

            return(aspProject != null && aspProject.LanguageBinding != null);
        }
Example #45
0
		public bool CanExecute (IBuildTarget entry)
		{
			ExecutionContext context = new ExecutionContext (Runtime.ProcessService.DefaultExecutionHandler, IdeApp.Workbench.ProgressMonitors);
			return CanExecute (entry, context);
		}
 protected bool IsVisible(IBuildTarget item)
 {
     return(true);
 }
Example #47
0
		public bool CanExecute (IBuildTarget entry, ExecutionContext context)
		{
			return entry.CanExecute (context, IdeApp.Workspace.ActiveConfiguration);
		}
        public static void GenerateINFOAddTopicScripts(ESMAnalyzer esmAnalyzer, BuildTracker buildTracker, IBuildTarget tifBuildTarget)
        {
            TES5TypeInferencer    typeInferencer    = new TES5TypeInferencer(esmAnalyzer);
            TES5ObjectCallFactory objectCallFactory = new TES5ObjectCallFactory(typeInferencer);
            TES4TopicsToTES5GlobalVariableFinder globalVariableFinder = new TES4TopicsToTES5GlobalVariableFinder();
            TES5GlobalVariables globalVariables = esmAnalyzer.GlobalVariables;
            var builtTIFs = buildTracker.GetBuiltScripts(BuildTargetFactory.TIFName);

            foreach (TES4Record infoRecord in esmAnalyzer.GetRecords().Where(r => r.RecordType == TES4RecordType.INFO))
            {
                TES4SubrecordData[] names = infoRecord.GetSubrecords("NAME").ToArray();
                if (names.Any())
                {
                    string                fragment0Name     = TES5FragmentFactory.GetFragmentName(0);
                    string                nameTES5FormIDHex = (infoRecord.FormID + 0x01000000).ToString("x8");
                    string                scriptName        = TES5ReferenceFactory.tif_Prefix + "_" + nameTES5FormIDHex;
                    TES5Script?           infoTIF           = builtTIFs.Where(s => s.Key == scriptName).Select(s => s.Value.Script).FirstOrDefault();
                    TES5FunctionCodeBlock fragment0;
                    if (infoTIF != null)
                    {
                        fragment0 = infoTIF.BlockList.Blocks.OfType <TES5FunctionCodeBlock>().Where(b => b.BlockName == fragment0Name).First();
                    }
                    else
                    {
                        TES5ScriptHeader  scriptHeader  = TES5ScriptHeaderFactory.GetFromCacheOrConstructByBasicType(scriptName, TES5BasicType.T_TOPICINFO, TES5TypeFactory.TES4_Prefix, true);
                        TES5GlobalScope   globalScope   = new TES5GlobalScope(scriptHeader);
                        TES5FunctionScope functionScope = new TES5FunctionScope(fragment0Name);
                        functionScope.AddParameter(new TES5SignatureParameter("akSpeakerRef", TES5BasicType.T_OBJECTREFERENCE, true));
                        TES5LocalScope localScope = new TES5LocalScope(functionScope);
                        TES5CodeScope  codeScope  = TES5CodeScopeFactory.CreateCodeScope(localScope);
                        fragment0 = new TES5FunctionCodeBlock(functionScope, codeScope, TES5VoidType.Instance, false, true);
                        TES5BlockList blockList = new TES5BlockList()
                        {
                            fragment0
                        };
                        infoTIF = new TES5Script(globalScope, blockList, true);
                        string     outputPath = tifBuildTarget.GetTranspileToPath(scriptName);
                        TES5Target target     = new TES5Target(infoTIF, outputPath);
                        buildTracker.RegisterBuiltScript(tifBuildTarget, target);
                    }
                    foreach (TES4SubrecordData name in names)
                    {
                        int                 formID                   = infoRecord.ExpandBytesIntoFormID(name);
                        TES4Record          addedTopic               = esmAnalyzer.GetRecordByFormID(formID);
                        Tuple <int, string>?globalVariable           = globalVariableFinder.GetGlobalVariableNullable(addedTopic.FormID);
                        string              globalVariableEditorID   = globalVariable != null ? globalVariable.Item2 : globalVariableFinder.GetGlobalVariableEditorID(addedTopic.GetEditorID());
                        Nullable <int>      globalVariableTES5FormID = globalVariable != null ? globalVariable.Item1 : (Nullable <int>)null;
                        TES5Property        topicAddedProperty       = TES5PropertyFactory.ConstructWithTES5FormID(globalVariableEditorID, TES5BasicType.T_GLOBALVARIABLE, globalVariableEditorID, globalVariableTES5FormID);
                        infoTIF.GlobalScope.AddPropertyIfNotExists(topicAddedProperty);
                        TES5Reference topicAddedReference = TES5ReferenceFactory.CreateReferenceToVariableOrProperty(topicAddedProperty);
                        fragment0.AddChunk(objectCallFactory.CreateObjectCall(topicAddedReference, "SetValueInt", new TES5ObjectCallArguments()
                        {
                            new TES5Integer(1)
                        }));
                    }
                }
            }
        }
Example #49
0
		public IAsyncOperation Execute (IBuildTarget entry, IExecutionHandler handler)
		{
			ExecutionContext context = new ExecutionContext (handler, IdeApp.Workbench.ProgressMonitors);
			return Execute (entry, context);
		}
Example #50
0
 public static bool IsFeatureSupported(IBuildTarget target, DebuggerFeatures feature)
 {
     return((GetSupportedFeatures(target) & feature) == feature);
 }
Example #51
0
		void ExecuteSolutionItemAsync (IProgressMonitor monitor, IBuildTarget entry, ExecutionContext context)
		{
			try {
				OnBeforeStartProject ();
				entry.Execute (monitor, context, IdeApp.Workspace.ActiveConfiguration);
			} catch (Exception ex) {
				monitor.ReportError (GettextCatalog.GetString ("Execution failed."), ex);
				LoggingService.LogError ("Execution failed", ex);
			} finally {
				monitor.Dispose ();
			}
		}
Example #52
0
        protected async override void Run()
        {
            IBuildTarget entry = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;

            await IdeApp.ProjectOperations.Debug(entry).Task;
        }
Example #53
0
		void CleanAsync (IBuildTarget entry, IProgressMonitor monitor, ITimeTracker tt, bool isRebuilding)
		{
			try {
				tt.Trace ("Cleaning item");
				SolutionItem it = entry as SolutionItem;
				if (it != null) {
					it.Clean (monitor, IdeApp.Workspace.ActiveConfiguration);
				}
				else {
					entry.RunTarget (monitor, ProjectService.CleanTarget, IdeApp.Workspace.ActiveConfiguration);
				}
			} catch (Exception ex) {
				monitor.ReportError (GettextCatalog.GetString ("Clean failed."), ex);
			} finally {
				tt.Trace ("Done cleaning");
			}
			
			if (isRebuilding) {
				if (EndClean != null) {
					DispatchService.GuiSyncDispatch (() => OnEndClean (monitor, tt));
				}
			} else {
				DispatchService.GuiDispatch (() => CleanDone (monitor, entry, tt));
			}
		}
Example #54
0
        protected override void Update(CommandInfo info)
        {
            IBuildTarget target = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;

            info.Enabled = target != null && !(target is Workspace) && IdeApp.ProjectOperations.CanDebug(target);
        }
Example #55
0
		public static bool IsFeatureSupported (IBuildTarget target, DebuggerFeatures feature)
		{
			return (GetSupportedFeatures (target) & feature) == feature;
		}
 public static string GetArchivePath(this IBuildTarget buildTarget)
 {
     return(Path.Combine(buildTarget.GetRootBuildTargetPath(), "Archive") + Path.DirectorySeparatorChar);
 }
Example #57
0
 public override object GetService(IBuildTarget item, Type type)
 {
     return(null);
 }
Example #58
0
        protected override void Update(CommandInfo info)
        {
            IBuildTarget buildTarget = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;

            info.Enabled = ((buildTarget != null) && (!(buildTarget is Workspace)) && IdeApp.ProjectOperations.CanExecute(buildTarget) && IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted);
        }
 public static string GetArchivedBuildPath(this IBuildTarget buildTarget, int buildNumber)
 {
     return(Path.Combine(buildTarget.GetRootBuildTargetPath(), "Archive", buildNumber.ToString()) + Path.DirectorySeparatorChar);
 }
 public static string GetSourceFromPath(this IBuildTarget buildTarget, string scriptName)
 {
     return(buildTarget.GetSourcePath() + scriptName + ".txt");
 }