Exemplo n.º 1
0
 void OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
 {
     if (Scope != vsBuildScope.vsBuildScopeSolution)
         return;
     m_timer.Start();
     m_start = DateTime.Now;
 }
Exemplo n.º 2
0
        public void onBuildBegin(vsBuildScope scope, vsBuildAction action)
        {
            dumpState();
            Log.D("VS build begin {scope}, {action}", scope, action);

            prepareForVSBuild();
        }
Exemplo n.º 3
0
        private void OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            OutputWindowPane BuildOutputPane = null;
            foreach (OutputWindowPane pane in _dte2.ToolWindows.OutputWindow.OutputWindowPanes)
            {
                if (pane.Guid == VSConstants.OutputWindowPaneGuid.BuildOutputPane_string)
                {
                    BuildOutputPane = pane;
                    break;
                }
            }

            if (BuildOutputPane == null)
                return;

            if (ShowBuildReport)
            {
                BuildOutputPane.OutputString("\r\nProjects build report:\r\n");
                BuildOutputPane.OutputString("  Status    | Project [Config|platform]\r\n");
                BuildOutputPane.OutputString(" -----------|---------------------------------------------------------------------------------------------------\r\n");

                foreach (string ReportItem in _projectsBuildReport)
                    BuildOutputPane.OutputString(ReportItem + "\r\n");
            }

            if (ShowElapsedBuildTimeEnabled)
            {
                var elapsed = DateTime.Now - _buildStartTime;
                var time = elapsed.ToString(@"hh\:mm\:ss\.ff");
                var text = string.Format("Time Elapsed {0}", time);

                BuildOutputPane.OutputString("\r\n" + text + "\r\n");
            }
        }
Exemplo n.º 4
0
        private void BuildEvents_OnBuildBegin(vsBuildScope scope, vsBuildAction action)
        {
            if (action == vsBuildAction.vsBuildActionClean)
                return;

            Restore();
        }
 /// <summary>
 /// The fire on build begin.
 /// </summary>
 /// <param name="scope">
 /// The scope.
 /// </param>
 /// <param name="action">
 /// The action.
 /// </param>
 public void FireOnBuildBegin(vsBuildScope scope, vsBuildAction action)
 {
     if (this.OnBuildBegin != null)
     {
         this.OnBuildBegin(scope, action);
     }
 }
Exemplo n.º 6
0
            void OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
            {
                if (Scope != vsBuildScope.vsBuildScopeSolution)
                    return;

                DateTime now = DateTime.Now;

                m_timer.Stop();
                TimeSpan ts = m_timer.Elapsed;
                string timeMessage = String.Format("Total solution build time: {0:00}:{1:00}:{2:00}.{3:00} (started {4} {5} and ended {6} {7})\n",
                    ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10, m_start.ToShortDateString(), m_start.ToLongTimeString(), now.ToShortDateString(), now.ToLongTimeString());
                OutputWindowPane pane = Plugin.FindOutputPane(m_plugin.App, "Build");
                pane.OutputString(timeMessage);

                m_timer.Reset();

                if (m_logfilename != "")
                {
                    using (StreamWriter w = new StreamWriter(m_logfilename, true))
                    {
                        string logMessage = String.Format("{0} {1}|{2:00}:{3:00}:{4:00}", now.ToShortDateString(), now.ToLongTimeString(), ts.Hours, ts.Minutes, ts.Seconds );
                        w.WriteLine(logMessage);
                    }
                }
            }
Exemplo n.º 7
0
        public static void BuildDone(vsBuildScope buildScope, vsBuildAction buildAction)
        {
            Trace.WriteLine("Build done");

            // Once the project has built then try and clean up the files copied into the Bootstrapper
            CopiedFiles.RemoveAll();
        }
 private void OnBuildBegin(vsBuildScope scope, vsBuildAction action)
 {
     foreach (Project project in _dte.Solution.Projects)
     {
         Generate(project.ProjectItems);
     }
 }
Exemplo n.º 9
0
        private void OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => // Execute after VS finishes its tasks
            {
                FartOptions options = (FartOptions)GetDialogPage(typeof(FartOptions));

                if (options.Enabled)
                {
                    bool isSuccess = _dte.Solution.SolutionBuild.LastBuildInfo == 0;
                    Fart(isSuccess, options);

                    if (isSuccess)
                    {
                        _successfulBuilds++;

                        if (_hasBuildFailed)
                            SetBuildMessage();
                    }
                    else
                    {
                        _hasBuildFailed = true;
                        _successfulBuilds = 0;
                    }
                }

            }), DispatcherPriority.ApplicationIdle, null);
        }
 private void OnBuildDone(vsBuildScope scope, vsBuildAction action)
 {
     if (this.patternManager.IsOpen)
     {
         this.patternManager.ValidateProductState();
     }
 }
