Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the Xamarin.Mac.NET / xamarinmacnet TFM #2572

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public IEnumerable<KeyValuePair<string, string>> IdentifierShortNames
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.MonoMac, "monomac"),
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.XamarinIOs, "xamarinios"),
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.XamarinMac, "xamarinmac"),
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, "xamarinmacnet"),
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation3, "xamarinpsthree"),
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation4, "xamarinpsfour"),
new KeyValuePair<string, string>(FrameworkConstants.FrameworkIdentifiers.XamarinPlayStationVita, "xamarinpsvita"),
Expand Down Expand Up @@ -339,6 +340,22 @@ public IEnumerable<OneWayCompatibilityMappingEntry> CompatibilityMappings
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.WinRT, FrameworkConstants.EmptyVersion),
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.WinRT, new Version(4, 5, 0, 0)))),

// All XamarinMacNet projects support up to Net45
new OneWayCompatibilityMappingEntry(new FrameworkRange(
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, FrameworkConstants.EmptyVersion),
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, FrameworkConstants.MaxVersion)),
new FrameworkRange(
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.Net, FrameworkConstants.EmptyVersion),
FrameworkConstants.CommonFrameworks.Net45)),

// All XamarinMacNet projects support all XamarinMac2
new OneWayCompatibilityMappingEntry(new FrameworkRange(
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, FrameworkConstants.EmptyVersion),
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, FrameworkConstants.MaxVersion)),
new FrameworkRange(
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMac, FrameworkConstants.EmptyVersion),
new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMac, new Version(2, 0, 0, 0)))),

// Tizen3 projects support NETStandard1.6
CreateStandardMapping(
FrameworkConstants.CommonFrameworks.Tizen3,
Expand Down Expand Up @@ -474,6 +491,11 @@ public IEnumerable<OneWayCompatibilityMappingEntry> CompatibilityMappings
FrameworkConstants.CommonFrameworks.DotNet56,
FrameworkConstants.CommonFrameworks.NetStandard20),

CreateGenerationAndStandardMappingForAllVersions(
FrameworkConstants.FrameworkIdentifiers.XamarinMacNet,
FrameworkConstants.CommonFrameworks.DotNet56,
FrameworkConstants.CommonFrameworks.NetStandard20),

