protected void onProject(IVsHierarchy pHierProj, ExecutionOrderType type, bool fSuccess = true) { #if VSSDK_15_AND_NEW ThreadHelper.ThrowIfNotOnUIThread(); //TODO: upgrade to 15 #endif onProject(getProjectName(pHierProj), type, fSuccess); }
/// <summary> /// Monitoring for deferred PRE-actions - "it's time or not" /// </summary> /// <param name="project">incoming project name</param> /// <param name="type">type of execution order</param> /// <param name="fSuccess">Flag indicating success</param> protected void monitoringPre(string project, ExecutionOrderType type, bool fSuccess) { SBEEvent[] evt = SlnEvents.PreBuild; for (int i = 0; i < evt.Length; ++i) { if (!evt[i].Enabled || Status._.get(SolutionEventType.Pre, i) != StatusType.Deferred) { continue; } if (!IsAllowActions) { _ignoredAction(SolutionEventType.DeferredPre); return; } if (!fSuccess && evt[i].IgnoreIfBuildFailed) { Log.Info("[PRE] ignored action '{0}' :: Build FAILED. See option 'Ignore if the build failed'", evt[i].Caption); continue; } if (!hasExecutionOrder(evt[i])) { Log.Trace("[PRE] deferred: executionOrder is null or not contains elements :: {0}", evt[i].Caption); return; } if (evt[i].ExecutionOrder.Any(o => projects.ContainsKey(o.Project) && projects[o.Project].Project == project && o.Order == type)) { Log.Info("Incoming '{0}'({1}) :: Execute deferred action: '{2}'", project, type, evt[i].Caption); Status._.update(SolutionEventType.Pre, i, (execPre(evt[i]) == Codes.Success)? StatusType.Success : StatusType.Fail); } } }
protected void onProject(string project, ExecutionOrderType type, bool fSuccess = true) { lock (_plock) { var eop = new EOProject() { Project = project, Order = type }; int max = Cmd.Env.ProjectsDTE.Count(); var _projects = projects.Where(p => !ExecutionOrder.IsSpecial(p.Key)); int count = _projects.Count(); // 'First Project' & 'First Type' Before if (count < 1) { eop.aProject = ExecutionOrder.FIRST_PROJECT; eop.aType = ExecutionOrder.FIRST_TYPE; } // 'Last Project' & 'Last Type' Before else if (!projects.ContainsKey(project) && count + 1 == max) { eop.aProject = ExecutionOrder.LAST_PROJECT; eop.aType = ExecutionOrder.LAST_TYPE; } else { // 'First Project' After if (projects.ContainsKey(project) && projects[project].aProject == ExecutionOrder.FIRST_PROJECT) { eop.aProject = ExecutionOrder.FIRST_PROJECT; } // 'Last Project' After else if (projects.ContainsKey(project) && projects[project].aProject == ExecutionOrder.LAST_PROJECT) { eop.aProject = ExecutionOrder.LAST_PROJECT; } // 'First Type' After if (type == ExecutionOrderType.After && !projects.Any(p => p.Value.Order == ExecutionOrderType.After)) { eop.aType = ExecutionOrder.FIRST_TYPE; } // 'Last Type' After else if (type == ExecutionOrderType.After && count == max) { var list = _projects.Where(p => p.Value.Order == ExecutionOrderType.Before); if (list.Count() == 1 && list.FirstOrDefault().Key == project) { eop.aType = ExecutionOrder.LAST_TYPE; } } } projects[project] = eop; current.Project = project; current.Order = type; if (eop.aProject != null) { projects[eop.aProject] = eop; // alias to 'First/Last Project' } if (eop.aType != null) { projects[eop.aType] = eop; // alias to 'First/Last Type' } } Log.Trace($"onProject: '{project}'({projects[project].aProject}/{projects[project].aType}):{type} == {fSuccess}"); if (Status._.contains(SolutionEventType.Pre, StatusType.Deferred)) { monitoringPre(project, type, fSuccess); } }
protected void onProject(string project, ExecutionOrderType type, bool fSuccess = true) { projects[project] = type; current.Project = project; current.Order = type; Log.Trace("onProject: '{0}':{1} == {2}", project, type, fSuccess); if(Status._.contains(SolutionEventType.Pre, StatusType.Deferred)) { monitoringPre(project, type, fSuccess); } }
protected void onProject(IVsHierarchy pHierProj, ExecutionOrderType type, bool fSuccess = true) { onProject(getProjectName(pHierProj), type, fSuccess); }
/// <summary> /// Monitoring for deferred PRE-actions - "it's time or not" /// </summary> /// <param name="project">incoming project name</param> /// <param name="type">type of execution order</param> /// <param name="fSuccess">Flag indicating success</param> protected void monitoringPre(string project, ExecutionOrderType type, bool fSuccess) { SBEEvent[] evt = SlnEvents.PreBuild; for(int i = 0; i < evt.Length; ++i) { if(!evt[i].Enabled || Status._.get(SolutionEventType.Pre, i) != StatusType.Deferred) { continue; } if(!IsAllowActions) { _ignoredAction(SolutionEventType.DeferredPre); return; } if(!fSuccess && evt[i].IgnoreIfBuildFailed) { Log.Info("[PRE] ignored action '{0}' :: Build FAILED. See option 'Ignore if the build failed'", evt[i].Caption); continue; } if(!hasExecutionOrder(evt[i])) { Log.Trace("[PRE] deferred: executionOrder is null or not contains elements :: {0}", evt[i].Caption); return; } if(evt[i].ExecutionOrder.Any(o => o.Project == project && o.Order == type)) { Log.Info("Incoming '{0}'({1}) :: Execute the deferred action: '{2}'", project, type, evt[i].Caption); Status._.update(SolutionEventType.Pre, i, (execPre(evt[i]) == Codes.Success)? StatusType.Success : StatusType.Fail); } } }