From 54128b02cebaf04c20d916e2a7861ea283287a3b Mon Sep 17 00:00:00 2001 From: Wonyoung Choi Date: Tue, 13 Dec 2016 19:16:13 +0900 Subject: [PATCH] Add Tizen TFM * Tizen3 supports netstandard1.6 * Tizen4 supports netstandard1.7 --- .../DefaultFrameworkMappings.cs | 19 +++++++++-- .../NuGet.Frameworks/FrameworkConstants.cs | 5 ++- .../CompatibilityListProviderTests.cs | 12 ++++--- .../CompatibilityTests.cs | 33 +++++++++++++++++++ 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs b/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs index b1d9155c15d..864b4e2a344 100644 --- a/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs +++ b/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs @@ -92,6 +92,7 @@ public IEnumerable> IdentifierShortNames new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.NetCore, "netcore"), new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.WinRT, "winrt"), // legacy new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.UAP, "uap"), + new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.Tizen, "tizen"), }; } @@ -196,6 +197,11 @@ public IEnumerable> EquivalentFrame new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.WindowsPhoneApp, FrameworkConstants.EmptyVersion), FrameworkConstants.CommonFrameworks.WPA81), + // tizen <-> tizen3 + new KeyValuePair( + new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.Tizen, FrameworkConstants.EmptyVersion), + FrameworkConstants.CommonFrameworks.Tizen3), + // dnx <-> dnx45 new KeyValuePair( FrameworkConstants.CommonFrameworks.Dnx, @@ -278,7 +284,7 @@ public IEnumerable> SubSetFrameworks // NetPlatform is a subset of DNXCore new KeyValuePair( FrameworkConstants.FrameworkIdentifiers.NetPlatform, - FrameworkConstants.FrameworkIdentifiers.DnxCore), + FrameworkConstants.FrameworkIdentifiers.DnxCore), // NetStandard is a subset of NetStandardApp new KeyValuePair( @@ -333,6 +339,16 @@ public IEnumerable CompatibilityMappings new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.WinRT, FrameworkConstants.EmptyVersion), new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.WinRT, new Version(4, 5, 0, 0)))), + // Tizen3 projects support NETStandard1.6 + CreateStandardMapping( + FrameworkConstants.CommonFrameworks.Tizen3, + FrameworkConstants.CommonFrameworks.NetStandard16), + + // Tizen4 projects support NETStandard1.7 + CreateStandardMapping( + FrameworkConstants.CommonFrameworks.Tizen4, + FrameworkConstants.CommonFrameworks.NetStandard17), + // NetCoreApp1.0 projects support NetStandard1.6 CreateStandardMapping( FrameworkConstants.CommonFrameworks.NetCoreApp10, @@ -347,7 +363,6 @@ public IEnumerable CompatibilityMappings CreateStandardMapping( FrameworkConstants.CommonFrameworks.Net463, FrameworkConstants.CommonFrameworks.NetStandard17) - } .Concat(new[] { diff --git a/src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs b/src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs index a566bfe3b9e..575270800a7 100644 --- a/src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs +++ b/src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs @@ -67,6 +67,7 @@ public static class FrameworkIdentifiers public const string XamarinXbox360 = "Xamarin.Xbox360"; public const string XamarinXboxOne = "Xamarin.XboxOne"; public const string UAP = "UAP"; + public const string Tizen = "Tizen"; } /// @@ -102,9 +103,11 @@ public static class CommonFrameworks public static readonly NuGetFramework WP75 = new NuGetFramework(FrameworkIdentifiers.WindowsPhone, new Version(7, 5, 0, 0)); public static readonly NuGetFramework WP8 = new NuGetFramework(FrameworkIdentifiers.WindowsPhone, new Version(8, 0, 0, 0)); public static readonly NuGetFramework WP81 = new NuGetFramework(FrameworkIdentifiers.WindowsPhone, new Version(8, 1, 0, 0)); - public static readonly NuGetFramework WPA81 = new NuGetFramework(FrameworkIdentifiers.WindowsPhoneApp, new Version(8, 1, 0, 0)); + public static readonly NuGetFramework Tizen3 = new NuGetFramework(FrameworkIdentifiers.Tizen, new Version(3, 0, 0, 0)); + public static readonly NuGetFramework Tizen4 = new NuGetFramework(FrameworkIdentifiers.Tizen, new Version(4, 0, 0, 0)); + public static readonly NuGetFramework AspNet = new NuGetFramework(FrameworkIdentifiers.AspNet, EmptyVersion); public static readonly NuGetFramework AspNetCore = new NuGetFramework(FrameworkIdentifiers.AspNetCore, EmptyVersion); public static readonly NuGetFramework AspNet50 = new NuGetFramework(FrameworkIdentifiers.AspNet, Version5); diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs index c6d1813df44..54948b85171 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs @@ -47,6 +47,7 @@ public void CompatibilityListProvider_NetStandard12Supporting() Assert.Contains("Xamarin.WatchOS,Version=v0.0", actual); Assert.Contains("Xamarin.Xbox360,Version=v0.0", actual); Assert.Contains("Xamarin.XboxOne,Version=v0.0", actual); + Assert.Contains("Tizen,Version=v3.0", actual); // negative Assert.DoesNotContain(".NETFramework,Version=v4.6", actual); // only the minimum support version is returned @@ -54,7 +55,7 @@ public void CompatibilityListProvider_NetStandard12Supporting() Assert.DoesNotContain(".NETPlatform,Version=v5.3", actual); // frameworks with no relationship are not returned // count - Assert.Equal(25, actual.Length); + Assert.Equal(26, actual.Length); } [Fact] @@ -89,6 +90,7 @@ public void CompatibilityListProvider_NetStandard15Supporting() Assert.Contains("Xamarin.WatchOS,Version=v0.0", actual); Assert.Contains("Xamarin.Xbox360,Version=v0.0", actual); Assert.Contains("Xamarin.XboxOne,Version=v0.0", actual); + Assert.Contains("Tizen,Version=v3.0", actual); // negative Assert.DoesNotContain(".NETFramework,Version=v4.7", actual); // only the minimum support version is returned @@ -96,7 +98,7 @@ public void CompatibilityListProvider_NetStandard15Supporting() Assert.DoesNotContain(".NETPlatform,Version=v5.6", actual); // frameworks with no relationship are not returned // count - Assert.Equal(18, actual.Length); + Assert.Equal(19, actual.Length); } [Fact] @@ -130,6 +132,7 @@ public void CompatibilityListProvider_NetStandard16Supporting() Assert.Contains("Xamarin.WatchOS,Version=v0.0", actual); Assert.Contains("Xamarin.Xbox360,Version=v0.0", actual); Assert.Contains("Xamarin.XboxOne,Version=v0.0", actual); + Assert.Contains("Tizen,Version=v3.0", actual); // negative Assert.DoesNotContain(".NETFramework,Version=v4.7", actual); // only the minimum support version is returned @@ -138,7 +141,7 @@ public void CompatibilityListProvider_NetStandard16Supporting() Assert.DoesNotContain("DNXCore,Version=v5.0", actual); // count - Assert.Equal(17, actual.Length); + Assert.Equal(18, actual.Length); } [Fact] @@ -172,6 +175,7 @@ public void CompatibilityListProvider_NetStandard17Supporting() Assert.Contains("Xamarin.WatchOS,Version=v0.0", actual); Assert.Contains("Xamarin.Xbox360,Version=v0.0", actual); Assert.Contains("Xamarin.XboxOne,Version=v0.0", actual); + Assert.Contains("Tizen,Version=v4.0", actual); // negative Assert.DoesNotContain(".NETFramework,Version=v4.7", actual); // only the minimum support version is returned @@ -180,7 +184,7 @@ public void CompatibilityListProvider_NetStandard17Supporting() Assert.DoesNotContain("DNXCore,Version=v5.0", actual); // count - Assert.Equal(17, actual.Length); + Assert.Equal(18, actual.Length); } } } diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs index fee7623982d..810c34f3c7d 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs @@ -382,6 +382,39 @@ public class CompatibilityTests [InlineData("win8", "dotnet5.2", true)] [InlineData("win8", "dotnet5.1", true)] + // tizen3/tizen4 -> netstandard + [InlineData("tizen3.0", "netstandard1.7", false)] + [InlineData("tizen3.0", "netstandard1.6", true)] + [InlineData("tizen3.0", "netstandard1.5", true)] + [InlineData("tizen3.0", "netstandard1.4", true)] + [InlineData("tizen3.0", "netstandard1.3", true)] + [InlineData("tizen3.0", "netstandard1.2", true)] + [InlineData("tizen3.0", "netstandard1.1", true)] + [InlineData("tizen3.0", "netstandard1.0", true)] + [InlineData("tizen3.0", "dotnet5.6", false)] + [InlineData("tizen3.0", "dotnet5.5", false)] + [InlineData("tizen3.0", "dotnet5.4", false)] + [InlineData("tizen3.0", "dotnet5.3", false)] + [InlineData("tizen3.0", "dotnet5.2", false)] + [InlineData("tizen3.0", "dotnet5.1", false)] + [InlineData("tizen3.0", "dotnet5.1", false)] + [InlineData("tizen4.0", "netstandard1.8", false)] + [InlineData("tizen4.0", "netstandard1.7", true)] + [InlineData("tizen4.0", "netstandard1.6", true)] + [InlineData("tizen4.0", "netstandard1.5", true)] + [InlineData("tizen4.0", "netstandard1.4", true)] + [InlineData("tizen4.0", "netstandard1.3", true)] + [InlineData("tizen4.0", "netstandard1.2", true)] + [InlineData("tizen4.0", "netstandard1.1", true)] + [InlineData("tizen4.0", "netstandard1.0", true)] + [InlineData("tizen4.0", "dotnet5.6", false)] + [InlineData("tizen4.0", "dotnet5.5", false)] + [InlineData("tizen4.0", "dotnet5.4", false)] + [InlineData("tizen4.0", "dotnet5.3", false)] + [InlineData("tizen4.0", "dotnet5.2", false)] + [InlineData("tizen4.0", "dotnet5.1", false)] + [InlineData("tizen4.0", "dotnet5.1", false)] + // Older things don't support dotnet, netstandard, netstandardapp, or netcoreapp at all [InlineData("sl4", "netcoreapp1.0", false)] [InlineData("net40", "netcoreapp1.0", false)]