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

            ITargetedDependenciesSnapshot?otherProjectTargetedSnapshot = _aggregateSnapshotProvider.GetSnapshot(dependency);

            if (otherProjectTargetedSnapshot == null)
            {
                return;
            }

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

                Builder.AddGraphNode(
                    graphContext,
                    dependency.FullPath,
                    dependencyGraphNode,
                    childDependency.ToViewModel(otherProjectTargetedSnapshot));
            }
        }
예제 #2
0
        public override void BeforeAddOrUpdate(
            ITargetFramework targetFramework,
            IDependency dependency,
            IReadOnlyDictionary <string, IProjectDependenciesSubTreeProvider> subTreeProviderByProviderType,
            IImmutableSet <string>?projectItemSpecs,
            IAddDependencyContext context)
        {
            if (dependency.TopLevel &&
                dependency.Resolved &&
                dependency.Flags.Contains(DependencyTreeFlags.ProjectDependency) &&
                !dependency.Flags.Contains(DependencyTreeFlags.SharedProjectFlags))
            {
                ITargetedDependenciesSnapshot?snapshot = _aggregateSnapshotProvider.GetSnapshot(dependency);

                if (snapshot != null && snapshot.HasVisibleUnresolvedDependency)
                {
                    context.Accept(dependency.ToUnresolved(ProjectReference.SchemaName));
                    return;
                }
            }

            context.Accept(dependency);
        }
예제 #3
0
        public override bool ApplyChanges(
            IGraphContext graphContext,
            string nodeProjectPath,
            IDependency updatedDependency,
            GraphNode dependencyGraphNode,
            ITargetedDependenciesSnapshot targetedSnapshot)
        {
            ITargetedDependenciesSnapshot?referencedProjectSnapshot = _aggregateSnapshotProvider.GetSnapshot(updatedDependency);

            if (referencedProjectSnapshot == null)
            {
                return(false);
            }

            return(ApplyChangesInternal(
                       graphContext,
                       updatedDependency,
                       dependencyGraphNode,
                       // Project references list all top level dependencies as direct children
                       updatedChildren: referencedProjectSnapshot.TopLevelDependencies,
                       // Pass the path of the referenced project
                       nodeProjectPath: updatedDependency.FullPath,
                       targetedSnapshot: referencedProjectSnapshot));
        }
예제 #4
0
        public override bool HasChildren(IDependency dependency)
        {
            ITargetedDependenciesSnapshot?targetedSnapshot = _aggregateSnapshotProvider.GetSnapshot(dependency);

            return(targetedSnapshot?.TopLevelDependencies.Length != 0);
        }