Exemplo n.º 11
0
 private void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
 {
     this._applicationObject.ToolWindows.ErrorList.ShowErrors = true;
     this._applicationObject.ToolWindows.ErrorList.ShowWarnings = false;
     this._applicationObject.ToolWindows.ErrorList.ShowMessages = false;
     if (this._applicationObject.ToolWindows.ErrorList.ErrorItems.Count == 0)
     {
         foreach (Project item in (Array)this._applicationObject.ActiveSolutionProjects)
         {
             string designRootPath = Path.GetDirectoryName(item.FileName);
             string configFile = designRootPath + "\\EntityDesignConfig.xml";
             if (File.Exists(configFile))
             {
                 try
                 {
                     System.Diagnostics.Process.Start(Path.GetDirectoryName(this.GetType().Assembly.CodeBase).Replace("file:\\", "") + "\\MySoft.Tools.EntityDesign.exe", "\"" + designRootPath + "\"");
                 }
                 catch (Exception ex)
                 {
                     System.Windows.Forms.MessageBox.Show("EntityDesign实体生成工具错误提示:\r\n" + ex.Message);
                 }
             }
         }
     }
 }
        private void BuildEvents_OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            if (action != vsBuildAction.vsBuildActionBuild ||
                buildSucceeded == false)
                return;

            OnBuildSucceeded();
        }
Exemplo n.º 13
0
        private void OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            TaskbarManager.Instance.SetProgressState(_buildErrorDetected
                                                         ? TaskbarProgressBarState.Error
                                                         : TaskbarProgressBarState.Normal);

            System.Threading.Thread.Sleep(100);
        }
Exemplo n.º 14
0
 private void BuildEventsOnOnBuildDone(vsBuildScope scope, vsBuildAction action)
 {
     this.tracer.Trace("Build Done.", "VsProjectFileTracker");
     ProjectItem item = VsxHelper.FindProjectItemByProjectRelativePath(project, fileName);
     var newChangeDate = VsxHelper.GetLastChangeDate(item);
     if (newChangeDate != LastChangeDate)
         OnFileChanged(item);
 }
Exemplo n.º 15
0
		// Do we need this method?
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Called when [build begin].
		/// </summary>
		/// <param name="scope">The scope.</param>
		/// <param name="action">The action.</param>
		/// <remarks>Do we need this method?</remarks>
		/// ------------------------------------------------------------------------------------
		public void OnBuildBegin(vsBuildScope scope, vsBuildAction action)
		{
#if DEBUG
			//			m_nantCommands.OutputBuildDebug.WriteLine("BuildEvents::OnBuildBegin");
#endif
			if (action == vsBuildAction.vsBuildActionRebuildAll)
				throw new Exception();
		}
Exemplo n.º 16
0
 private void OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
 {
     if (Action == vsBuildAction.vsBuildActionClean || Action == vsBuildAction.vsBuildActionRebuildAll)
     {
         if (WebLinterPackage.Settings.CleanErrorsOnBuild)
             TableDataSource.Instance.CleanAllErrors();
     }
 }
Exemplo n.º 17
0
        private void OnBuildBegin(vsBuildScope scope, vsBuildAction action)
        {
            InitialiseTaskBar();

            _buildErrorDetected = false;
            _numberOfProjectsBuilt = 0;
            _numberOfProjects = _applicationObject.Solution.SolutionBuild.BuildDependencies.Count;

            UpdateProgressValueAndState(false);
        }
        /// <summary>
        /// Event raised when a build begins.
        /// </summary>
        /// <param name="scope">The scope.</param>
        /// <param name="action">The action.</param>
        private void BuildEvents_OnBuildBegin(vsBuildScope scope, vsBuildAction action)
        {
            var buildBegin = BuildBegin;
            if (buildBegin != null)
            {
                OutputWindowHelper.DiagnosticWriteLine("BuildProgressEventListener.BuildBegin raised");

                buildBegin(scope, action);
            }
        }
 public void OnBuildBegin(vsBuildScope scope, vsBuildAction action)
 {
     Logger.Write("BuildEvents_OnBuildBegin scope: " + scope.ToString() + " action " + action.ToString(), LogLevel.Debug);
     this._currentBuildState = vsBuildState.vsBuildStateInProgress;
     this._currentBuildAction = action;
     this._currentBuildScope = scope;
     this._buildStartDate = DateTime.Now;
     this.ExecuteIncrement();
     this._updatedItems.Clear();
 }
Exemplo n.º 20
0
        private void BuildEvents_OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            var mainWnd = new IntPtr(dte.MainWindow.HWnd);
            int failuresCount = dte.Solution.SolutionBuild.LastBuildInfo;

            taskbarList.SetProgressValue(mainWnd, 100, 100);

            taskbarList.SetProgressState(mainWnd,
                                         failuresCount == 0 ? TBPF.NORMAL : TBPF.ERROR);
        }
Exemplo n.º 21
0
 /// <summary>
 /// Global Build Done Callback
 /// </summary>
 /// <param name="scope"></param>
 /// <param name="action"></param>
 private void NotifyBuildEnd(vsBuildScope scope, vsBuildAction action)
 {
     Console.WriteLine("BuildEnd: " + scope + "/" + action);
     if (action < vsBuildAction.vsBuildActionBuild || action > vsBuildAction.vsBuildActionRebuildAll)
     {
         //Not an actual build event, we are here if user hits Start and there is nothing to build
         DesignerKiller.KillAllDesigners();
         return;
     }
     BuildEnd?.Invoke();
 }
