Beispiel #1
0
        public void MergeMergesRuntimeGraph()
        {
            var context = new DependencyContext(
                CreateTargetInfo(),
                CompilationOptions.Default,
                Enumerable.Empty <CompilationLibrary>(),
                Enumerable.Empty <RuntimeLibrary>(),
                new RuntimeFallbacks[]
            {
                new RuntimeFallbacks("win8-x64", new [] { "win8" }),
            });

            var contextRedist = new DependencyContext(
                CreateTargetInfo(),
                CompilationOptions.Default,
                Enumerable.Empty <CompilationLibrary>(),
                Enumerable.Empty <RuntimeLibrary>(),
                new RuntimeFallbacks[]
            {
                new RuntimeFallbacks("win8", new [] { "win7-x64", "win7-x86" }),
            });

            var result = context.Merge(contextRedist);

            result.RuntimeGraph.Should().Contain(g => g.Runtime == "win8-x64").
            Subject.Fallbacks.Should().BeEquivalentTo("win8");
            result.RuntimeGraph.Should().Contain(g => g.Runtime == "win8").
            Subject.Fallbacks.Should().BeEquivalentTo("win7-x64", "win7-x86");
        }
Beispiel #2
0
        public void MergeMergesLibraries()
        {
            var compilationLibraries = new[]
            {
                CreateCompilation("PackageA"),
                CreateCompilation("PackageB"),
            };

            var runtimeLibraries = new[]
            {
                CreateRuntime("PackageA"),
                CreateRuntime("PackageB"),
            };

            var compilationLibrariesRedist = new[]
            {
                CreateCompilation("PackageB"),
                CreateCompilation("PackageC"),
            };

            var runtimeLibrariesRedist = new[]
            {
                CreateRuntime("PackageB"),
                CreateRuntime("PackageC"),
            };

            var context = new DependencyContext(
                CreateTargetInfo(),
                CompilationOptions.Default,
                compilationLibraries,
                runtimeLibraries,
                new RuntimeFallbacks[] { });

            var contextRedist = new DependencyContext(
                CreateTargetInfo(),
                CompilationOptions.Default,
                compilationLibrariesRedist,
                runtimeLibrariesRedist,
                new RuntimeFallbacks[] { });

            var result = context.Merge(contextRedist);

            result.CompileLibraries.Should().BeEquivalentTo(new[]
            {
                compilationLibraries[0],
                compilationLibraries[1],
                compilationLibrariesRedist[1],
            });

            result.RuntimeLibraries.Should().BeEquivalentTo(new[]
            {
                runtimeLibraries[0],
                runtimeLibraries[1],
                runtimeLibrariesRedist[1],
            });
        }
Beispiel #3
0
        public override bool Execute()
        {
            DependencyContext additionalContext = Read(AdditionalDeps.First());

            foreach (string additionalPath in AdditionalDeps.Skip(1))
            {
                additionalContext = additionalContext.Merge(Read(additionalPath));
            }

            foreach (string targetPath in TargetDeps)
            {
                DependencyContext targetContext = Read(targetPath).Merge(additionalContext);
                Write(targetContext, targetPath);
            }

            return(true);
        }