コード例 #1
0
        public void ApplyBaseLineLiftToBaseLine()
        {
            ITaskItem[] baseLine = new[]
            {
                CreateItem("System.Runtime", "4.0.21")
            };

            ITaskItem[] dependencies = new[]
            {
                CreateItem("System.Runtime", "4.0.0")
            };

            ApplyBaseLine task = new ApplyBaseLine()
            {
                BuildEngine          = _engine,
                BaseLinePackages     = baseLine,
                OriginalDependencies = dependencies
            };

            _log.Reset();
            task.Execute();
            Assert.Equal(0, _log.ErrorsLogged);
            Assert.Equal(0, _log.WarningsLogged);
            Assert.Equal(task.OriginalDependencies.Length, task.BaseLinedDependencies.Length);
            Assert.Equal("System.Runtime", task.BaseLinedDependencies[0].ItemSpec);
            Assert.Equal("4.0.21", task.BaseLinedDependencies[0].GetMetadata("Version"));
        }
コード例 #2
0
        public void TestSimpleLibPackage()
        {
            var task = new HarvestPackage()
            {
                BuildEngine     = _engine,
                Frameworks      = _frameworks,
                HarvestAssets   = true,
                IncludeAllPaths = true,
                PackageId       = "System.Collections.Immutable",
                PackageVersion  = "1.5.0",
                RuntimeFile     = "runtime.json"
            };

            task.PackagesFolders = new[] { FindPackageFolder(task.PackageId, task.PackageVersion) };

            _log.Reset();
            task.Execute();

            Assert.Equal(0, _log.ErrorsLogged);
            Assert.Equal(0, _log.WarningsLogged);
            Assert.Equal(8, task.HarvestedFiles.Length);
            var ns10asset = task.HarvestedFiles.FirstOrDefault(f => f.GetMetadata("TargetFramework") == "netstandard1.0");

            Assert.NotNull(ns10asset);
            Assert.Equal("1.2.3.0", ns10asset.GetMetadata("AssemblyVersion"));
            Assert.Equal(_frameworks.Length, task.SupportedFrameworks.Length);
        }
コード例 #3
0
        public void ApplyBaseLineLiftToBaseLine()
        {
            ITaskItem[] dependencies = new[]
            {
                CreateItem("System.Runtime", "4.0.0")
            };

            ApplyBaseLine task = new ApplyBaseLine()
            {
                BuildEngine          = _engine,
                Apply                = true,
                PackageIndexes       = _packageIndexes,
                OriginalDependencies = dependencies
            };

            _log.Reset();
            task.Execute();
            _log.ErrorsLogged.Should().Be(0);
            _log.WarningsLogged.Should().Be(0);
            task.BaseLinedDependencies.Should().SatisfyRespectively(
                item =>
            {
                item.ItemSpec.Should().Be("System.Runtime");
                item.GetMetadata("Version").Should().Be("4.0.21");
            });
        }
コード例 #4
0
        public void TestSimpleLibPackage()
        {
            var task = new HarvestPackage()
            {
                BuildEngine     = _engine,
                Frameworks      = _frameworks,
                HarvestAssets   = true,
                IncludeAllPaths = true,
                PackageId       = "System.Collections.Immutable",
                PackageVersion  = "1.2.0",
                RuntimeFile     = "runtime.json"
            };

            task.PackagesFolder = FindPackageFolder(task.PackageId, task.PackageVersion);

            _log.Reset();
            task.Execute();

            Assert.Equal(0, _log.ErrorsLogged);
            Assert.Equal(0, _log.WarningsLogged);
            Assert.Equal(4, task.HarvestedFiles.Length);
            Assert.Equal("netstandard1.0", task.HarvestedFiles[0].GetMetadata("TargetFramework"));
            Assert.Equal("1.2.0.0", task.HarvestedFiles[0].GetMetadata("AssemblyVersion"));
            Assert.Equal(_frameworks.Length, task.SupportedFrameworks.Length);
        }
コード例 #5
0
        public void Generations_MaxVersion()
        {
            _log.Reset();
            var generation = _generations.DetermineGenerationFromSeeds("System.Runtime", new Version(4, 0, 30, 0), _log);

            Assert.Equal(new Version(1, 3, 0, 0), generation);
            _log.AssertNoErrorsOrWarnings();
        }