Exemplo n.º 22
0
 /*
 private void buildBeginAction(string Project, string ProjectConfig, string Platform, string SolutionConfig)
 {
     if (this.gochiusaIDE != null)
     {
         this.gochiusaIDE.buildBeginAction();
     }
 }
 */
 private void buildBeginAction2(vsBuildScope Scope, vsBuildAction Action)
 {
     if (Action == vsBuildAction.vsBuildActionBuild || Action == vsBuildAction.vsBuildActionRebuildAll)
     {
         this.gochiusaIDE.buildBeginAction(false);
     }
     else if(Action == vsBuildAction.vsBuildActionClean)
     {
         this.gochiusaIDE.buildBeginAction(true);
     }
 }
Exemplo n.º 23
0
        void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            string solutionName = System.IO.Path.GetFileNameWithoutExtension(this._applicationObject.Solution.FullName);
            bool success = (this._applicationObject.Solution.SolutionBuild.LastBuildInfo == 0);

            // use another thread so that we dont slow the build down
            BuildInfo info = new BuildInfo(solutionName, success, true);
            System.Threading.ParameterizedThreadStart pts = new System.Threading.ParameterizedThreadStart(SendNotification);
            System.Threading.Thread t = new System.Threading.Thread(pts);
            t.Start(info);
        }
        /// <summary>
        /// Called when a build is done.
        /// </summary>
        /// <param name="scope">The scope.</param>
        /// <param name="action">The action.</param>
        internal void OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            var buildProgress = Package.BuildProgress;
            if (buildProgress != null)
            {
                buildProgress.NotifyBuildDone(scope, action);

                if (Settings.Default.Progressing_HideBuildProgressOnBuildStop)
                {
                    HideBuildProgressToolWindow();
                }
            }
        }
Exemplo n.º 25
0
 void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
 {
     if(mBuildHasErrors)
     {
         // send build failed
         mSerialPort.Write(new byte[] { 2 }, 0, 1);
     }
     else
     {
         // send build succeeded
         mSerialPort.Write(new byte[] { 1 }, 0, 1);
     }
 }
        /// <summary>
        /// Called when a build has begun.
        /// </summary>
        /// <param name="scope">The scope.</param>
        /// <param name="action">The action.</param>
        internal void OnBuildBegin(vsBuildScope scope, vsBuildAction action)
        {
            var buildProgress = Package.BuildProgress;
            if (buildProgress != null)
            {
                buildProgress.NotifyBuildBegin(scope, action);

                if (Settings.Default.Progressing_ShowBuildProgressOnBuildStart)
                {
                    ShowBuildProgressToolWindowWithoutActivation();
                }
            }
        }
Exemplo n.º 27
0
        private void buildStarted(vsBuildScope scope, vsBuildAction action)
        {
            // fetch the number of projects just once
            _numProjectsToBeBuilt = numProjectsToBeBuilt();

            _numBuiltProjects = 0;
            taskbarItemInfo.ProgressValue = 0;
            taskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate;

            if (scope != vsBuildScope.vsBuildScopeSolution)
                return;

            _buildStartTime = DateTime.Now;
        }
Exemplo n.º 28
0
 void _buildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
 {
     switch (Action)
     {
         case vsBuildAction.vsBuildActionClean:
         case vsBuildAction.vsBuildActionDeploy:
             break;
         case vsBuildAction.vsBuildActionBuild:
         case vsBuildAction.vsBuildActionRebuildAll:
             var outputDir = getOutputPath();
             var dlls = getBuiltDlls(outputDir);
             _previewControl.processBuiltDlls(dlls);
             break;
     }
 }
Exemplo n.º 29
0
        public static IEnumerable<Project> GetProjectsWithinBuildScope(this DTE dte, vsBuildScope scope)
        {
            IEnumerable<Project> projects = null;

            switch (scope)
            {
                case vsBuildScope.vsBuildScopeSolution:
                    projects = GetProjectsInSolution(dte.Solution).Where(x => x.ProjectItems != null);
                    break;
                case vsBuildScope.vsBuildScopeProject:
                    projects = ((object[])dte.ActiveSolutionProjects).OfType<Project>();
                    break;
            }

            return projects ?? Enumerable.Empty<Project>();
        }
Exemplo n.º 30
0
        private void buildDone(vsBuildScope scope, vsBuildAction action)
        {
            // fill it up
            taskbarItemInfo.ProgressValue = 1;

            // keep it red
            if (taskbarItemInfo.ProgressState != TaskbarItemProgressState.Error)
                taskbarItemInfo.ProgressState = TaskbarItemProgressState.None;

            if (scope != vsBuildScope.vsBuildScopeSolution)
                return;

            string msg = String.Format("Total build time: {0}", DateTime.Now - _buildStartTime);
            _vspkg.writeToBuildWindow("\n" + msg);
            _vspkg.writeStatus(msg);
        }
