private static CopyItemSet[] CollectCopies(IEnumerable<ProjectNode> projects, DAG<IDependencyNode> dag, ResolveContext context) { return projects .Select(p => CreateCopyLocalSet(p, context)) .Where(c => c.CopyLocalSources.Length > 0) .ToArray() .Select(cls => cls.CreateCopyTaskItem(dag)) .ToArray(); }
private static CopyLocalSet CreateCopyLocalSet(ProjectNode p, ResolveContext context) { return new CopyLocalSet { Dest = p, ProjectCopySource = context.GetProjectReferencesNeedCopy(p).ToArray(), AssemblyCopySource = context.GetAssemblyReferencesNeedCopy(p).ToArray(), RuntimeCopySources = context.GetRuntimeReferencesNeedCopy(p).ToArray() }; }
public MSBuildPatch Resolve(string[] inputs, string runtimeProfile = "") { var resolveContext = new ResolveContext(resolveConfig, new Dictionary<string, ProjectNode>(), runtimeProfile); var projects = resolveContext.GetValidProjects(inputs); var dag = new ProjectDAGBuilder(resolveContext, projects).BuildDAG(); var copyItemSets = CollectCopies(projects, dag, resolveContext); dag.Simplify(); var compileProjects = dag.Out().OfType<ProjectNode>().Select(n => new ProjectItem(n.FullPath, n.Output)).ToArray(); return new MSBuildPatch(compileProjects, copyItemSets); }
public IDictionary<string, string[]> Resolve(string[] inputs, string[] endNodes = null, string runtimeProfile = "") { // System.Diagnostics.Debugger.Launch(); var endPaths = endNodes ?? new string[0]; var resolveContext = new ResolveContext(resolveConfig, new Dictionary<string, ProjectNode>(), runtimeProfile); var inputProjects = resolveContext.GetValidProjects(inputs); var dagRootProjects = reverse ? resolveContext.GetAllProjects() : inputProjects; var dag = new ProjectDAGBuilder(resolveContext, dagRootProjects, excludeNodes).BuildDAG(); if (endPaths.Length > 0) { dag.Cut(v => MatchEnd(v.Data, endPaths)); } var result = new Dictionary<string, string[]>(); foreach (var project in inputProjects) { if (dag.GetVertex(project) != null) { ProcessNode(dag.GetVertex(project), result); } } return result; }
public ProjectDAGBuilder(ResolveContext context, ProjectNode[] projectsNode, string[] excludes) { this.projectsNode = projectsNode; this.excludes = excludes; this.context = context; }
public ProjectDAGBuilder(ResolveContext context, ProjectNode[] projectsNode) : this(context, projectsNode, new string[0]) { }