Exemple #1
0
            internal void Build()
            {
                List <ILogger> loggers;
                BuildResult    buildResult = BuildResult.Failed;
                Exception      exception   = null;

                try
                {
                    try
                    {
                        if (this.logger != null)
                        {
                            loggers = new List <ILogger>()
                            {
                                this.logger
                            };
                        }
                        else
                        {
                            loggers = null;
                        }
                        List <ILogger> loggers1 = loggers;
                        buildResult = this.buildRequest.BuildContext.BuildWorker.Build(loggers1, this.buildRequest.Targets.ToArray <string>());
                    }
                    catch (Exception exception2)
                    {
                        Exception exception1 = exception2;
                        if (!ErrorHandling.ShouldHandleExceptions(exception1) && !(exception1 is IndexOutOfRangeException) && !(exception1 is NullReferenceException))
                        {
                            throw;
                        }
                        exception = exception1;
                    }
                }
                finally
                {
                    BuildManager.BuildInfo buildInfo = new BuildManager.BuildInfo(this.buildRequest, buildResult, exception);
                    if (!this.blockUntilComplete)
                    {
                        UIThreadDispatcher.Instance.BeginInvoke <object>(DispatcherPriority.ApplicationIdle, () => this.CompleteBuild(buildInfo));
                    }
                    else
                    {
                        this.CompleteBuild(buildInfo);
                    }
                }
            }
Exemple #2
0
            private object CompleteBuild(object o)
            {
                IProjectBuildContext buildContext;
                IExecutable          executable;

                try
                {
                    this.buildComplete    = true;
                    BuildManager.building = false;
                    BuildManager.BuildInfo buildInfo = (BuildManager.BuildInfo)o;
                    if (buildInfo.BuildRequest != null)
                    {
                        buildContext = buildInfo.BuildRequest.BuildContext;
                    }
                    else
                    {
                        buildContext = null;
                    }
                    IProjectBuildContext projectBuildContext = buildContext;
                    BuildResult          buildResult         = buildInfo.BuildResult;
                    if (buildInfo.BuildRequest != null)
                    {
                        executable = buildInfo.BuildRequest.Executable;
                    }
                    else
                    {
                        executable = null;
                    }
                    IExecutable executable1 = executable;
                    bool        flag        = (buildInfo.BuildRequest != null ? buildInfo.BuildRequest.DisplayOutput : true);
                    if (projectBuildContext != null)
                    {
                        projectBuildContext.BuildCompleted(buildResult);
                    }
                    if (this.displayFeedback)
                    {
                        if (buildResult == BuildResult.Succeeded)
                        {
                            this.serviceProvider.MessageLoggingService().WriteLine(StringTable.ProjectBuildCompletedMessage);
                        }
                        else if (buildResult != BuildResult.Failed)
                        {
                            this.serviceProvider.MessageLoggingService().WriteLine(StringTable.ProjectBuildCanceledMessage);
                        }
                        else
                        {
                            if (buildInfo.Exception != null)
                            {
                                this.serviceProvider.MessageLoggingService().WriteLine(buildInfo.Exception.ToString());
                            }
                            this.serviceProvider.MessageLoggingService().WriteLine(StringTable.ProjectBuildFailedMessage);
                        }
                        if (buildResult != BuildResult.Succeeded)
                        {
                            this.serviceProvider.ErrorService().DisplayErrors();
                        }
                    }
                    this.buildManager.OnBuildCompleted(new BuildCompletedEventArgs(projectBuildContext, executable1, buildResult, flag), buildInfo.BuildRequest);
                }
                finally
                {
                    BuildManager.currentBuildThread = null;
                    PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ProjectBuild);
                }
                return(null);
            }