Exemplo n.º 31
0
        private void BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
        {
            try
            {
                _errorListProvider.Tasks.Clear();

                if (UsingOldPackageRestore(_dte.Solution))
                {
                    return;
                }

                if (!IsAutomatic())
                {
                    return;
                }

                _packageReferenceFileList = new PackageReferenceFileList(_dte.Solution);
                if (_packageReferenceFileList.IsEmpty)
                {
                    return;
                }

                _outputOptOutMessage = true;
                _hasMissingPackages  = false;
                _hasError            = false;
                RestorePackagesOrCheckForMissingPackages();
            }
            catch (Exception ex)
            {
                string message;
                if (_msBuildOutputVerbosity < 3)
                {
                    message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorOccurredRestoringPackages, ex.Message);
                }
                else
                {
                    // output exception detail when _msBuildOutputVerbosity is >= Detailed.
                    message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorOccurredRestoringPackages, ex.ToString());
                }
                WriteLine(VerbosityLevel.Quiet, message);
                ActivityLog.LogError(LogEntrySource, message);
            }
        }
        void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            if (!BuildStarted)
            {
                return;
            }
            BuildStarted = false;
            var dte = (DTE)GetGlobalService(typeof(DTE));

            if (User32.GetForegroundWindow() == (IntPtr)dte.MainWindow.HWnd)
            {
                return;
            }
            ShowToast(String.Format("{0} - {1}", Failed == 0 ? Resources.Strings.BuildSucceeded : Resources.Strings.BuildFailed,
                                    Scope == vsBuildScope.vsBuildScopeSolution ? Path.GetFileNameWithoutExtension(dte.Solution.FullName) : LastBuiltProject),
                      String.Format("{0}: {3}, {1}: {4}\n{2}: {5}",
                                    Resources.Strings.Success, Resources.Strings.Fail, Resources.Strings.TimeElapsed,
                                    Succeeded, Failed, DateTime.Now - BuildStartedOn));
        }
Exemplo n.º 33
0
        private async void BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
        {
            // Begin Build.
            Debug.Print("Beginning Build.");

            try
            {
                startCancellationTokenSource?.Cancel();
                endCancellationTokenSource?.Cancel();
                startCancellationTokenSource = new CancellationTokenSource();
                cummulativeBuildSuccess      = true;
                await device.SetColorAsync(0, 0, 255, startCancellationTokenSource.Token);
            }
            catch (Exception ex)
            {
                //LoggingService.LogError("Failed to handle start build", ex);
                Debug.Print($"Failed to handle start build - {ex.Message} - {ex}");
            }
        }
Exemplo n.º 34
0
        private void BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
        {
            // Determine whether require extension setting includes debug commenting
            bool commentInDebug = false;

            System.Configuration.KeyValueConfigurationElement requireExtension = null;
            try
            {
                ConfigurationAccessor config = new ConfigurationAccessor(_dte, null);
                requireExtension = config.AppSettings["QfRequireExtension"];
            }
            catch (Exception)
            {            //nobody cares
            }
            if (requireExtension != null)
            {
                try
                {
                    if (!Convert.ToBoolean(requireExtension.Value))
                    {
                        commentInDebug = true;
                    }
                }
                catch (Exception)
                {                //still, nobody cares
                }
            }


            if (!_dte.Solution.SolutionBuild.ActiveConfiguration.Name.Contains("Debug") || commentInDebug)
            {
                foreach (Project proj in _dte.Solution.Projects)
                {
                    // Comments !
                    // On opening a query to edit, we "open" the design time comments.
                    // In debug builds, the comment may be compiled "open", and closed by the generated code prior to running the query.
                    // In production builds, to save this step, we verify and "close" all comments section before the build, and
                    // the generated code runs the query as found.
                    SetCommentsForProd(proj.ProjectItems);
                }
            }
        }
Exemplo n.º 35
0
        private void BuildEventsOnOnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            _dte.Events.BuildEvents.OnBuildDone -= BuildEventsOnOnBuildDone;
            var pi = new ProjectInfo(_dte.ActiveSolutionProjects[0] as Project);

            // Upload the program
            var prog = new Process();

            prog.StartInfo = new ProcessStartInfo
            {
                FileName               = $"{Settings.AvrDudeFullPath}",
                WindowStyle            = ProcessWindowStyle.Hidden,
                CreateNoWindow         = true,
                UseShellExecute        = false,
                RedirectStandardError  = true,
                RedirectStandardOutput = true,
                Arguments              =
                    $"\"-C{Settings.AvrDudeConfigFullPath}\" -v -p{pi.Device?.Name.ToLower()} -carduino -P{_commands.Port} -b57600 -D -Uflash:w:\"{pi.OutputPathHex}\":i"
            };
            prog.EnableRaisingEvents = true;
            prog.OutputDataReceived += (sender, e) => _output.DebugOutLine(e.Data);
            prog.ErrorDataReceived  += (sender, e) => _output.DebugOutLine(e.Data);
            prog.Start();
            prog.BeginErrorReadLine();
            prog.BeginOutputReadLine();
            prog.WaitForExit(5000);
            if (!prog.HasExited)
            {
                prog.Kill();
            }

            if (prog.ExitCode == 0)
            {
                ATServiceProvider.EventsService.DebugActionChanged += EventsService_DebugActionChanged;
                _dte.ExecuteCommand("Debug.Start");
            }
            else
            {
                _commands.EnableUpload();
                Alert("Error uploading the program please check the COM port", "Error");
            }
        }