コード例 #6
0
        public void NoAdditionalDependenciesForPlaceholders()
        {
            ITaskItem[] files = new[]
            {
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/MonoAndroid10", "MonoAndroid10"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/MonoTouch10", "MonoTouch10"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/net45", "net45"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/win8", "win8"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/wp8", "wp8"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/wpa81", "wpa81"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/xamarinios10", "xamarinios10"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/xamarinmac20", "xamarinmac20"),
                CreateFileItem(@"E:\ProjectK\binaries\x86ret\NETCore\Libraries\System.Collections.Immutable.dll", "lib/netstandard1.0", "netstandard1.0"),
                CreateFileItem(@"E:\ProjectK\binaries\x86ret\Open\CoreFx\Windows_NT.x86.Release\System.Collections.Immutable\System.Collections.Immutable.xml", "lib/netstandard1.0", "netstandard1.0"),
                CreateFileItem(@"E:\ProjectK\binaries\x86ret\Open\CoreFx\Windows_NT.x86.Release\System.Collections.Immutable\System.Collections.Immutable.xml", "lib/portable-net45+win8+wp8+wpa81", "portable-net45+win8+wp8+wpa81"),
                CreateFileItem(@"E:\ProjectK\binaries\x86ret\NETCore\Libraries\System.Collections.Immutable.dll", "lib/portable-net45+win8+wp8+wpa81", "portable-net45+win8+wp8+wpa81"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/MonoAndroid10", "MonoAndroid10"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/MonoTouch10", "MonoTouch10"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/net45", "net45"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/win8", "win8"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/wp8", "wp8"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/wpa81", "wpa81"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/xamarinios10", "xamarinios10"),
                CreateFileItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/xamarinmac20", "xamarinmac20")
            };
            ITaskItem[] dependencies = new[]
            {
                CreateDependencyItem(@"System.Runtime", "4.0.0", "netstandard1.0"),
                CreateDependencyItem(@"System.Resources.ResourceManager", "4.0.0", "netstandard1.0"),
                CreateDependencyItem(@"System.Collections", "4.0.0", "netstandard1.0"),
                CreateDependencyItem(@"System.Diagnostics.Debug", "4.0.0", "netstandard1.0"),
                CreateDependencyItem(@"System.Linq", "4.0.0", "netstandard1.0"),
                CreateDependencyItem(@"System.Runtime.Extensions", "4.0.0", "netstandard1.0"),
                CreateDependencyItem(@"System.Globalization", "4.0.0", "netstandard1.0"),
                CreateDependencyItem(@"System.Threading", "4.0.0", "netstandard1.0")
            };
            string frameworkListsPath = "FrameworkLists";

            CreateTrimDependencyGroups task = new CreateTrimDependencyGroups()
            {
                BuildEngine        = _engine,
                Files              = files,
                Dependencies       = dependencies,
                FrameworkListsPath = frameworkListsPath
            };

            _log.Reset();
            task.Execute();
            Assert.Equal(0, _log.ErrorsLogged);
            Assert.Equal(0, _log.WarningsLogged);

            // Assert that we're not adding any new trimmed inbox dependencies, we have placeholders for all inbox frameworks.
            Assert.Equal(0, task.TrimmedDependencies.Length);
        }
コード例 #7
0
        public void LaterPreReleaseGetsStable()
        {
            ITaskItem[] latestPackages = new[]
            {
                CreateItem("StableVersionTest", "1.2.0-pre")
            };

            GetLastStablePackage task = new GetLastStablePackage()
            {
                BuildEngine    = _engine,
                PackageIndexes = _packageIndexes,
                LatestPackages = latestPackages
            };

            _log.Reset();
            task.Execute();
            _log.ErrorsLogged.Should().Be(0);
            _log.WarningsLogged.Should().Be(0);
            task.LastStablePackages.Should().SatisfyRespectively(
                item =>
            {
                item.ItemSpec.Should().Be("StableVersionTest");
                item.GetMetadata("Version").Should().Be("1.1.0");
            });
        }
