コード例 #1
0
        private static void GatherEdgesAux(ProjectInfo projectInfo, ProjectDependenciesGraph projectDependenciesGraph, Dictionary<ProjectDesignator, ProjectInfoVertex> verticesMap, Dictionary<ProjectDesignator, bool> visitedMap)
        {
            // TODO IMM HI: abstract the visitor -> such code is duplicated in DgmlProjectDependenciesModelExporter

              if (projectInfo == null) throw new ArgumentNullException("projectInfo");
              if (projectDependenciesGraph == null) throw new ArgumentNullException("projectDependenciesGraph");
              if (verticesMap == null) throw new ArgumentNullException("verticesMap");

              ProjectDesignator projectDesignator = ProjectDesignator.FromProjectInfo(projectInfo);
              ProjectInfoVertex projectInfoVertex = verticesMap[projectDesignator];

              visitedMap[projectDesignator] = true;

              foreach (ProjectDependency projectDependency in projectInfo.ProjectDependencies)
              {
            ProjectDesignator dependentProjectDesignator = ProjectDesignator.FromProjectDependency(projectDependency);
            ProjectInfoVertex dependentProjectInfoVertex = verticesMap[dependentProjectDesignator];

            projectDependenciesGraph.AddEdge(
              new Edge<ProjectInfoVertex>(
            projectInfoVertex,
            dependentProjectInfoVertex));

            if (visitedMap.ContainsKey(dependentProjectDesignator))
            {
              // already processed - skip it
              continue;
            }

            GatherEdgesAux(dependentProjectInfoVertex.ProjectInfo, projectDependenciesGraph, verticesMap, visitedMap);
              }
        }
コード例 #2
0
        private static void ExportAux(XElement linksElement, ProjectDependenciesModel projectDependenciesModel, ProjectInfo projectInfo, Dictionary<ProjectDesignator, bool> visitedMap)
        {
            if (linksElement == null) throw new ArgumentNullException("linksElement");
              if (projectDependenciesModel == null) throw new ArgumentNullException("projectDependenciesModel");
              if (projectInfo == null) throw new ArgumentNullException("projectInfo");
              if (visitedMap == null) throw new ArgumentNullException("visitedMap");

              ProjectDesignator projectDesignator = ProjectDesignator.FromProjectInfo(projectInfo);

              visitedMap[projectDesignator] = true;

              foreach (ProjectDependency projectDependency in projectInfo.ProjectDependencies)
              {
            ProjectDesignator dependentProjectDesignator = ProjectDesignator.FromProjectDependency(projectDependency);
            ProjectInfo dependentProjectInfo = projectDependenciesModel.ProjectInfos[dependentProjectDesignator];

            linksElement.Add(
              new XElement(
            _DgmlNamespace + "Link",
            new XAttribute("Source", CreateProjectDisplayString(projectInfo)),
            new XAttribute("Target", CreateProjectDisplayString(dependentProjectInfo)),
            new XAttribute("Label", projectDependency.ProjectVersion)));

            if (visitedMap.ContainsKey(dependentProjectDesignator))
            {
              // already processed - skip it
              continue;
            }

            ExportAux(linksElement, projectDependenciesModel, dependentProjectInfo, visitedMap);
              }
        }
コード例 #3
0
        public ProjectInfoVertex(ProjectInfo projectInfo)
        {
            if (projectInfo == null) throw new ArgumentNullException("projectInfo");

              _projectInfo = projectInfo;
        }
コード例 #4
0
        private void ObtainProjectVersion(ProjectInfo projectInfo, string projectRelativePath)
        {
            if (projectInfo == null) throw new ArgumentNullException("projectInfo");
              if (projectRelativePath == null) throw new ArgumentNullException("projectRelativePath");

              string versionFileName = "Version.xml";
              string versionFilePath = string.Format("{0}/{1}", projectRelativePath, versionFileName);
              string versionFileContents = _svnClient.GetFileContents(versionFilePath);

              if (string.IsNullOrEmpty(versionFileContents))
              {
            projectInfo.ProjectVersion = "?";

            return;
              }

              string projectVersion = _versionFileAnalyzer.GetProjectVersion(versionFileContents);

              if (string.IsNullOrEmpty(projectVersion))
              {
            throw new ArgumentException(
              string.Format(
            "Couldn't obtain project version for project {0} (configuration: {1}).",
            projectInfo.ProjectName,
            projectInfo.ProjectConfiguration));
              }

              projectInfo.ProjectVersion = projectVersion;
        }
コード例 #5
0
        private ProjectInfo ObtainProjectInfo(string projectName, string projectConfiguration)
        {
            if (projectName == null) throw new ArgumentNullException("projectName");
              if (projectConfiguration == null) throw new ArgumentNullException("projectConfiguration");

              var projectInfo =
            new ProjectInfo
            {
              ProjectName = projectName,
              ProjectConfiguration = projectConfiguration,
            };

              string projectConfigurationUpper = projectConfiguration.ToUpper();
              string projectRelativePath =
            (projectConfigurationUpper == "TRUNK" || projectConfigurationUpper == "PRODUCTION")
              ? string.Format("{0}/trunk", projectName)
              : string.Format("{0}/branches/{1}", projectName, projectConfiguration);

              ObtainProjectVersion(projectInfo, projectRelativePath);
              ObtainProjectDependencies(projectInfo, projectRelativePath);

              return projectInfo;
        }
コード例 #6
0
        private void ObtainProjectDependencies(ProjectInfo projectInfo, string projectRelativePath)
        {
            if (projectInfo == null) throw new ArgumentNullException("projectInfo");
              if (projectRelativePath == null) throw new ArgumentNullException("projectRelativePath");

              string buildFileContents = _svnClient.GetFileContentsByExt(projectRelativePath,".build");
              if (buildFileContents != null)
              {
            foreach (var projectDependency in _buildFileAnalyzer.GetProjectDependencies(buildFileContents))
            {
              projectInfo.ProjectDependencies.Add(projectDependency);
            }
              }
        }
コード例 #7
0
 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;
 }
コード例 #8
0
        private static object CreateProjectDisplayString(ProjectInfo projectInfo)
        {
            if (projectInfo == null) throw new ArgumentNullException("projectInfo");

              return string.Format("{0} - {1} - {2}", projectInfo.ProjectName, projectInfo.ProjectConfiguration, projectInfo.ProjectVersion);
        }
コード例 #9
0
        public static ProjectDesignator FromProjectInfo(ProjectInfo projectInfo)
        {
            if (projectInfo == null) throw new ArgumentNullException("projectInfo");

              return new ProjectDesignator(projectInfo.ProjectName, projectInfo.ProjectConfiguration);
        }