Exemplo n.º 36
0
        private void OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
        {
            IEnumerable <Project> projects = null;

            switch (Scope)
            {
            case vsBuildScope.vsBuildScopeSolution:
                projects = _dte.Solution.Projects.OfType <Project>();
                break;

            case vsBuildScope.vsBuildScopeProject:
                projects = ((object[])_dte.ActiveSolutionProjects).OfType <Project>();
                break;

            default:
                return;
            }

            RunTemplates(projects.ToArray());
        }
Exemplo n.º 37
0
        public override void OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            if (false == mExecuteCompile)
            {
                return;
            }

            int exitCode = DTEObj.Solution.SolutionBuild.LastBuildInfo;

            if (0 != exitCode)
            {
                // VS compile detected errors and there is not necessary to run clang compile
                mExecuteCompile = false;
                return;
            }

            // Run clang compile after the VS compile succeeded
            RunClangCompile(new object(), new EventArgs());
            mExecuteCompile = false;
        }
Exemplo n.º 38
0
 private void OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
 {
     FLog.Clear();
     try
     {
         List <Project> OProjects = new List <Project>();
         FindSqlineProjects(OProjects);
         foreach (Project OProject in OProjects)
         {
             FLog.SetProject(OProject);
             GenerateDataItems(OProject);
             GenerateProjectHandler(OProject);
         }
     }
     catch (Exception ex)
     {
         FLog.Add(ex);
     }
     FLog.UpdateView();
 }
Exemplo n.º 39
0
 /// <summary>
 /// 关闭所有的cshtml,防止visual studio报错。
 /// </summary>
 /// <param name="Scope"></param>
 /// <param name="Action"></param>
 private void BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
 {
     if (vsBuildAction.vsBuildActionBuild == Action || vsBuildAction.vsBuildActionRebuildAll == Action)
     {
         if (vsBuildScope.vsBuildScopeProject == Scope)
         {
             try
             {
                 foreach (EnvDTE.Document doc in _dte.Documents)
                 {
                     if (doc?.FullName.LastIndexOf(".cshtml") > -1)
                     {
                         doc?.Close(vsSaveChanges.vsSaveChangesYes);
                     }
                 }
             }
             catch { }
         }
     }
 }
Exemplo n.º 40
0
        public void _BuildDone(vsBuildScope scope, vsBuildAction action)
        {
            try
            {
                if (scope != vsBuildScope.vsBuildScopeSolution)
                {
                    return;
                }
                switch (action)
                {
                case vsBuildAction.vsBuildActionBuild:

                    OutputService.WriteOutputWithContext("StartDeploy");
                    Task.Run(DeployAsync);

                    break;

                case vsBuildAction.vsBuildActionRebuildAll:
                    break;

                case vsBuildAction.vsBuildActionClean:
                    break;

                case vsBuildAction.vsBuildActionDeploy:
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(action), action, null);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, ex.Message);
                OutputService.WriteOutputWithContext($"Error: {ex.Message}");
            }
            finally
            {
                WorkingStop();
                service.Events.BuildEvents.OnBuildDone -= _BuildDone;
            }
        }
Exemplo n.º 41
0
        public void OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
        {
            try
            {
                ThreadHelper.ThrowIfNotOnUIThread();
                var projectItemHelper = new ProjectItemRetreiver(GotoAsyncPackage.EnvDTE);
                var projectItems      = projectItemHelper.GetProjectItemsFromSolutionProjects();

                foreach (var xmlFile in DocumentHelper.GetXmlFiles(projectItems))
                {
                    var validator = XmlValidatorsAggregator.Create.AllValidatorsForBuild(xmlFile.FilePath);
                    validator.ValidateBuildDocument();
                    validator.AddToErrorList();
                }
            }
            catch (Exception ex)
            {
                LogManager.GetLogger("error").Error(ex, "BuildEvents.OnBuildBegin");
                OutputWindowLogger.WriteLn($"Exception occured during BuildEvents.OnBuildBegin: { ex.Message}");
            }
        }
Exemplo n.º 42
0
        ///==========================================
        /// Events
        ///==========================================

        //NOTE: this does not catch debugger startup,
        //		for that I need to catch the event via BeforeExecute
        public void OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
        {
            //NOTE: we may want to use these, just for copying the error buffer
            //		to the other output pane (nothing else...)

//			GetBuildOutputPane().OutputString("OnBuildBegin...\n");
//          GetDebugOutputPane().Clear();
//
//          string ActionScope = Scope.ToString();
//          string ActionType = Action.ToString();
//
//          GetDebugOutputPane().OutputString("Build Event Begin: Scope=" + ActionScope + " Action=" + ActionType + "\n");
//
//          if(Scope == vsBuildScope.vsBuildScopeSolution)
//          {
//              if (Action == vsBuildAction.vsBuildActionBuild
//              ||	Action == vsBuildAction.vsBuildActionDeploy
//              ||	Action == vsBuildAction.vsBuildActionRebuildAll)
//                  CatchBuildSolution();
//          }
        }
