Beispiel #1
0
        public void Walk(IGraphNode<LibraryDescription> root)
        {
            _assemblyFilePaths = new HashSet<string>(StringComparer.Ordinal);
            _dependencyAssemblySources = new Dictionary<string, HashSet<string>>(StringComparer.Ordinal);
            _dependencyPackageSources = new Dictionary<string, HashSet<string>>(StringComparer.Ordinal);

            var libraries = new HashSet<LibraryDescription>();
            root.DepthFirstPreOrderWalk(visitNode: (node, _) => VisitLibrary(node, _, libraries));

            _reports.Information.WriteLine("\n[Target framework {0} ({1})]\n",
                _framework.ToString(), VersionUtility.GetShortFrameworkName(_framework));

            foreach (var assemblyFilePath in _assemblyFilePaths.OrderBy(assemblyName => assemblyName))
            {
                _reports.Information.WriteLine(assemblyFilePath);
                if (_showDetails)
                {
                    var assemblyName = Path.GetFileNameWithoutExtension(assemblyFilePath);

                    HashSet<string> packagesSources;
                    if (_dependencyPackageSources.TryGetValue(assemblyName, out packagesSources) && packagesSources.Any())
                    {
                        _reports.Information.WriteLine("    by package:  {0}", string.Join(", ", packagesSources));
                    }

                    HashSet<string> assemblySources;
                    if (_dependencyAssemblySources.TryGetValue(assemblyName, out assemblySources) && assemblySources.Any())
                    {
                        _reports.Information.WriteLine("    by assembly: {0}", string.Join(", ", assemblySources));
                    }
                }
            }
        }
Beispiel #2
0
        public void Walk(IGraphNode <LibraryDescription> root)
        {
            _assemblyFilePaths         = new HashSet <string>(StringComparer.Ordinal);
            _dependencyAssemblySources = new Dictionary <string, HashSet <string> >(StringComparer.Ordinal);
            _dependencyPackageSources  = new Dictionary <string, HashSet <string> >(StringComparer.Ordinal);

            var libraries = new HashSet <LibraryDescription>();

            root.DepthFirstPreOrderWalk(visitNode: (node, _) => VisitLibrary(node, _, libraries));

            _reports.Information.WriteLine("\n[Target framework {0} ({1})]\n",
                                           _framework.ToString(), VersionUtility.GetShortFrameworkName(_framework));

            foreach (var assemblyFilePath in _assemblyFilePaths.OrderBy(assemblyName => assemblyName))
            {
                _reports.Information.WriteLine(assemblyFilePath);
                if (_showDetails)
                {
                    var assemblyName = Path.GetFileNameWithoutExtension(assemblyFilePath);

                    HashSet <string> packagesSources;
                    if (_dependencyPackageSources.TryGetValue(assemblyName, out packagesSources) && packagesSources.Any())
                    {
                        _reports.Information.WriteLine("    by package:  {0}", string.Join(", ", packagesSources));
                    }

                    HashSet <string> assemblySources;
                    if (_dependencyAssemblySources.TryGetValue(assemblyName, out assemblySources) && assemblySources.Any())
                    {
                        _reports.Information.WriteLine("    by assembly: {0}", string.Join(", ", assemblySources));
                    }
                }
            }
        }
        private IDictionary <LibraryDescription, ISet <LibraryDescription> > FindImmediateDependent(IGraphNode <LibraryDescription> root)
        {
            var result = new Dictionary <LibraryDescription, ISet <LibraryDescription> >();

            root.DepthFirstPreOrderWalk(
                visitNode: (node, ancestors) =>
            {
                ISet <LibraryDescription> slot;
                if (!result.TryGetValue(node.Item, out slot))
                {
                    slot = new HashSet <LibraryDescription>();
                    result.Add(node.Item, slot);
                }

                // first item in the path is the immediate parent
                if (ancestors.Any())
                {
                    slot.Add(ancestors.First().Item);
                }

                return(true);
            });

            // removing the root package
            result.Remove(root.Item);

            return(result);
        }
        private IDictionary<LibraryDescription, ISet<LibraryDescription>> FindImmediateDependent(IGraphNode<LibraryDependency> root)
        {
            var result = new Dictionary<LibraryDescription, ISet<LibraryDescription>>();

            root.DepthFirstPreOrderWalk(
                (node, ancestors) =>
                {
                    ISet<LibraryDescription> slot;
                    if (!result.TryGetValue(node.Item.Library, out slot))
                    {
                        slot = new HashSet<LibraryDescription>();
                        result.Add(node.Item.Library, slot);
                    }

                    // first item in the path is the immediate parent
                    if (ancestors.Any())
                    {
                        slot.Add(ancestors.First().Item.Library);
                    }

                    return true;
                });

            // removing the root package
            result.Remove(root.Item.Library);

            return result;
        }
        private IDictionary<Library, ISet<Library>> FindImmediateDependent(IGraphNode<Library> root)
        {
            var result = new Dictionary<Library, ISet<Library>>();

            root.DepthFirstPreOrderWalk(
                visitNode: (node, ancestors) =>
                {
                    ISet<Library> slot;
                    if (!result.TryGetValue(node.Item, out slot))
                    {
                        slot = new HashSet<Library>();
                        result.Add(node.Item, slot);
                    }

                    // first item in the path is the immediate parent
                    if (ancestors.Any())
                    {
                        slot.Add(ancestors.First().Item);
                    }

                    return true;
                });

            return result;
        }
        public void Render(IGraphNode <LibraryDependency> root)
        {
            // tuples of <Library Name, Requested Version, Actual Version>
            var results = new HashSet <Tuple <string, string, string> >();

            root.DepthFirstPreOrderWalk(
                (node, ancestors) =>
            {
                var dependency = node.Item;
                if (IsLibraryMismatch(dependency))
                {
                    results.Add(Tuple.Create(
                                    dependency.Library.Identity.Name,
                                    dependency.LibraryRange.VersionRange?.MinVersion.ToString(),
                                    dependency.Library.Identity.Version?.ToString()));
                }

                return(true);
            });

            if (results.Any())
            {
                var format = GetFormat(results, padding: 2);

                RenderTitle(format);
                RenderMismatches(format, results);
            }
        }
        public void Render(IGraphNode<LibraryDependency> root)
        {
            // tuples of <Library Name, Requested Version, Actual Version>
            var results = new HashSet<Tuple<string, string, string>>();

            root.DepthFirstPreOrderWalk(
                (node, ancestors) =>
                {
                    var dependency = node.Item;
                    if (IsLibraryMismatch(dependency))
                    {
                        results.Add(Tuple.Create(
                            dependency.Library.Identity.Name,
                            dependency.LibraryRange.VersionRange?.MinVersion.ToString(),
                            dependency.Library.Identity.Version?.ToString()));
                    }

                    return true;
                });

            if (results.Any())
            {
                var format = GetFormat(results, padding: 2);

                RenderTitle(format);
                RenderMismatches(format, results);
            }
        }
Beispiel #8
0
        public ISet<string> Walk(IGraphNode<Library> root)
        {
            var assemblies = new HashSet<string>();
            var libraries = new HashSet<Library>();
            root.DepthFirstPreOrderWalk(visitNode: (node, _) => VisitLibrary(node, _, libraries, assemblies));

            return assemblies;
        }
Beispiel #9
0
        public ISet <string> Walk(IGraphNode <Library> root)
        {
            var assemblies = new HashSet <string>();
            var libraries  = new HashSet <Library>();

            root.DepthFirstPreOrderWalk(visitNode: (node, _) => VisitLibrary(node, _, libraries, assemblies));

            return(assemblies);
        }