public void GetDeps() { rootRepo = new GitRepository(rootModule.Name, Helper.CurrentWorkspace, Log); rootRepoTreeish = rootRepo.CurrentLocalTreeish().Value; var depsContent = new DepsParser(rootRepo.RepoPath).Get(rootModule.Configuration); if (!Directory.Exists(Path.Combine(Helper.CurrentWorkspace, "nuget")) && modules.Any(m => m.Name == "nuget")) { depsContent.Deps.Add(new Dep("nuget")); } depsContent.Force = Helper.DefineForce(depsContent.Force, rootRepo); Log.Info("OK"); var queue = new DepsQueue(); queue.AddRange(depsContent.Deps, rootModule.Name); var proceed = new ModulesContainer(); GetDeps(depsContent.Force, queue, proceed); CycleDetector.WarnIfCycle(rootModule.Name, rootModule.Configuration, Log); }
private static void MarkProcessedDeps(DepsQueue queue, ModulesContainer processed, List <DepWithParent> depsPool) { foreach (var dep in depsPool) { dep.Dep.UpdateConfigurationIfNull(); if (dep.Dep.Treeish != null && processed.GetDepsByName(dep.Dep.Name).All(d => d.Treeish == null)) { processed.ChangeTreeish(dep.Dep.Name, dep.Dep.Treeish); Log.LogInformation("Need get " + dep.Dep.Name + " again"); queue.AddRange(processed.GetConfigsByName(dep.Dep.Name).Select(c => new DepWithParent(new Dep(dep.Dep.Name, null, c), dep.ParentModule)).ToList()); } processed.Add(dep); } }
private static void AddNewDeps(DepsQueue queue, ModulesContainer processed, List <DepWithParent> depsPool) { foreach (var dep in depsPool) { var currentModuleDeps = GetCurrentModuleDeps(dep.Dep); if (currentModuleDeps.Deps == null) { continue; } queue.AddRange(currentModuleDeps.Deps.Where(d => !processed.IsProcessed(d)) .Select(d => new DepWithParent(d, dep.Dep.Name)).ToList()); } }
public void GetDeps() { rootRepo = new GitRepository(rootModule.Name, Helper.CurrentWorkspace, Log); rootRepoTreeish = rootRepo.CurrentLocalTreeish().Value; var depsContent = new DepsParser(rootRepo.RepoPath).Get(rootModule.Configuration); depsContent.Force = depsContent.Force?.Select(f => Helper.DefineForce(f, rootRepo)).ToArray(); Log.LogInformation("OK"); var queue = new DepsQueue(); queue.AddRange(depsContent.Deps, rootModule.Name); var proceed = new ModulesContainer(); GetDeps(depsContent.Force, queue, proceed); CycleDetector.WarnIfCycle(rootModule.Name, rootModule.Configuration, Log); }
private void GetDeps(string force, DepsQueue queue, ModulesContainer processed) { while (!queue.IsEmpty()) { var depsPool = new List <DepWithParent>(); var backToQueue = new List <DepWithParent>(); TakeDepsToProcessFromQueue(queue, depsPool, backToQueue, processed); foreach (var dep in depsPool) { processed.AddConfig(dep.Dep.Name, dep.Dep.Configuration); } queue.AddRange(backToQueue); ProcessDeps(force, depsPool); MarkProcessedDeps(queue, processed, depsPool); AddNewDeps(queue, processed, depsPool); } if (errorOnMerge) { ConsoleWriter.WriteWarning($"Branch '{mergedBranch}' was not merged into some of dependencies"); } }