Exemplo n.º 43
0
        private void OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (State == StateType.Building)
            {
                //async call for the Data Gathering
                if (Action == vsBuildAction.vsBuildActionClean)
                {
                    _ = CancelGatheringAsync();
                }
                else if (Action == vsBuildAction.vsBuildActionBuild || Action == vsBuildAction.vsBuildActionRebuildAll)
                {
                    _ = GatherAsync();
                }
            }
            else
            {
                SetState(StateType.Idle);
            }
        }
Exemplo n.º 44
0
        private void OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            Debug.WriteLine("Build Finished");
            var solution = Dte.Solution;

            if (telemetry != null)
            {
                if (IsMubiquitySolution(solution))
                {
                    // Represents the number of failures
                    if (solution.SolutionBuild.LastBuildInfo > 0)
                    {
                        telemetry.TrackEvent("MubiquityBuildFailed");
                    }
                    else
                    {
                        telemetry.TrackEvent("MubiquityBuildSucceeded");
                    }
                }
            }
        }
Exemplo n.º 45
0
        private void buildDone(vsBuildScope scope, vsBuildAction action)
        {
            // fill it up
            taskbarItemInfo.ProgressValue = 1;

            // keep it red
            if (taskbarItemInfo.ProgressState != TaskbarItemProgressState.Error)
            {
                taskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
            }

            if (scope != vsBuildScope.vsBuildScopeSolution)
            {
                return;
            }

            string msg = String.Format("Total build time: {0}", DateTime.Now - _buildStartTime);

            _vspkg.writeToBuildWindow("\n" + msg);
            _vspkg.writeStatus(msg);
        }
Exemplo n.º 46
0
        private void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            if (_dte.Solution.SolutionBuild.LastBuildInfo != 0)
            {
                string text = _dte.StatusBar.Text; // respect localization of "Build failed"
                Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
                {
                    _dte.StatusBar.Text = text;
                }), DispatcherPriority.ApplicationIdle, null);

                return;
            }

            if (Action == vsBuildAction.vsBuildActionClean)
            {
                LintReporter.Reset();
                return;
            }

            InitiateExecutors();
        }
Exemplo n.º 47
0
 private void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
 {
     if (vsBuildAction.vsBuildActionBuild == Action || vsBuildAction.vsBuildActionRebuildAll == Action)
     {
         if (vsBuildScope.vsBuildScopeProject == Scope)
         {
             //Project
             StreamReader sr = new StreamReader(projectName, System.Text.Encoding.UTF8);
             string       projectFileContent = sr.ReadToEnd();
             sr.Dispose();
             System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("<OutputPath>(\\S+)</OutputPath>");
             string outPutPath = reg.Match(projectFileContent).Groups[1].Value;
             if (outPutPath == string.Empty)
             {
                 outPutPath = "bin\\Debug\\";
             }
             string FullOutPutPath = Path.Combine(Path.GetDirectoryName(projectName), outPutPath);
             System.Text.RegularExpressions.Regex regframework   = new System.Text.RegularExpressions.Regex("<TargetFramework>(\\S+)</TargetFramework>");
             System.Text.RegularExpressions.Group groupframework = regframework.Match(projectFileContent).Groups[1];
             string repairFullOutPutPath = null;
             if (groupframework.Success)
             {
                 repairFullOutPutPath = Path.Combine(FullOutPutPath, groupframework.Value);
                 if (Directory.Exists(repairFullOutPutPath))
                 {
                     FullOutPutPath = repairFullOutPutPath;
                 }
             }
             string FullCopyPath = Path.Combine(Path.GetDirectoryName(projectName), "bin\\");
             //复制文件添加Razor自动提示功能
             CopyRazorLibrary(projectName, projectFileContent);
             if (FullOutPutPath != FullCopyPath)
             {
                 CopyDirectory(FullOutPutPath, FullCopyPath);
                 OutPutString("从目录:\"" + FullOutPutPath + "\"复制到:\"" + FullCopyPath + "\"", true);
             }
         }
     }
 }
Exemplo n.º 48
0
        /// <summary>
        /// A method called to notify the tool window that a build has begun.
        /// </summary>
        /// <param name="scope">The scope.</param>
        /// <param name="action">The action.</param>
        internal void NotifyBuildBegin(vsBuildScope scope, vsBuildAction action)
        {
            BuildAction           = action;
            BuildScope            = scope;
            NumberOfProjectsBuilt = 0;

            if (BuildScope == vsBuildScope.vsBuildScopeSolution)
            {
                NumberOfProjectsToBeBuilt          = GetNumberOfProjectsToBeBuilt();
                _viewModel.IsProgressIndeterminate = false;
            }
            else
            {
                NumberOfProjectsToBeBuilt          = 0;
                _viewModel.IsProgressIndeterminate = true;
            }

            Caption = DefaultCaption;
            _viewModel.HasBuildFailed     = false;
            _viewModel.IsBuildActive      = true;
            _viewModel.ProgressPercentage = 0;
        }