CreateGenerationAndStandardMappingForAllVersions(
FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation3,
FrameworkConstants.CommonFrameworks.DotNet56,
Expand Down Expand Up @@ -570,6 +592,7 @@ public IEnumerable<string> NonPackageBasedFrameworkPrecedence
{
_nonPackageBasedFrameworkPrecedence = new[]
{
FrameworkConstants.FrameworkIdentifiers.XamarinMac, // For XamarinMacNet, prefer XamarinMac over Net
FrameworkConstants.FrameworkIdentifiers.Net,
FrameworkConstants.FrameworkIdentifiers.NetCore,
FrameworkConstants.FrameworkIdentifiers.Windows,
Expand Down
1 change: 1 addition & 0 deletions src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static class FrameworkIdentifiers
public const string MonoMac = "MonoMac";
public const string XamarinIOs = "Xamarin.iOS";
public const string XamarinMac = "Xamarin.Mac";
public const string XamarinMacNet = "Xamarin.Mac.NET";
public const string XamarinPlayStation3 = "Xamarin.PlayStation3";
public const string XamarinPlayStation4 = "Xamarin.PlayStation4";
public const string XamarinPlayStationVita = "Xamarin.PlayStationVita";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void CompatibilityListProvider_NetStandard12Supporting()
Assert.Contains("WindowsPhoneApp,Version=v8.1", actual);
Assert.Contains("Xamarin.iOS,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual);
Expand All @@ -55,7 +56,7 @@ public void CompatibilityListProvider_NetStandard12Supporting()
Assert.DoesNotContain(".NETPlatform,Version=v5.3", actual); // frameworks with no relationship are not returned

// count
Assert.Equal(26, actual.Length);
Assert.Equal(27, actual.Length);
}

[Fact]
Expand Down Expand Up @@ -83,6 +84,7 @@ public void CompatibilityListProvider_NetStandard15Supporting()
Assert.Contains("MonoTouch,Version=v0.0", actual);
Assert.Contains("Xamarin.iOS,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual);
Expand All @@ -99,7 +101,7 @@ public void CompatibilityListProvider_NetStandard15Supporting()
Assert.DoesNotContain(".NETPlatform,Version=v5.6", actual); // frameworks with no relationship are not returned

// count
Assert.Equal(20, actual.Length);
Assert.Equal(21, actual.Length);
}

[Fact]
Expand All @@ -126,6 +128,7 @@ public void CompatibilityListProvider_NetStandard16Supporting()
Assert.Contains("MonoTouch,Version=v0.0", actual);
Assert.Contains("Xamarin.iOS,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual);
Expand All @@ -143,7 +146,7 @@ public void CompatibilityListProvider_NetStandard16Supporting()
Assert.DoesNotContain("DNXCore,Version=v5.0", actual);

// count
Assert.Equal(19, actual.Length);
Assert.Equal(20, actual.Length);
}

[Fact]
Expand All @@ -170,6 +173,7 @@ public void CompatibilityListProvider_NetStandard17Supporting()
Assert.Contains("MonoTouch,Version=v0.0", actual);
Assert.Contains("Xamarin.iOS,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual);
Expand All @@ -187,7 +191,7 @@ public void CompatibilityListProvider_NetStandard17Supporting()
Assert.DoesNotContain("DNXCore,Version=v5.0", actual);

// count
Assert.Equal(19, actual.Length);
Assert.Equal(20, actual.Length);
}

[Fact]
Expand All @@ -207,12 +211,14 @@ public void CompatibilityListProvider_NetStandard20Supporting()
Assert.Contains(".NETCoreApp,Version=v2.0", actual);
Assert.Contains(".NETFramework,Version=v4.6.1", actual);
Assert.Contains(".NETStandard,Version=v2.0", actual);
Assert.Contains(".NETStandardApp,Version=v2.0", actual);
Assert.Contains("DNX,Version=v4.6.1", actual);
Assert.Contains("MonoAndroid,Version=v0.0", actual);
Assert.Contains("MonoMac,Version=v0.0", actual);
Assert.Contains("MonoTouch,Version=v0.0", actual);
Assert.Contains("Xamarin.iOS,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac,Version=v0.0", actual);
Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual);
Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual);
Expand All @@ -230,7 +236,7 @@ public void CompatibilityListProvider_NetStandard20Supporting()
Assert.DoesNotContain("DNXCore,Version=v5.0", actual);

// count
Assert.Equal(19, actual.Length);
Assert.Equal(20, actual.Length);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,51 @@ public class CompatibilityTests
[InlineData("dnxcore50", "dotnet5.2", true)]
[InlineData("dnxcore50", "dotnet5.1", true)]

// xamarinmacnet -> net, xamarinmac, netstandard, dotnet
[InlineData("xamarinmacnet", "net461", false)]
[InlineData("xamarinmacnet", "net46", false)]
[InlineData("xamarinmacnet", "net452", false)]
[InlineData("xamarinmacnet", "net451", false)]
[InlineData("xamarinmacnet", "net45", true)]
[InlineData("xamarinmacnet", "net4", true)]
[InlineData("xamarinmacnet", "net2", true)]
[InlineData("xamarinmacnet", "xamarinmacnet45", false)]
[InlineData("xamarinmacnet", "xamarinmac3", false)]
[InlineData("xamarinmacnet", "xamarinmac2", true)]
[InlineData("xamarinmacnet", "xamarinmac1", true)]
[InlineData("xamarinmacnet", "xamarinmac", true)]
[InlineData("xamarinmacnet", "netstandard2.1", false)]
[InlineData("xamarinmacnet", "netstandard2.0", true)]
[InlineData("xamarinmacnet", "netstandard1.7", true)]
[InlineData("xamarinmacnet", "netstandard1.6", true)]
[InlineData("xamarinmacnet", "netstandard1.5", true)]
[InlineData("xamarinmacnet", "netstandard1.4", true)]
[InlineData("xamarinmacnet", "netstandard1.3", true)]
[InlineData("xamarinmacnet", "netstandard1.2", true)]
[InlineData("xamarinmacnet", "netstandard1.1", true)]
[InlineData("xamarinmacnet", "netstandard1.0", true)]
[InlineData("xamarinmacnet", "dotnet5.7", false)]
[InlineData("xamarinmacnet", "dotnet5.6", true)]
[InlineData("xamarinmacnet", "dotnet5.5", true)]
[InlineData("xamarinmacnet", "dotnet5.4", true)]
[InlineData("xamarinmacnet", "dotnet5.3", true)]
[InlineData("xamarinmacnet", "dotnet5.2", true)]
[InlineData("xamarinmacnet", "dotnet5.1", true)]
[InlineData("xamarinmacnet", "portable-win8+net45", true)]
[InlineData("xamarinmacnet", "dnx45", false)]
[InlineData("xamarinmacnet", "netstandardapp10", false)]
[InlineData("xamarinmacnet", "netcoreapp10", false)]
[InlineData("xamarinmacnet", "win8", false)]
[InlineData("xamarinmacnet", "uap10.0", false)]
[InlineData("xamarinmacnet", "sl7", false)]
[InlineData("xamarinmacnet", "wpa", false)]
[InlineData("xamarinmacnet45", "netstandard1.6", true)]
[InlineData("xamarinmacnet45", "net461", false)]
[InlineData("xamarinmacnet45", "net46", false)]
[InlineData("xamarinmacnet45", "net45", true)]
[InlineData("xamarinmacnet45", "xamarinmac2", true)]
[InlineData("xamarinmacnet45", "xamarinmacnet", true)]

// net -> dotnet, netstandard (but not netstandardapp or netcoreapp)
[InlineData("net463", "netstandardapp1.6", false)]
[InlineData("net463", "netstandardapp1.5", false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ public class FrameworkReducerTests
[InlineData("portable-net45+netcore45", "portable-net45+netcore45+wpa81,netstandard1.0", "portable-net45+netcore45+wpa81")]
[InlineData("portable-net45+netcore45", "netstandard1.1,dotnet5.1", "netstandard1.1")]
[InlineData("portable-net45+netcore45+bad", "netstandard1.0", null)]
// XamarinMacNet
[InlineData("xamarinmacnet", "xamarinmacnet,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet")]
[InlineData("xamarinmacnet", "xamarinmacnet45,xamarinmacnet,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet")]
[InlineData("xamarinmacnet45", "xamarinmacnet40,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet40")]
[InlineData("xamarinmacnet45", "xamarinmacnet45,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet45")]
[InlineData("xamarinmacnet", "xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmac2")]
[InlineData("xamarinmacnet", "xamarinmac1,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmac1")]
[InlineData("xamarinmacnet", "net45,netstandard1.0,portable-net45+win8,win8", "net45")]
[InlineData("xamarinmacnet", "net40,netstandard1.0,portable-net45+win8,win8", "net40")]
[InlineData("xamarinmacnet", "portable-net45+win8,win8", "portable-net45+win8")]
[InlineData("xamarinmacnet", "portable-net40+win8,win8", "portable-net40+win8")]
[InlineData("xamarinmacnet", "netstandard1.5,win8", "netstandard1.5")]
[InlineData("xamarinmacnet", "netstandard1.4,win8", "netstandard1.4")]
[InlineData("xamarinmacnet", "netstandard1.7,net46,win8", "netstandard1.7")]
[InlineData("xamarinmacnet", "netstandard2.0,net46,win8", "netstandard2.0")]
[InlineData("xamarinmacnet", "netstandard2.1,net46,win8", null)]
[InlineData("xamarinmacnet", "net46,win8", null)]
[InlineData("xamarinmacnet", "win8", null)]
// Additional tests
[InlineData("dotnet5.5", "dotnet6.0,dotnet5.4,portable-net45+win8", "dotnet5.4")]
[InlineData("dotnet7", "dotnet6.0,dotnet5.4,portable-net45+win8", "dotnet6.0")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ public void NuGetFramework_ProfileName(string folder, string expected)
[InlineData("netcoreapp1.0", ".NETCoreApp,Version=v1.0")]
[InlineData("netcoreapp1.5", ".NETCoreApp,Version=v1.5")]
[InlineData("netcoreapp2.0", ".NetCoreApp,Version=v2.0")]
[InlineData("xamarinmacnet", "Xamarin.Mac.NET,Version=v0.0")]
[InlineData("xamarinmacnet45", "Xamarin.Mac.NET,Version=v4.5")]
public void NuGetFramework_ParseToShortName(string expected, string fullName)
{
// Arrange
Expand Down Expand Up @@ -281,6 +283,9 @@ public void NuGetFramework_ParseToShortName(string expected, string fullName)
[InlineData("netcoreapp1", ".NETCoreApp,Version=v1.0")]
[InlineData("netcoreapp1.5", ".NETCoreApp,Version=v1.5")]
[InlineData("netcoreapp2", ".NETCoreApp,Version=v2.0")]
[InlineData("xamarinmacnet", "Xamarin.Mac.NET,Version=v0.0")]
[InlineData("xamarinmacnet0", "Xamarin.Mac.NET,Version=v0.0")]
[InlineData("xamarinmacnet45", "Xamarin.Mac.NET,Version=v4.5")]
public void NuGetFramework_Basic(string folderName, string fullName)
{
string output = NuGetFramework.Parse(folderName).DotNetFrameworkName;
Expand Down