public override void BuildGraph(
            IGraphContext graphContext,
            string projectPath,
            IDependency dependency,
            GraphNode dependencyGraphNode,
            ITargetedDependenciesSnapshot targetedSnapshot)
        {
            // store refreshed dependency info
            dependencyGraphNode.SetValue(DependenciesGraphSchema.DependencyIdProperty, dependency.Id);
            dependencyGraphNode.SetValue(DependenciesGraphSchema.ResolvedProperty, dependency.Resolved);

            var children = targetedSnapshot.GetDependencyChildren(dependency);

            if (children == null)
            {
                return;
            }

            foreach (var childDependency in children)
            {
                if (!childDependency.Visible)
                {
                    continue;
                }

                Builder.AddGraphNode(
                    graphContext,
                    projectPath,
                    dependencyGraphNode,
                    childDependency.ToViewModel(targetedSnapshot));
            }
        }
示例#2
0
        protected virtual bool AnyChanges(
            string projectPath,
            ITargetedDependenciesSnapshot targetedSnapshot,
            IDependency updatedDependency,
            GraphNode dependencyGraphNode,
            out IReadOnlyList <DependencyNodeInfo> nodesToAdd,
            out IReadOnlyList <DependencyNodeInfo> nodesToRemove)
        {
            IReadOnlyList <DependencyNodeInfo> existingChildrenInfo = GetExistingChildren(dependencyGraphNode);
            ImmutableArray <IDependency>       updatedChildren      = targetedSnapshot.GetDependencyChildren(updatedDependency);
            IReadOnlyList <DependencyNodeInfo> updatedChildrenInfo  = updatedChildren.Select(x => DependencyNodeInfo.FromDependency(x)).ToList();

            return(AnyChanges(existingChildrenInfo, updatedChildrenInfo, out nodesToAdd, out nodesToRemove));
        }
示例#3
0
 public virtual bool ApplyChanges(
     IGraphContext graphContext,
     string nodeProjectPath,
     IDependency updatedDependency,
     GraphNode dependencyGraphNode,
     ITargetedDependenciesSnapshot targetedSnapshot)
 {
     return(ApplyChangesInternal(
                graphContext,
                updatedDependency,
                dependencyGraphNode,
                updatedChildren: targetedSnapshot.GetDependencyChildren(updatedDependency),
                nodeProjectPath: nodeProjectPath,
                targetedSnapshot));
 }
        protected virtual bool AnyChanges(
            string projectPath,
            ITargetedDependenciesSnapshot targetedSnapshot,
            IDependency updatedDependency,
            GraphNode dependencyGraphNode,
            out IEnumerable <DependencyNodeInfo> nodesToAdd,
            out IEnumerable <DependencyNodeInfo> nodesToRemove,
            out string dependencyProjectPath)
        {
            dependencyProjectPath = projectPath;

            IEnumerable <DependencyNodeInfo> existingChildrenInfo = GetExistingChildren(dependencyGraphNode);
            IEnumerable <IDependency>        updatedChildren      = targetedSnapshot.GetDependencyChildren(updatedDependency)
                                                                    ?? Enumerable.Empty <IDependency>();
            IEnumerable <DependencyNodeInfo> updatedChildrenInfo = updatedChildren.Select(x => DependencyNodeInfo.FromDependency(x));

            return(AnyChanges(existingChildrenInfo, updatedChildrenInfo, out nodesToAdd, out nodesToRemove));
        }
        public override void BuildGraph(
            IGraphContext graphContext,
            string projectPath,
            IDependency dependency,
            GraphNode dependencyGraphNode,
            ITargetedDependenciesSnapshot targetedSnapshot)
        {
            // store refreshed dependency info
            dependencyGraphNode.SetValue(DependenciesGraphSchema.DependencyIdProperty, dependency.Id);
            dependencyGraphNode.SetValue(DependenciesGraphSchema.ResolvedProperty, dependency.Resolved);

            IEnumerable <IDependency> children = targetedSnapshot.GetDependencyChildren(dependency);

            if (children == null)
            {
                return;
            }

            var regularChildren      = new List <IDependency>();
            var fxAssembliesChildren = new List <IDependency>();

            foreach (IDependency childDependency in children)
            {
                if (!childDependency.Visible)
                {
                    continue;
                }

                if (childDependency.Flags.Contains(DependencyTreeFlags.FxAssemblyProjectFlags))
                {
                    fxAssembliesChildren.Add(childDependency);
                }
                else
                {
                    regularChildren.Add(childDependency);
                }
            }

            bool isFxAssembliesFolder = dependencyGraphNode.GetValue <bool>(DependenciesGraphSchema.IsFrameworkAssemblyFolderProperty);

            if (isFxAssembliesFolder)
            {
                foreach (IDependency fxAssembly in fxAssembliesChildren)
                {
                    Builder.AddGraphNode(
                        graphContext,
                        projectPath,
                        dependencyGraphNode,
                        fxAssembly.ToViewModel(targetedSnapshot));
                }
            }
            else
            {
                foreach (IDependency childDependency in regularChildren)
                {
                    Builder.AddGraphNode(
                        graphContext,
                        projectPath,
                        dependencyGraphNode,
                        childDependency.ToViewModel(targetedSnapshot));
                }

                if (fxAssembliesChildren.Count > 0)
                {
                    var       fxAssembliesViewModel = new PackageFrameworkAssembliesViewModel();
                    GraphNode fxAssembliesNode      = Builder.AddGraphNode(graphContext, projectPath, dependencyGraphNode, fxAssembliesViewModel);
                    fxAssembliesNode.SetValue(DgmlNodeProperties.ContainsChildren, true);
                    fxAssembliesNode.SetValue(DependenciesGraphSchema.IsFrameworkAssemblyFolderProperty, true);
                    fxAssembliesNode.SetValue(DependenciesGraphSchema.DependencyIdProperty, dependency.Id);
                    fxAssembliesNode.SetValue(DependenciesGraphSchema.ResolvedProperty, dependency.Resolved);
                }
            }
        }