コード例 #8
0
        public void LaterPreReleaseGetsStable()
        {
            ITaskItem[] latestPackages = new[]
            {
                CreateItem("StableVersionTest", "1.2.0-pre")
            };

            GetLastStablePackage task = new GetLastStablePackage()
            {
                BuildEngine    = _engine,
                PackageIndexes = _packageIndexes,
                LatestPackages = latestPackages
            };

            _log.Reset();
            task.Execute();
            Assert.Equal(0, _log.ErrorsLogged);
            Assert.Equal(0, _log.WarningsLogged);
            Assert.Equal(task.LatestPackages.Length, task.LastStablePackages.Length);
            Assert.Equal("StableVersionTest", task.LastStablePackages[0].ItemSpec);
            Assert.Equal("1.1.0", task.LastStablePackages[0].GetMetadata("Version"));
        }
コード例 #9
0
 private bool Execute(ITask task)
 {
     task.BuildEngine = _engine;
     _log.Reset();
     return(task.Execute());
 }
コード例 #10
0
        public void OOBFxShouldAddRef()
        {
            ITaskItem[] files = new[]
            {
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/MonoAndroid10", "MonoAndroid10"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/MonoTouch10", "MonoTouch10"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/net45", "net45"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/win8", "win8"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/wp80", "wp80"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/wpa81", "wpa81"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/xamarinios10", "xamarinios10"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "lib/xamarinmac20", "xamarinmac20"),
                CreateItem(@"D:\K2\binaries\x86ret\Contracts\System.Threading\4.0.0.0\System.Threading.dll", "ref/netstandard1.0", "netstandard1.0"),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1033\System.Threading.xml", "ref/netstandard1.0", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1028\System.Threading.xml", "ref/netstandard1.0/zh-hant", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1031\System.Threading.xml", "ref/netstandard1.0/de", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1036\System.Threading.xml", "ref/netstandard1.0/fr", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1040\System.Threading.xml", "ref/netstandard1.0/it", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1041\System.Threading.xml", "ref/netstandard1.0/ja", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1042\System.Threading.xml", "ref/netstandard1.0/ko", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1049\System.Threading.xml", "ref/netstandard1.0/ru", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\2052\System.Threading.xml", "ref/netstandard1.0/zh-hans", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\3082\System.Threading.xml", "ref/netstandard1.0/es", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1028\System.Threading.xml", "ref/netstandard1.3/zh-hant", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1031\System.Threading.xml", "ref/netstandard1.3/de", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1033\System.Threading.xml", "ref/netstandard1.3", ""),
                CreateItem(@"D:\K2\binaries\x86ret\Contracts\System.Threading\4.0.11.0\System.Threading.dll", "ref/netstandard1.3", "netstandard1.3"),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1036\System.Threading.xml", "ref/netstandard1.3/fr", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1040\System.Threading.xml", "ref/netstandard1.3/it", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1041\System.Threading.xml", "ref/netstandard1.3/ja", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1042\System.Threading.xml", "ref/netstandard1.3/ko", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\1049\System.Threading.xml", "ref/netstandard1.3/ru", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\2052\System.Threading.xml", "ref/netstandard1.3/zh-hans", ""),
                CreateItem(@"D:\K2\src\Redist\x86\retail\bin\i386\HelpDocs\intellisense\NETCore5\3082\System.Threading.xml", "ref/netstandard1.3/es", ""),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/MonoAndroid10", "MonoAndroid10"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/MonoTouch10", "MonoTouch10"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/net45", "net45"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/win8", "win8"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/wp80", "wp80"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/wpa81", "wpa81"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/xamarinios10", "xamarinios10"),
                CreateItem(@"D:\K2\src\NDP\FxCore\src\Packages\_._", "ref/xamarinmac20", "xamarinmac20"),
                CreateItem(@"D:\K2\binaries\x86ret\NETCore\Manifests\System.Threading\runtime.json", "", "")
            };

            string[] oobFx = new[] { "netcore50" };

            EnsureOOBFramework task = new EnsureOOBFramework()
            {
                BuildEngine   = _engine,
                Files         = files,
                OOBFrameworks = oobFx
            };

            _log.Reset();
            task.Execute();
            Assert.Equal(0, _log.ErrorsLogged);
            Assert.Equal(0, _log.WarningsLogged);
            Assert.Equal(11, task.AdditionalFiles.Length);
            Assert.All(task.AdditionalFiles, f => f.GetMetadata("TargetPath").Contains(oobFx[0]));
            Assert.All(task.AdditionalFiles, f => f.GetMetadata("TargetPath").StartsWith("ref"));
            Assert.All(task.AdditionalFiles, f => f.GetMetadata("TargetFramework").Equals(oobFx[0]));
        }