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 void UpdateSections(string section, IReadOnlyList <Configuration.SettingValue> values) { if (CanChangeSettings) { SolutionSettings.UpdateSections(section, values); } }
public void SetValue(string section, string key, string value) { if (CanChangeSettings) { SolutionSettings.SetValue(section, key, value); } }
public void SaveToDisk() { if (CanChangeSettings) { SolutionSettings.SaveToDisk(); } }
public void AddOrUpdate(string sectionName, SettingItem item) { if (CanChangeSettings) { SolutionSettings.AddOrUpdate(sectionName, item); } }
public void Remove(string sectionName, SettingItem item) { if (CanChangeSettings) { SolutionSettings.Remove(sectionName, item); } }
public void SetNestedSettingValues(string section, string subsection, IList <SettingValue> values) { if (CanChangeSettings) { SolutionSettings.SetNestedSettingValues(section, subsection, values); } }
public void UpdateSubsections(string section, string subsection, IReadOnlyList <SettingValue> values) { if (CanChangeSettings) { SolutionSettings.UpdateSubsections(section, subsection, values); } }
public void SetValues(string section, IReadOnlyList <SettingValue> values) { if (CanChangeSettings) { SolutionSettings.SetValues(section, values); } }
public void SetNestedValues(string section, string subSection, IList <KeyValuePair <string, string> > values) { if (CanChangeSettings) { SolutionSettings.SetNestedValues(section, subSection, values); } }
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(); }
private void SaveSettings(object obj) { if (MessageBox.Show(Window, "Easy BAML is about to make changes in selected projects: set default UI culture, add localization build steps and add translation files.\nOperation may take several minutes.\nAfter it complete, selected project(s) will be build with localization.", "Easy BAML", MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } if (settings == null) { settings = new SolutionSettings(); } settings.UidGenerationMode = UidGenerationMode; settings.DevelepmentCulture = DefaultLanguage.Name; var selCults = SelectedLanguages.Select(lang => lang.Name).ToList(); settings.LocalizationCultures = selCults; if (settings.ProjectsSettings == null) { settings.ProjectsSettings = new List <ProjectSettings>(); } foreach (var projSettingVM in projectsSettings) { var projSetting = settings.ProjectsSettings.FirstOrDefault( ps => ps.ProjectUniqueName == projSettingVM.UniqueName); if (projSetting == null) { projSetting = new ProjectSettings { ProjectUniqueName = projSettingVM.UniqueName }; settings.ProjectsSettings.Add(projSetting); } projSetting.Localizable = projSettingVM.Localizable; } if (settingsService.SaveSolutionSettings(settings)) { if (ConfigureSolution()) { Close(true); } } }
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; } }
/// <summary> /// Finds a .json settings file in the given path that indicates the model assembly to use for schema merge. Prompts /// the user with File Open dialog if settings file isn't found, and saves results in new settings file /// </summary> /// <param name="solutionFolder">Directory where solution is</param> /// <returns>Full path of model assembly</returns> private string FindModelAssembly(string solutionFolder) { string settingsFile = SolutionSettingsFile(solutionFolder); SolutionSettings settings = null; if (File.Exists(settingsFile)) { settings = ReadJsonFile <SolutionSettings>(settingsFile); if (File.Exists(settings.ModelAssembly)) { return(settings.ModelAssembly); } } settings = new SolutionSettings(); settings.ModelAssembly = DialogSelectModelAssembly(solutionFolder); WriteJsonFile(settingsFile, settings); return(settings.ModelAssembly); }
public void GetUnsetValuesFrom(RunSettingsContainer other) { SolutionSettings.GetUnsetValuesFrom(other.SolutionSettings); var allOtherProjectSettings = new List <RunSettings>(other.ProjectSettings); foreach (RunSettings myProjectSettings in ProjectSettings) { var otherProjectSettings = allOtherProjectSettings.FirstOrDefault(s => myProjectSettings.ProjectRegex == s.ProjectRegex); if (otherProjectSettings != null) { allOtherProjectSettings.Remove(otherProjectSettings); myProjectSettings.GetUnsetValuesFrom(otherProjectSettings); } } foreach (RunSettings remainingProjectSettings in allOtherProjectSettings) { ProjectSettings.Add(remainingProjectSettings); } }
private void LoadSettings() { settings = settingsService.GetSolutionSettings(); if (settings == null) { return; } UidGenerationMode = settings.UidGenerationMode; if (!String.IsNullOrEmpty(settings.DevelepmentCulture)) { DefaultLanguage = new CultureItemViewModel(settings.DevelepmentCulture); } if (settings.LocalizationCultures != null) { foreach (var cult in settings.LocalizationCultures) { SelectedLanguages.Add(new CultureItemViewModel(cult)); } } foreach (var projSettingVM in projectsSettings) { if (settings.ProjectsSettings != null) { var projSetting = settings.ProjectsSettings.FirstOrDefault( ps => ps.ProjectUniqueName == projSettingVM.UniqueName); if (projSetting != null) { projSettingVM.Localizable = projSetting.Localizable; } } } }
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); }
public IList <string> GetConfigRoots() => SolutionSettings.GetConfigRoots();
public IList <Configuration.SettingValue> GetSettingValues(string section, bool isPath = false) { return(SolutionSettings.GetSettingValues(section, isPath)); }
public bool DeleteValue(string section, string key) => CanChangeSettings && SolutionSettings.DeleteValue(section, key);
public IList <string> GetConfigFilePaths() => SolutionSettings.GetConfigFilePaths();
public SolutionCommand(IOptions <SolutionSettings> solutionSettings) { _solutionSettings = solutionSettings.Value; }
public bool DeleteSection(string section) => CanChangeSettings && SolutionSettings.DeleteSection(section);
public bool DeleteSection(string section) { return(CanChangeSettings && SolutionSettings.DeleteSection(section)); }
public SettingSection GetSection(string sectionName) { return(SolutionSettings.GetSection(sectionName)); }
public PushCommand(IOrganizationService organizationService, ILogger <PushCommand> logger, IOptions <SolutionSettings> solutionSettings) : base(organizationService) { _logger = logger; _solutionSettings = solutionSettings.Value; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (urlBox == null) { return; } // Add current project root (if available) first if (SolutionSettings != null && SolutionSettings.ProjectRootUri != null) { if (!urlBox.Items.Contains(SolutionSettings.ProjectRootUri)) { urlBox.Items.Add(SolutionSettings.ProjectRootUri); } } if (Config != null) { // Add last used url using (RegistryKey rk = Config.OpenUserInstanceKey("Dialogs")) { if (rk != null) { string value = rk.GetValue("Last Repository") as string; Uri uri; if (value != null && Uri.TryCreate(value, UriKind.Absolute, out uri)) { if (!urlBox.Items.Contains(uri)) { urlBox.Items.Add(uri); } } } } foreach (string value in Config.GetRecentReposUrls()) { Uri uri; if (value != null && Uri.TryCreate(value, UriKind.Absolute, out uri)) { if (!urlBox.Items.Contains(uri)) { urlBox.Items.Add(uri); } } } } if (SolutionSettings != null) { foreach (Uri uri in SolutionSettings.GetRepositoryUris(true)) { if (!urlBox.Items.Contains(uri)) { urlBox.Items.Add(uri); } } } if (urlBox.Items.Count > 0 && string.IsNullOrEmpty(urlBox.Text.Trim())) { urlBox.SelectedIndex = 0; UpdateDirectories(); } if (string.IsNullOrEmpty(fileTypeBox.Text) && fileTypeBox.Items.Count > 0) { fileTypeBox.SelectedItem = fileTypeBox.Items[0]; } }
public bool DeleteValue(string section, string key) { return(CanChangeSettings && SolutionSettings.DeleteValue(section, key)); }
public IList <KeyValuePair <string, string> > GetNestedValues(string section, string subSection) { return(SolutionSettings.GetNestedValues(section, subSection)); }
public string GetValue(string section, string key, bool isPath = false) { return(SolutionSettings.GetValue(section, key, isPath)); }