private void ExpandGraphNode(SolutionGraph graph, ProjectGraphNode node) { if (node.IsAlreadyExpanded) { return; } foreach (var projectRef in node.Project.ProjectReferences) { var projectRefNode = TryCreateGraphNode(graph, projectRef); if (projectRefNode != null) { node.ProjectRequirements.Add(projectRefNode); } } var nugetPackages = _nugetReferenceReader.TryReadPackagesConfig(node.Project.ProjectDirectory); foreach (var fileReference in node.Project.FileReferences) { var nugetPackage = nugetPackages?.FindPackage(fileReference.Include.ID); if (nugetPackage != null) { var nugetReference = new NugetReference(node.Project, nugetPackage, fileReference.GetFile(), fileReference.VersionFromPath ?? VersionWithSuffix.Empty()); node.NugetPackageRequirements.Add(nugetReference); } else { var reference = new ReferencedFile(node.Project, fileReference.GetFile(), fileReference.Include.Version); node.FileRequirements.Add(reference); } } }
public SolutionGraph BuildGraph(Project project) { var graph = new SolutionGraph(null); var root = new ProjectGraphNode(project, graph); graph.AddNode(root, true); ExpandGraphNode(graph, root); return(graph); }
public SolutionGraph BuildGraph(Solution solution) { var graph = new SolutionGraph(solution); foreach (var project in solution.Projects) { var projectNode = graph.GetOrAdd(project, isSolutionProject: true); ExpandGraphNode(graph, projectNode); } return(graph); }
public IEnumerable <Solution> SelectSolutions(SolutionGraph theGraph) { var start = From.IsEmpty() ? null : theGraph[From]; var end = To.IsEmpty() ? null : theGraph[To]; if (Direct) { if (To.IsEmpty() || From.IsEmpty()) { throw new InvalidOperationException("If using the Direct option, you must specify bith a From and To solution"); } return(new [] { start, end }); } var solutions = theGraph.AllSolutions.ToList(); solutions = filterByStarting(start, solutions); solutions = filterByEnding(end, solutions); return(solutions); }
public void RunPlan(SolutionGraph graph, RipplePlanRequirements requirements) { var solutions = requirements.SelectSolutions(graph); var plan = new RipplePlan(solutions, requirements.SkipBuild); var number = 0; try { plan.Each(step => runStep(step, ++number, plan.Count)); } finally { Console.WriteLine(); Console.WriteLine(); Console.WriteLine("The log file is at " + RippleFileSystem.RippleLogsDirectory().AppendPath("ripple.log")); Console.WriteLine("or type 'ripple open-log'"); _logger.WriteLogFile("ripple.log"); Console.WriteLine(); Console.WriteLine(); } }
private ProjectGraphNode TryCreateGraphNode(SolutionGraph graph, ProjectReference projectReference) { var projectFile = projectReference.GetFile(); if (projectFile == null) { return(null); } var file = projectFile.TryVerify(); if (file == null) { return(null); } var project = _projectReader.ReadProject(file); var graphNode = graph.GetOrAdd(project, isSolutionProject: false); ExpandGraphNode(graph, graphNode); return(graphNode); }
public RipplePlan BuildPlan(SolutionGraph theGraph) { var allSolutions = SelectSolutions(theGraph); return(new RipplePlan(allSolutions, SkipBuild)); }
public NugetReference GetLatestNugetReference(string packageID, bool includePrereleases, SolutionGraph solution) { return(solution.AllNodes.Values .SelectMany(proj => proj.NugetPackageRequirements) .Where(nuget => nuget.Package.ID == packageID && (includePrereleases || !nuget.Package.Version.HasSuffix)) .Where(nuget => nuget.Version == nuget.Package.Version) .OrderByDescending(nuget => nuget.Version) .FirstOrDefault()); }
public MoveExpression(SolutionGraph solutionGraph, string nugetName) { _solutionGraph = solutionGraph; _nugetName = nugetName; }