Skip to content

Commit

Permalink
Add Tizen TFM
Browse files Browse the repository at this point in the history
* Tizen3 supports netstandard1.6
* Tizen4 supports netstandard1.7
  • Loading branch information
WonyoungChoi authored and emgarten committed Mar 2, 2017
1 parent 71a08c7 commit 130217c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 7 deletions.
19 changes: 17 additions & 2 deletions src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public IEnumerable<KeyValuePair<string, string>> IdentifierShortNames
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.NetCore, "netcore"),
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.WinRT, "winrt"), // legacy
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.UAP, "uap"),
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.Tizen, "tizen"),
};
}

Expand Down Expand Up @@ -196,6 +197,11 @@ public IEnumerable<KeyValuePair<NuGetFramework, NuGetFramework>> EquivalentFrame
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.WindowsPhoneApp, FrameworkConstants.EmptyVersion),
FrameworkConstants.CommonFrameworks.WPA81),

// tizen <-> tizen3
new KeyValuePair<NuGetFramework, NuGetFramework>(
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.Tizen, FrameworkConstants.EmptyVersion),
FrameworkConstants.CommonFrameworks.Tizen3),

// dnx <-> dnx45
new KeyValuePair<NuGetFramework, NuGetFramework>(
FrameworkConstants.CommonFrameworks.Dnx,
Expand Down Expand Up @@ -278,7 +284,7 @@ public IEnumerable<KeyValuePair<string, string>> SubSetFrameworks
// NetPlatform is a subset of DNXCore
new KeyValuePair<string, string>(
FrameworkConstants.FrameworkIdentifiers.NetPlatform,
FrameworkConstants.FrameworkIdentifiers.DnxCore),
FrameworkConstants.FrameworkIdentifiers.DnxCore),

// NetStandard is a subset of NetStandardApp
new KeyValuePair<string, string>(
Expand Down Expand Up @@ -333,6 +339,16 @@ public IEnumerable<OneWayCompatibilityMappingEntry> 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,
Expand All @@ -347,7 +363,6 @@ public IEnumerable<OneWayCompatibilityMappingEntry> CompatibilityMappings
CreateStandardMapping(
FrameworkConstants.CommonFrameworks.Net463,
FrameworkConstants.CommonFrameworks.NetStandard17)

}
.Concat(new[]
{
Expand Down
5 changes: 4 additions & 1 deletion src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

/// <summary>
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ 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
Assert.DoesNotContain(".NETFramework,Version=v4.5", actual); // versions that are too small are not returned
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]
Expand Down Expand Up @@ -89,14 +90,15 @@ 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
Assert.DoesNotContain(".NETFramework,Version=v4.6", actual); // versions that are too small are not returned
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]
Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
}
}
33 changes: 33 additions & 0 deletions test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 130217c

Please sign in to comment.