public ProjectDependenciesModel BuildModel(string projectName, string projectConfiguration) { if (projectName == null) throw new ArgumentNullException("projectName"); if (projectConfiguration == null) throw new ArgumentNullException("projectConfiguration"); var projectDependenciesModel = new ProjectDependenciesModel(); var projectDesignatorQueue = new Queue<ProjectDesignator>(); projectDesignatorQueue.Enqueue(new ProjectDesignator(projectName, projectConfiguration)); while (projectDesignatorQueue.Count > 0) { // get from queue the next project designator to process ProjectDesignator projectDesignator = projectDesignatorQueue.Dequeue(); // check if we've already obtained this project's info and if so - skip it if (projectDependenciesModel.ProjectInfos.ContainsKey(projectDesignator)) { continue; } OnLogMessagePosted( string.Format( "Obtaining project info. Project: {0} (configuration: {1}).", projectDesignator.ProjectName, projectDesignator.ProjectConfiguration)); // obtain project info ProjectInfo projectInfo = ObtainProjectInfo( projectDesignator.ProjectName, projectDesignator.ProjectConfiguration); // remember that we have this project info obtained projectDependenciesModel.ProjectInfos.Add(projectDesignator, projectInfo); // enqueue all dependent projects so that we'll obtain their infos foreach (ProjectDependency projectDependency in projectInfo.ProjectDependencies) { ProjectDesignator dependentProjectDesignator = ProjectDesignator.FromProjectDependency(projectDependency); // add this project to the queue if we haven't obtained its info yet if (!projectDependenciesModel.ProjectInfos.ContainsKey(dependentProjectDesignator)) { projectDesignatorQueue.Enqueue(dependentProjectDesignator); } } // store the root project info to return from the method (if it hasn't been set yet) if (projectDependenciesModel.RootProjectInfo == null) { projectDependenciesModel.RootProjectInfo = projectInfo; } } return projectDependenciesModel; }
private bool HasPathTo(ProjectInfo searchedProject, ProjectInfo rootProject, ProjectDependenciesModel model) { foreach (ProjectDependency projectDependency in searchedProject.ProjectDependencies) { if (projectDependency.ProjectName == rootProject.ProjectName && projectDependency.ProjectConfiguration == rootProject.ProjectConfiguration && rootProject.ProjectVersion == projectDependency.ProjectVersion) { return(true); } return(HasPathTo(model.ProjectInfos[new ProjectDesignator(projectDependency.ProjectName, projectDependency.ProjectConfiguration)], rootProject, model)); } return(false); }
public ProjectDependenciesGraph BuildGraph(ProjectDependenciesModel projectDependenciesModel) { if (projectDependenciesModel == null) throw new ArgumentNullException("projectDependenciesModel"); var projectDependenciesGraph = new ProjectDependenciesGraph(); Dictionary<ProjectDesignator, ProjectInfoVertex> verticesMap = GatherVertices(projectDependenciesModel, projectDependenciesGraph); GatherEdges(projectDependenciesModel, projectDependenciesGraph, verticesMap); return projectDependenciesGraph; }
public ProjectDependenciesModelForm(ProjectDependenciesModel projectDependenciesModel) { if (projectDependenciesModel == null) throw new ArgumentNullException("projectDependenciesModel"); _projectDependenciesModel = projectDependenciesModel; InitializeComponent(); _projectDependenciesGraphLayoutControl = new ProjectDependenciesGraphLayoutControl(); wpfElementHost_dependenciesGraph.Child = _projectDependenciesGraphLayoutControl; PopulateExportFormats(); }
private static void GatherEdges(ProjectDependenciesModel projectDependenciesModel, ProjectDependenciesGraph projectDependenciesGraph, Dictionary<ProjectDesignator, ProjectInfoVertex> verticesMap) { if (projectDependenciesModel == null) throw new ArgumentNullException("projectDependenciesModel"); if (projectDependenciesGraph == null) throw new ArgumentNullException("projectDependenciesGraph"); if (verticesMap == null) throw new ArgumentNullException("verticesMap"); var visitedMap = new Dictionary<ProjectDesignator, bool>(); foreach (ProjectDesignator projectDesignator in verticesMap.Keys) { ProjectInfoVertex vertex = verticesMap[projectDesignator]; if (visitedMap.ContainsKey(projectDesignator)) { continue; } GatherEdgesAux( vertex.ProjectInfo, projectDependenciesGraph, verticesMap, visitedMap); } }
private static Dictionary<ProjectDesignator, ProjectInfoVertex> GatherVertices(ProjectDependenciesModel projectDependenciesModel, ProjectDependenciesGraph projectDependenciesGraph) { if (projectDependenciesModel == null) throw new ArgumentNullException("projectDependenciesModel"); if (projectDependenciesGraph == null) throw new ArgumentNullException("projectDependenciesGraph"); var verticesMap = new Dictionary<ProjectDesignator, ProjectInfoVertex>(); foreach (ProjectDesignator projectDesignator in projectDependenciesModel.ProjectInfos.Keys) { var projectInfo = projectDependenciesModel.ProjectInfos[projectDesignator]; var projectInfoVertex = new ProjectInfoVertex(projectInfo); projectDependenciesGraph.AddVertex(projectInfoVertex); verticesMap.Add(projectDesignator, projectInfoVertex); } return verticesMap; }
private bool HasPathTo(ProjectInfo searchedProject, ProjectInfo rootProject, ProjectDependenciesModel model) { foreach (ProjectDependency projectDependency in searchedProject.ProjectDependencies) { if (projectDependency.ProjectName == rootProject.ProjectName && projectDependency.ProjectConfiguration == rootProject.ProjectConfiguration && rootProject.ProjectVersion == projectDependency.ProjectVersion) return true; return HasPathTo(model.ProjectInfos[new ProjectDesignator(projectDependency.ProjectName,projectDependency.ProjectConfiguration)],rootProject, model); } return false; }
public ProjectDependenciesModel BuildWhoDependsOnModel(string projectName, string projectConfiguration) { if (projectName == null) throw new ArgumentNullException("projectName"); if (projectConfiguration == null) throw new ArgumentNullException("projectConfiguration"); string[] repositories = _svnClient.GetRepositoryNames(); var projectDependenciesModel = new ProjectDependenciesModel(); var projectDesignatorQueue = new Queue<ProjectDesignator>(); foreach (string repository in repositories) { projectDesignatorQueue.Enqueue(new ProjectDesignator(repository,projectConfiguration)); } projectDesignatorQueue.Enqueue(new ProjectDesignator(projectName, projectConfiguration)); while (projectDesignatorQueue.Count > 0) { // get from queue the next project designator to process ProjectDesignator projectDesignator = projectDesignatorQueue.Dequeue(); // check if we've already obtained this project's info and if so - skip it if (projectDependenciesModel.ProjectInfos.ContainsKey(projectDesignator)) { continue; } OnLogMessagePosted( string.Format( "Obtaining project info. Project: {0} (configuration: {1}).", projectDesignator.ProjectName, projectDesignator.ProjectConfiguration)); // obtain project info ProjectInfo projectInfo = ObtainProjectInfo( projectDesignator.ProjectName, projectDesignator.ProjectConfiguration); // remember that we have this project info obtained projectDependenciesModel.ProjectInfos.Add(projectDesignator, projectInfo); // enqueue all dependent projects so that we'll obtain their infos foreach (ProjectDependency projectDependency in projectInfo.ProjectDependencies) { ProjectDesignator dependentProjectDesignator = ProjectDesignator.FromProjectDependency(projectDependency); // add this project to the queue if we haven't obtained its info yet if (!projectDependenciesModel.ProjectInfos.ContainsKey(dependentProjectDesignator)) { projectDesignatorQueue.Enqueue(dependentProjectDesignator); } } } projectDependenciesModel.RootProjectInfo = projectDependenciesModel.ProjectInfos.FirstOrDefault(f=>f.Key.ProjectName == projectName).Value; List<ProjectDesignator> removeList = new List<ProjectDesignator>(); foreach (ProjectDesignator projectDesignator in projectDependenciesModel.ProjectInfos.Keys) { if (projectDesignator.ProjectName == projectDependenciesModel.RootProjectInfo.ProjectName && projectDesignator.ProjectConfiguration == projectDependenciesModel.RootProjectInfo.ProjectConfiguration) { continue; } if (!HasPathTo(projectDependenciesModel.ProjectInfos[projectDesignator], projectDependenciesModel.RootProjectInfo, projectDependenciesModel)) { removeList.Add(projectDesignator); } } foreach (ProjectDesignator projectDesignator in removeList) { projectDependenciesModel.ProjectInfos.Remove(projectDesignator); foreach(ProjectInfo projectInfo in projectDependenciesModel.ProjectInfos.Values) { projectInfo.ProjectDependencies.RemoveAll(f => f.ProjectConfiguration == projectDesignator.ProjectConfiguration && f.ProjectName == projectDesignator.ProjectName); } } return projectDependenciesModel; }
public ProjectDependenciesModel BuildModel(string projectName, string projectConfiguration) { if (projectName == null) { throw new ArgumentNullException("projectName"); } if (projectConfiguration == null) { throw new ArgumentNullException("projectConfiguration"); } var projectDependenciesModel = new ProjectDependenciesModel(); var projectDesignatorQueue = new Queue <ProjectDesignator>(); projectDesignatorQueue.Enqueue(new ProjectDesignator(projectName, projectConfiguration)); while (projectDesignatorQueue.Count > 0) { // get from queue the next project designator to process ProjectDesignator projectDesignator = projectDesignatorQueue.Dequeue(); // check if we've already obtained this project's info and if so - skip it if (projectDependenciesModel.ProjectInfos.ContainsKey(projectDesignator)) { continue; } OnLogMessagePosted( string.Format( "Obtaining project info. Project: {0} (configuration: {1}).", projectDesignator.ProjectName, projectDesignator.ProjectConfiguration)); // obtain project info ProjectInfo projectInfo = ObtainProjectInfo( projectDesignator.ProjectName, projectDesignator.ProjectConfiguration); // remember that we have this project info obtained projectDependenciesModel.ProjectInfos.Add(projectDesignator, projectInfo); // enqueue all dependent projects so that we'll obtain their infos foreach (ProjectDependency projectDependency in projectInfo.ProjectDependencies) { ProjectDesignator dependentProjectDesignator = ProjectDesignator.FromProjectDependency(projectDependency); // add this project to the queue if we haven't obtained its info yet if (!projectDependenciesModel.ProjectInfos.ContainsKey(dependentProjectDesignator)) { projectDesignatorQueue.Enqueue(dependentProjectDesignator); } } // store the root project info to return from the method (if it hasn't been set yet) if (projectDependenciesModel.RootProjectInfo == null) { projectDependenciesModel.RootProjectInfo = projectInfo; } } return(projectDependenciesModel); }
public ProjectDependenciesModel BuildWhoDependsOnModel(string projectName, string projectConfiguration) { if (projectName == null) { throw new ArgumentNullException("projectName"); } if (projectConfiguration == null) { throw new ArgumentNullException("projectConfiguration"); } string[] repositories = _svnClient.GetRepositoryNames(); var projectDependenciesModel = new ProjectDependenciesModel(); var projectDesignatorQueue = new Queue <ProjectDesignator>(); foreach (string repository in repositories) { projectDesignatorQueue.Enqueue(new ProjectDesignator(repository, projectConfiguration)); } projectDesignatorQueue.Enqueue(new ProjectDesignator(projectName, projectConfiguration)); while (projectDesignatorQueue.Count > 0) { // get from queue the next project designator to process ProjectDesignator projectDesignator = projectDesignatorQueue.Dequeue(); // check if we've already obtained this project's info and if so - skip it if (projectDependenciesModel.ProjectInfos.ContainsKey(projectDesignator)) { continue; } OnLogMessagePosted( string.Format( "Obtaining project info. Project: {0} (configuration: {1}).", projectDesignator.ProjectName, projectDesignator.ProjectConfiguration)); // obtain project info ProjectInfo projectInfo = ObtainProjectInfo( projectDesignator.ProjectName, projectDesignator.ProjectConfiguration); // remember that we have this project info obtained projectDependenciesModel.ProjectInfos.Add(projectDesignator, projectInfo); // enqueue all dependent projects so that we'll obtain their infos foreach (ProjectDependency projectDependency in projectInfo.ProjectDependencies) { ProjectDesignator dependentProjectDesignator = ProjectDesignator.FromProjectDependency(projectDependency); // add this project to the queue if we haven't obtained its info yet if (!projectDependenciesModel.ProjectInfos.ContainsKey(dependentProjectDesignator)) { projectDesignatorQueue.Enqueue(dependentProjectDesignator); } } } projectDependenciesModel.RootProjectInfo = projectDependenciesModel.ProjectInfos.FirstOrDefault(f => f.Key.ProjectName == projectName).Value; List <ProjectDesignator> removeList = new List <ProjectDesignator>(); foreach (ProjectDesignator projectDesignator in projectDependenciesModel.ProjectInfos.Keys) { if (projectDesignator.ProjectName == projectDependenciesModel.RootProjectInfo.ProjectName && projectDesignator.ProjectConfiguration == projectDependenciesModel.RootProjectInfo.ProjectConfiguration) { continue; } if (!HasPathTo(projectDependenciesModel.ProjectInfos[projectDesignator], projectDependenciesModel.RootProjectInfo, projectDependenciesModel)) { removeList.Add(projectDesignator); } } foreach (ProjectDesignator projectDesignator in removeList) { projectDependenciesModel.ProjectInfos.Remove(projectDesignator); foreach (ProjectInfo projectInfo in projectDependenciesModel.ProjectInfos.Values) { projectInfo.ProjectDependencies.RemoveAll(f => f.ProjectConfiguration == projectDesignator.ProjectConfiguration && f.ProjectName == projectDesignator.ProjectName); } } return(projectDependenciesModel); }