Ejemplo n.º 1
0
        public IList<Dependency> MergeAndResolveDependencies(Solution soln, Project proj)
        {
            try {
                var wishes = new List<Wish>();
                wishes.AddRange(soln.GetAllWishes());
                wishes.AddRange(proj.GetAllWishes());

                if (Log.IsTraceEnabled()) {
                    Log.Trace("merged wishes=\n" + String.Join("\n",wishes));
                }
                ValidateAll(wishes);

                //now the fun begins. Resolve transitive deps, find closest versions
                //TODO:resolve for all but pick only what the current project needs
                //TODO:keep the calculated cache for how long? how to decide when to recalc all?
                var resolver = new WishDependencyResolver(DepsCache);
                var deps = resolver.Resolve(wishes);

                var projWishes = proj.GetAllWishes();
                //TODO:now line up with deps? to get copy to and additional info added?

                return deps;
            } catch (Exception e) {
                throw new ResolverException("Error trying to resolve dependencies for project " + proj + " and solution " + soln, e);
            }
        }
Ejemplo n.º 2
0
        public void CircularDeps()
        {
            var cache = InMemoryDependencyCache.With()
                .A(ModuleWith("A", "1.0").RuntimeWishWith("B", "[1.0,1.2]").RuntimeWishWith("C", "[1.0,1.2]"))
                .A(ModuleWith("B", "1.0").RuntimeWishWith("A", "[1.0,1.1]"))
                .A(ModuleWith("C", "1.0").RuntimeWishWith("A", "[1.0,1.1]"))
                .A(ModuleWith("C", "1.1").RuntimeWishWith("A", "[1.2]"));

            var require = ListWith(WishWith("A", "1.0"), WishWith("B", "1.0"));

            var actual = new WishDependencyResolver(cache).Resolve(require);

            Expect
                .That(actual)
                .Is(AList.InOrder().WithOnly(
                    ADepWith("A", "1.0"),
                    ADepWith("B", "1.0"),
                    ADepWith("C", "1.0")));
        }
Ejemplo n.º 3
0
        public void ResolveSingleDep()
        {
            //var cache = new InMemoryDependencyCache();
            var cache = NewDependencyCache.With()
                .A(ModuleWith("A", "1.0").RuntimeWishWith("B", "[1.0]"))
                .A(ModuleWith("B", "1.0"));

            var actual = new WishDependencyResolver(cache).Resolve(ListWith(WishWith("A", "1.0")));

            Expect.That(actual).Is(AList.InOrder().WithOnly(ADepWith("A", "1.0"), ADepWith("B", "1.0")));
        }
Ejemplo n.º 4
0
        public void ResolveManyDepsRequiringLesserVersions()
        {
            var cache = InMemoryDependencyCache.With()
                .A(ModuleWith("A", "1.0").RuntimeWishWith("C", "[1.0,1.2)"))
                .A(ModuleWith("B", "1.0").RuntimeWishWith("D", "[1.0,1.1]"))
                .A(ModuleWith("C", "1.0"))
                .A(ModuleWith("C", "1.1").RuntimeWishWith("E", "[1.3,1.4]"))
                .A(ModuleWith("D", "1.0").RuntimeWishWith("E", "[1.0,1.2]"))
                .A(ModuleWith("D", "1.1").RuntimeWishWith("E", "[1.1,1.4]"))
                .A(ModuleWith("D", "1.2").RuntimeWishWith("E", "[1.2,1.5]"))
                .A(ModuleWith("E", "1.0"))
                .A(ModuleWith("E", "1.1"))
                .A(ModuleWith("E", "1.2"))
                .A(ModuleWith("E", "1.3"))
                .A(ModuleWith("E", "1.4"))
                .A(ModuleWith("E", "1.5"))
                .A(ModuleWith("F", "1.0"));

            var require = ListWith(WishWith("A", "1.0"), WishWith("B", "1.0"));

            var actual = new WishDependencyResolver(cache).Resolve(require);

            Expect
                .That(actual)
                .Is(AList.InOrder().WithOnly(
                    ADepWith("A", "1.0"),
                    ADepWith("B", "1.0"),
                    ADepWith("C", "1.1"),
                    ADepWith("D", "1.1"),
                    ADepWith("E", "1.4")));
        }