Exemplo n.º 49
0
        private void OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            OutputWindowPane BuildOutputPane = null;

            foreach (OutputWindowPane pane in _dte2.ToolWindows.OutputWindow.OutputWindowPanes)
            {
                if (pane.Guid == VSConstants.OutputWindowPaneGuid.BuildOutputPane_string)
                {
                    BuildOutputPane = pane;
                    break;
                }
            }

            if (BuildOutputPane == null)
            {
                return;
            }

            if (ShowBuildReport)
            {
                BuildOutputPane.OutputString("\r\nProjects build report:\r\n");
                BuildOutputPane.OutputString("  Status    | Project [Config|platform]\r\n");
                BuildOutputPane.OutputString(" -----------|---------------------------------------------------------------------------------------------------\r\n");

                foreach (string ReportItem in _projectsBuildReport)
                {
                    BuildOutputPane.OutputString(ReportItem + "\r\n");
                }
            }

            if (ShowElapsedBuildTimeEnabled)
            {
                var elapsed = DateTime.Now - _buildStartTime;
                var time    = elapsed.ToString(@"hh\:mm\:ss\.ff");
                var text    = string.Format("Time Elapsed {0}", time);

                BuildOutputPane.OutputString("\r\n" + text + "\r\n");
            }
        }
Exemplo n.º 50
0
        private void OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            OutputWindowPane buildOutputPane = null;

            // ReSharper disable once LoopCanBeConvertedToQuery
            foreach (OutputWindowPane pane in _dte2.ToolWindows.OutputWindow.OutputWindowPanes)
            {
                if (pane.Guid == VSConstants.OutputWindowPaneGuid.BuildOutputPane_string)
                {
                    buildOutputPane = pane;
                    break;
                }
            }

            if (buildOutputPane == null)
            {
                return;
            }

            if (ShowBuildReport)
            {
                buildOutputPane.OutputString("\r\nProjects build report:\r\n");
                buildOutputPane.OutputString("  Status    | Project [Config|platform]\r\n");
                buildOutputPane.OutputString(" -----------|---------------------------------------------------------------------------------------------------\r\n");
                foreach (var reportItem in _projectsBuildReport)
                {
                    buildOutputPane.OutputString(reportItem + "\r\n");
                }
            }

            if (ShowElapsedBuildTimeEnabled)
            {
                var elapsed = DateTime.Now - _buildStartTime;
                var time    = elapsed.ToString(@"hh\:mm\:ss\.ff");
                var text    = $"Time Elapsed {time}";
                buildOutputPane.OutputString("\r\n" + text + "\r\n");
            }
        }
Exemplo n.º 51
0
        /// <summary>
        /// Called when a build begin event has occured.
        /// </summary>
        /// <param name="Scope">The scope.</param>
        /// <param name="Action">The action.</param>
        public void OnBuildBegin(vsBuildScope scope, vsBuildAction action)
        {
            Logger.Write("BuildEvents_OnBuildBegin scope: " + scope.ToString() + " action " + action.ToString(), LogLevel.Debug);

            _currentBuildState  = vsBuildState.vsBuildStateInProgress;
            _currentBuildAction = action;
            _currentBuildScope  = scope;
            _buildStartDate     = DateTime.Now;

            ExecuteIncrement();
            _updatedItems.Clear();

#if OLD
            try
            {
                if (action == vsBuildAction.vsBuildActionBuild ||
                    action == vsBuildAction.vsBuildActionRebuildAll)
                {
                    _currentBuildVersion = CreateBuildVersion();

                    if (scope == vsBuildScope.vsBuildScopeSolution)
                    {
                        SolutionItem solutionItem = new SolutionItem(_connect.ApplicationObject.Solution);
                        Execute(solutionItem);
                    }
                    else
                    {
                        Array projects = (Array)_connect.ApplicationObject.ActiveSolutionProjects;
                        foreach (Project p in projects)
                        {
                            SolutionItem solutionItem = new SolutionItem(p);
                            Execute(solutionItem);
                        }
                    }
                }
            }
#endif
        }
Exemplo n.º 52
0
        private async void _buildEvents_OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            if (!CurrentSolutionHasBitConfigV1JsonFile())
            {
                return;
            }

            try
            {
                if (action == vsBuildAction.vsBuildActionClean)
                {
                    await CleanCodes();
                }
                else
                {
                    await GenerateCodes();
                }
            }
            catch (Exception ex)
            {
                LogException("Generate|Clean codes failed.", ex);
            }
        }
Exemplo n.º 53
0
        /// <summary>
        /// Event handler for the build event, which will silently generate the typescript files
        /// </summary>
        /// <param name="Scope">the build scope</param>
        /// <param name="Action">The build action</param>
        private void BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            Workspace             workspace   = VsHelper.Current.GetCurrentWorkspace();
            List <EnvDTE.Project> enabledProj = ConfigProcessing.GetEnabledProjectsForSolution();

            if (enabledProj.Count > 0)
            {
                foreach (EnvDTE.Project proj in enabledProj)
                {
                    BuildHelper.StartBuild(proj.FullName);
                    try
                    {
                        ScriptGenAssemblyCache.GetForProj(proj).GenerateScripts(workspace, proj.FullName, false);
                    }
                    catch (Exception e)
                    {
                        VsHelper.SetStatusBar("There was an error generating scripts.  Scripts will be generated by MSBuild: " + e.Message);
                        BuildHelper.EndBuild(proj.FullName);
                    }
                }
            }
        }
