Exemple #1
0
        private async void StartButton_OnClick(object sender, RoutedEventArgs e)
        {
            this.IsEnabled          = false;
            this.OutputTextBox.Text = string.Empty;

            try
            {
                string msBuildPath  = this.MsBuildPathTextBox.Text;
                string solutionPath = this.SolutionPathTextBox.Text;
                string logPath      = GetLogPath(solutionPath);

                Stopwatch stopwatch = Stopwatch.StartNew();
                using (BuildRunner buildRunner = new BuildRunner(msBuildPath, solutionPath, logPath))
                {
                    buildRunner.OutputReceived += (sender2, e2) => this.Dispatcher.Invoke(
                        () =>
                    {
                        this.OutputTextBox.Text += e2.Data + Environment.NewLine;
                        this.OutputTextBox.ScrollToEnd();
                    });
                    await buildRunner.Run();
                }

                MessageBox.Show(this, $"Build took {stopwatch.Elapsed:g}\r\nLogs saved to {logPath}", "Build completed", MessageBoxButton.OK, MessageBoxImage.Information);
                Settings.Default.LastSolutionPath = solutionPath;
                Settings.Default.MSBuildPath      = msBuildPath;
                Settings.Default.Save();
            }
            catch (Exception exception)
            {
                MessageBox.Show(this, exception.ToString(), "Oops!", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            this.IsEnabled = true;
        }
Exemple #2
0
        // Worker thread function.
        // Called indirectly from btnStartThread_Click
        private void ThreadEntryPoint()
        {
            BuildRunner worker = new BuildRunner(m_EventStopThread, m_EventThreadStopped, m_oBuilder);

            worker.StepCompleted  += new BuildRunner.StepCompletedDelegate(worker_StepCompleted);
            worker.StepError      += new BuildRunner.StepErrorDelegate(worker_StepError);
            worker.StepStarted    += new BuildRunner.StepStartedDelegate(worker_StepStarted);
            worker.ThreadFinished += new BuildRunner.ThreadFinishedDelegate(worker_ThreadFinished);
            worker.Run();
        }
Exemple #3
0
 private BuildReport RunBuild()
 {
     using (BuildRunner buildRunner = new BuildRunner(
                this.project.ProjectId,
                mother.ProjectRegistry,
                this.mockBuildTrafficSignals,
                this.mockBuildStageRunnerFactory,
                this.logger))
     {
         return(buildRunner.Run());
     }
 }
Exemple #4
0
        static void Main(string[] args)
        {
            if (args.Length != 3)
            {
                System.Console.WriteLine("Wrong number of parameters passed to Builder.Console");
                Environment.ExitCode = -1;
                return;
            }

            Settings settings = new Settings();

            settings.LoadSettings();

            BuildLoader loader = new BuildLoader();

            Builder.Common.Builder builder = loader.Load(settings.BuildInstructions);

            // Run all steps.
            builder.StepStart = -1;
            builder.StepEnd   = -1;

            builder.LoadMacros(args[0], args[1], args[2]);

            string result;

            if (!settings.ValidateSettings(builder, out result))
            {
                System.Console.WriteLine(result);
                Environment.ExitCode = -1;
                return;
            }

            builder.LoadSettings(settings);


            ManualResetEvent eventStopThread    = new ManualResetEvent(false);
            ManualResetEvent eventThreadStopped = new ManualResetEvent(false);

            BuildRunner runner = new BuildRunner(eventStopThread, eventThreadStopped, builder);

            runner.StepError   += new BuildRunner.StepErrorDelegate(runner_StepError);
            builder.MessageLog += new Builder.Common.Builder.MessageLogDelegate(builder_MessageLog);
            runner.Run();

            return;
        }
Exemple #5
0
 public ScriptRunner Run()
 {
     var runner = new BuildRunner(setup);
       runner.Run();
       return this;
 }