private static List <string> GetUsedCementConfigsForProject(string modulePath, string csprojFile) { var projectPath = Path.GetFullPath(csprojFile); var moduleYaml = Path.Combine(modulePath, Helper.YamlSpecFile); if (!File.Exists(moduleYaml)) { return(new List <string>()); } var configurations = new ConfigurationParser(new FileInfo(modulePath)).GetConfigurations(); var result = new HashSet <string>(); foreach (var config in configurations) { var buildData = new BuildYamlParser(new FileInfo(modulePath)).Get(config); foreach (var data in buildData) { if (data.Target.IsFakeTarget()) { continue; } var slnPath = Path.Combine(modulePath, data.Target); var solutionParser = new VisualStudioProjectParser(slnPath, new List <string>()); var currentConfigs = solutionParser.GetSolutionConfigsByCsproj(projectPath); if (currentConfigs.Contains(data.Configuration)) { result.Add(config); } } } return(result.ToList()); }
private static List <string> GetUsedCementConfigsForSolution(string modulePath, string solutionFile) { var moduleYaml = Path.Combine(modulePath, Helper.YamlSpecFile); if (!File.Exists(moduleYaml)) { return(new List <string>()); } var configurations = new ConfigurationParser(new FileInfo(modulePath)).GetConfigurations(); var result = new HashSet <string>(); foreach (var config in configurations) { var buildData = new BuildYamlParser(new FileInfo(modulePath)).Get(config); foreach (var data in buildData) { if (data.Target.IsFakeTarget()) { continue; } var dataTargetPath = Path.Combine(modulePath, data.Target); if (dataTargetPath == solutionFile) { result.Add(config); } } } return(result.ToList()); }
public void ConfigurationParserBuildsPreloadSchedules() { var configuration = ConfigurationManager.OpenExeConfiguration("MetricAgent.exe"); var parser = new ConfigurationParser(); var schedules = parser.Parse(configuration); Assert.IsInstanceOf<ParsedSchedules>(schedules); Assert.AreEqual(7, schedules.PreloadSchedules.Count()); }
private void Run(object state) { // Other side of thread boundary here, so want to trap all exceptions to avoid // bringing the app down without a chance of acting try { var configuration = ConfigurationManager.OpenExeConfiguration("MetricAgent.exe"); var parser = new ConfigurationParser(); var schedules = parser.Parse(configuration); foreach (var preload in schedules.PreloadSchedules) { preload.RunOnce(); } var tasks = new List<Task>(); foreach (var schedule in schedules.Schedules) { var currentSchedule = schedule; tasks.Add(Task.Factory.StartNew(() => currentSchedule.Start(_cancellationToken), _cancellationToken)); } try { Task.WaitAny(tasks.ToArray()); } catch (AggregateException ae) { ae.Handle(x => { Log.Error(ae.Message); return false; }); } } catch (Exception e) { Log.Error(string.Format("{0}\n{1}", e.Message, e.StackTrace)); Console.WriteLine("Failed while running MetricAgent, see log for details"); CancelTasks(); } }
public void UpdateConfigurationIfNull(string workspace) { if (!string.IsNullOrEmpty(Configuration)) { return; } var path = Path.Combine(workspace, Name); if (!DepDefaultConfigurationCache.ContainsKey(path)) { DepDefaultConfigurationCache[path] = new ConfigurationParser(new FileInfo(Path.Combine(workspace, Name))) .GetDefaultConfigurationName(); } Configuration = DepDefaultConfigurationCache[path]; }
public void AddBuiltModule(Dep module, Dictionary <string, string> currentCommitHashes) { var configs = new ConfigurationParser(new FileInfo(Path.Combine(Helper.CurrentWorkspace, module.Name))).GetConfigurations(); var childConfigs = new ConfigurationManager(module.Name, configs).ProcessedChildrenConfigurations(module); childConfigs.Add(module.Configuration); foreach (var childConfig in childConfigs) { var deps = BuildPreparer.Shared.BuildConfigsGraph(module.Name, childConfig).Keys.ToList(); var depsWithCommit = deps .Where(dep => currentCommitHashes.ContainsKey(dep.Name) && currentCommitHashes[dep.Name] != null) .Select(dep => new DepWithCommitHash(dep, currentCommitHashes[dep.Name])) .ToList(); modulesWithDeps[new Dep(module.Name, null, childConfig)] = depsWithCommit; } }