Exemplo n.º 54
0
        private void OnBuildBegin(vsBuildScope scope, vsBuildAction action)
        {
            if (!IsEnabled || _alreadyRan)
            {
                return;
            }

            _alreadyRan = true;

            WriteToPane("INFO: Starting IIS Reset....\n");

            var output = DoIisReset();

            if (output.Contains("administrator"))
            {
                WriteToPane("ERROR: Requires admin rights.\n");
            }
            else
            {
                WriteToPane(output);
            }
            WriteToPane("INFO: Finishing IIS Reset....\n");
        }
Exemplo n.º 55
0
        private void BuildEvents_OnBuildBegin(vsBuildScope scope, vsBuildAction Action)
        {
            try
            {
                if (Action == vsBuildAction.vsBuildActionClean)
                {
                    // Clear the project.json restore cache on clean to ensure that the next build restores again
                    if (_buildIntegratedCache != null)
                    {
                        _buildIntegratedCache.Clear();
                    }

                    return;
                }

                if (!IsAutomatic(Settings))
                {
                    return;
                }

                var forceRestore = Action == vsBuildAction.vsBuildActionRebuildAll;

                // Execute
                Restore(forceRestore, showOptOutMessage: true);
            }
            catch (Exception ex)
            {
                // Log the exception to the console and activity log
                LogException(ex, logError: false);
            }

            if (_displayRestoreSummary)
            {
                // If actions were performed, display the summary
                WriteLine(_canceled, _hasMissingPackages, _hasErrors, forceStatusWrite: false);
            }
        }
Exemplo n.º 56
0
        private void _buildEvents_OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            if (!WorkspaceHasBitConfigV1JsonFile())
            {
                return;
            }

            try
            {
                if (action == vsBuildAction.vsBuildActionClean)
                {
                    CallCleanCodes();
                    lastActionWasClean = true;
                }
                else
                {
                    CallGenerateCodes();
                }
            }
            catch (Exception ex)
            {
                LogException("Generate|Clean codes failed.", ex);
            }
        }
Exemplo n.º 57
0
        private void _buildEvents_OnBuildDone(vsBuildScope scope, vsBuildAction action)
        {
            try
            {
                Solution solution = _workspace.CurrentSolution;

                if (action == vsBuildAction.vsBuildActionClean)
                {
                    new DefaultHtmlClientProxyCleaner(new DefaultBitCodeGeneratorMappingsProvider(new DefaultBitConfigProvider()))
                    .DeleteCodes(_workspace, solution, _isBeingBuiltProjects);

                    Log("Generated codes were deleted");
                }
                else
                {
                    Stopwatch watch = Stopwatch.StartNew();

                    IProjectDtoControllersProvider controllersProvider = new DefaultProjectDtoControllersProvider();
                    IProjectDtosProvider           dtosProvider        = new DefaultProjectDtosProvider(controllersProvider);

                    new DefaultHtmlClientProxyGenerator(new DefaultBitCodeGeneratorOrderedProjectsProvider(),
                                                        new DefaultBitCodeGeneratorMappingsProvider(new DefaultBitConfigProvider()), dtosProvider
                                                        , new DefaultHtmlClientProxyDtoGenerator(), new DefaultHtmlClientContextGenerator(), controllersProvider, new DefaultProjectEnumTypesProvider(controllersProvider, dtosProvider))
                    .GenerateCodes(_workspace, solution, _isBeingBuiltProjects);

                    watch.Stop();

                    Log($"Code Generation Completed in {watch.ElapsedMilliseconds} milli seconds");
                }
            }
            catch (Exception ex)
            {
                Log(ex.ToString());
                throw;
            }
        }
        /// <summary>
        /// A build has begun.
        /// </summary>
        /// <param name="scope">The scope.</param>
        /// <param name="action">The action.</param>
        private void buildBegin(vsBuildScope scope, vsBuildAction action)
        {
            BuildAction           = action;
            BuildScope            = scope;
            NumberOfProjectsBuilt = 0;

            if (scope == vsBuildScope.vsBuildScopeSolution)
            {
                NumberOfProjectsToBeBuilt = getNumberOfProjectsToBeBuilt();
                IsProgressIndeterminate   = false;
            }
            else
            {
                NumberOfProjectsToBeBuilt = 0;
                IsProgressIndeterminate   = true;
            }

            // reset the field directly. the property won't allow a "true" to be changed to a "true".
            _hasBuildFailed    = false;
            IsBuildActive      = true;
            ProgressPercentage = 0;
            _buildStatusWindow = new BuildStatusWindow();
            _buildStatusWindow.Show();
        }
Exemplo n.º 59
0
 public virtual void OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
 {
 }
Exemplo n.º 60
0
 private void OnBuildDone(vsBuildScope scope, vsBuildAction action)
 {
     RunTemplates(scope, RunOnBuild.AfterBuild, Options.RunOnBuild == DefaultRunOnBuild.AfterBuild);
 }