Esempio n. 1
0
        private void LoadSettings(string solutionPath)
        {
            _solutionSettings.Load(solutionPath);

            useCustomCloneDetectionCheckBox.Checked = _solutionSettings.UseCustomAnalysis;
            analysisFileNameTextBox.Text            = _solutionSettings.AnalysisFileName;
            cloneReportFileNameTextBox.Text         = _solutionSettings.CloneReportFileName;

            usePropertiesFileCheckBox.Checked = _solutionSettings.UsePropertiesFile;
            propertiesFileNameTextBox.Text    = _solutionSettings.PropertiesFileName;

            foreach (KeyValuePair <string, string> propertyOverride in _solutionSettings.PropertyOverrides)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(propertyOverridesDataGridView);
                row.Cells[0].ToolTipText = propertyOverride.Key;
                row.Cells[0].Value       = Res.Parameter;
                row.Cells[1].Value       = propertyOverride.Key;
                row.Cells[2].Value       = propertyOverride.Value;

                propertyOverridesDataGridView.Rows.Add(row);
            }

            propertyOverridesDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
        }
Esempio n. 2
0
        private int Run(string[] args)
        {
            _output = new ConsoleOutput();

            try
            {
                BuildOptions options = ParseBuildOptions(args);
                if (options == null || options.Solution == null)
                {
                    return(1);
                }

                GlobalSettings globalSettings = GlobalSettings.Load(_output);
                globalSettings.Save();
                var settings = new Settings(globalSettings, options, _output);

                var stopwatch = new Stopwatch();
                stopwatch.Start();

                int exitCode = 0;
                if (options.CleanCache)
                {
                    CacheCleaner.Run(settings);
                }
                else
                {
                    var          solutionReaderWriter = new SolutionReaderWriter(settings);
                    SolutionInfo solutionInfo         = solutionReaderWriter.ReadWrite(options.Solution.FullName);
                    settings.SolutionSettings = SolutionSettings.Load(settings, solutionInfo);
                    var projectReaderWriter = new ProjectReaderWriter(settings);
                    projectReaderWriter.ReadWrite(solutionInfo);
                    settings.SolutionSettings.UpdateAndSave(settings, solutionInfo);

                    if (!options.GenerateOnly)
                    {
                        var processLauncher = new ProcessLauncher(settings);
                        Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs cancelArgs)
                        {
                            _output.WriteLine("Stopping build...");
                            processLauncher.Stop();
                            cancelArgs.Cancel = true;
                        };

                        exitCode = processLauncher.Run(solutionInfo);
                    }
                }

                stopwatch.Stop();
                TimeSpan ts            = stopwatch.Elapsed;
                string   buildTimeText = string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
                _output.WriteLine("Build time: " + buildTimeText);

                return(exitCode);
            }
            catch (Exception e)
            {
                _output.WriteLine("ERROR: " + e.Message);
                return(-1);
            }
        }
        public SolutionSettingsDialog(CommandManager commandManager, Settings settings, SolutionInfo solutionInfo)
        {
            _commandManager   = commandManager;
            _settings         = settings;
            _solutionInfo     = solutionInfo;
            _solutionSettings = SolutionSettings.Load(settings, solutionInfo);

            _solutionHierarchy = new SolutionHierarchy(commandManager, solutionInfo, settings);

            InitializeComponent();
            _window.DataContext = _solutionSettings; // Used to bind the checkboxes in the dialog to the solution settings.

            RefreshProjectsTreeView();               // The projects tree view is explicitly created in code, no WPF data binding is used for simplicity.
            InitializeProjectsTreeViewButtons();
        }
Esempio n. 4
0
        private void BuildThread(Settings settings)
        {
            _output.Clear();
            _output.Activate();
            _output.WriteLine("RudeBuild building...");
            _output.WriteLine();

            _stopwatch.Reset();
            _stopwatch.Start();

            int exitCode = -1;

            try
            {
                var          solutionReaderWriter = new SolutionReaderWriter(settings);
                SolutionInfo solutionInfo         = solutionReaderWriter.ReadWrite(settings.BuildOptions.Solution.FullName);
                settings.SolutionSettings = SolutionSettings.Load(settings, solutionInfo);
                var projectReaderWriter = new ProjectReaderWriter(settings);
                projectReaderWriter.ReadWrite(solutionInfo);
                settings.SolutionSettings.UpdateAndSave(settings, solutionInfo);

                exitCode = _processLauncher.Run(solutionInfo);
            }
            catch (System.Exception ex)
            {
                _output.WriteLine("Build failed. An error occurred while building:");
                _output.WriteLine(ex.Message);
            }

            _stopwatch.Stop();
            TimeSpan ts            = _stopwatch.Elapsed;
            string   buildTimeText = string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

            _output.WriteLine("Build time: " + buildTimeText);

            lock (_lock)
            {
                _lastBuildWasSuccessful = !_isBeingStopped && exitCode == 0;
                _buildThread            = null;
                _processLauncher        = null;
            }
        }
Esempio n. 5
0
        private void CacheSolutionInfo(CommandManager commandManager)
        {
            FileInfo solutionFileInfo = GetSolutionFileInfo(commandManager);

            if (null == solutionFileInfo || !solutionFileInfo.Exists)
            {
                _cachedSolutionInfo     = null;
                _cachedSolutionFileInfo = null;
                _cachedSettings         = null;
                return;
            }

            if (HasUpToDateCachedsolutionInfo(solutionFileInfo))
            {
                return;
            }

            _cachedSolutionFileInfo = solutionFileInfo;

            GlobalSettings globalSettings = GlobalSettings.Load(_outputPane);
            var            buildOptions   = new BuildOptions();

            buildOptions.Solution = solutionFileInfo;
            buildOptions.Config   = GetActiveSolutionConfig(commandManager);
            _cachedSettings       = new Settings(globalSettings, buildOptions, _outputPane);

            var solutionReaderWriter = new SolutionReaderWriter(_cachedSettings);

            _cachedSolutionInfo = solutionReaderWriter.Read(_cachedSettings.BuildOptions.Solution.FullName);
            _cachedSettings.SolutionSettings = SolutionSettings.Load(_cachedSettings, _cachedSolutionInfo);
            var projectReaderWriter = new ProjectReaderWriter(_cachedSettings);

            projectReaderWriter.Read(_cachedSolutionInfo);

            _cachedSettings.SolutionSettings.UpdateAndSave(_cachedSettings, _cachedSolutionInfo);
        }