Skip to content

Commit

Permalink
feature: Add support for tizen versions other than 4.0 (#188)
Browse files Browse the repository at this point in the history
* housekeeping: Make icsharpcode non-package

* feature: Add support for tizen versions other than 4.0

* Add net core

* Add the newer analyzer project

* Add net standard
  • Loading branch information
glennawatson authored Dec 7, 2020
1 parent 7d5c754 commit e453f5d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<ItemGroup>
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.261" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.1" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
Expand Down
58 changes: 38 additions & 20 deletions src/Pharmacist.Core/NuGet/NuGetFrameworkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ static NuGetFrameworkHelper()
_nugetFrameworks["NetStandard1.6"] = new[] { FrameworkConstants.CommonFrameworks.NetStandard16 };
_nugetFrameworks["NetStandard1.7"] = new[] { FrameworkConstants.CommonFrameworks.NetStandard17 };
_nugetFrameworks["NetStandard2.0"] = new[] { FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["NetStandard2.1"] = new[] { new NuGetFramework(".NETStandard", new Version(2, 1, 0, 0)) };
_nugetFrameworks["NetStandard2.1"] = new[] { FrameworkConstants.CommonFrameworks.NetStandard21 };
_nugetFrameworks["UAP"] = new[] { FrameworkConstants.CommonFrameworks.UAP10 };
_nugetFrameworks["UAP10.0"] = new[] { FrameworkConstants.CommonFrameworks.UAP10 };
_nugetFrameworks["NetCoreApp1.0"] = new[] { FrameworkConstants.CommonFrameworks.NetCoreApp10 };
_nugetFrameworks["NetCoreApp1.1"] = new[] { FrameworkConstants.CommonFrameworks.NetCoreApp11 };
_nugetFrameworks["NetCoreApp2.0"] = new[] { FrameworkConstants.CommonFrameworks.NetCoreApp20 };
_nugetFrameworks["NetCoreApp2.1"] = new[] { FrameworkConstants.CommonFrameworks.NetCoreApp21 };
_nugetFrameworks["NetCoreApp2.2"] = new[] { new NuGetFramework(".NETCoreApp", new Version(2, 1, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["NetCoreApp3.0"] = new[] { new NuGetFramework(".NETCoreApp", new Version(3, 0, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["NetCoreApp3.1"] = new[] { new NuGetFramework(".NETCoreApp", new Version(3, 1, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["NetCoreApp2.2"] = new[] { FrameworkConstants.CommonFrameworks.NetCoreApp22, FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["NetCoreApp3.0"] = new[] { FrameworkConstants.CommonFrameworks.NetCoreApp30, FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["NetCoreApp3.1"] = new[] { FrameworkConstants.CommonFrameworks.NetCoreApp31, FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["net5.0"] = new[] { FrameworkConstants.CommonFrameworks.Net50, FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["MonoAndroid50"] = new[] { new NuGetFramework("MonoAndroid", new Version(5, 0, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["MonoAndroid51"] = new[] { new NuGetFramework("MonoAndroid", new Version(5, 1, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
Expand Down Expand Up @@ -87,18 +87,14 @@ static NuGetFrameworkHelper()
_nugetFrameworks["net472"] = new[] { new NuGetFramework(".NETFramework", new Version(4, 7, 2, 0)) };
_nugetFrameworks["net48"] = new[] { new NuGetFramework(".NETFramework", new Version(4, 8, 0, 0)) };

_nugetFrameworks["tizen40"] = new[] { new NuGetFramework("Tizen", new Version(4, 0, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["tizen50"] = new[] { new NuGetFramework("Tizen", new Version(5, 0, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["tizen60"] = new[] { new NuGetFramework("Tizen", new Version(6, 0, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["tizen70"] = new[] { new NuGetFramework("Tizen", new Version(7, 0, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["tizen80"] = new[] { new NuGetFramework("Tizen", new Version(8, 0, 0, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };

_nugetFrameworks["uap10.0"] = new[] { FrameworkConstants.CommonFrameworks.UAP10, FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["uap"] = new[] { FrameworkConstants.CommonFrameworks.UAP10, FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["uap10.0.18362"] = new[] { new NuGetFramework("UAP", new Version(10, 0, 18362, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["uap10.0.17763"] = new[] { new NuGetFramework("UAP", new Version(10, 0, 17763, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["uap10.0.17134"] = new[] { new NuGetFramework("UAP", new Version(10, 0, 17134, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["uap10.0.16299"] = new[] { new NuGetFramework("UAP", new Version(10, 0, 16299, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["uap10.0.15063"] = new[] { new NuGetFramework("UAP", new Version(10, 0, 15063, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["uap10.0.14393"] = new[] { new NuGetFramework("UAP", new Version(10, 0, 14393, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["uap10.0.10586"] = new[] { new NuGetFramework("UAP", new Version(10, 0, 10586, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };
_nugetFrameworks["uap10.0.10240"] = new[] { new NuGetFramework("UAP", new Version(10, 0, 10240, 0)), FrameworkConstants.CommonFrameworks.NetStandard20 };

_nugetFrameworks["Tizen40"] = new[] { FrameworkConstants.CommonFrameworks.Tizen4, FrameworkConstants.CommonFrameworks.NetStandard20 };
}

/// <summary>
Expand All @@ -114,15 +110,37 @@ public static IReadOnlyList<NuGetFramework> ToFrameworks(this string frameworkNa
throw new ArgumentNullException(nameof(frameworkName));
}

if (frameworkName.StartsWith("uap", StringComparison.CurrentCultureIgnoreCase))
_nugetFrameworks.TryGetValue(frameworkName, out var framework);

switch (framework)
{
var versionText = frameworkName.Substring(3);
return new[] { new NuGetFramework("UAP", new Version(versionText)), FrameworkConstants.CommonFrameworks.NetStandard20 };
}
case null when frameworkName.StartsWith("tizen", StringComparison.CurrentCultureIgnoreCase):
{
var versionText = frameworkName.Substring("tizen".Length);
return new[] { new NuGetFramework("Tizen", new Version(versionText)), FrameworkConstants.CommonFrameworks.NetStandard20 };
}

_nugetFrameworks.TryGetValue(frameworkName, out var framework);
case null when frameworkName.StartsWith("uap", StringComparison.CurrentCultureIgnoreCase):
{
var versionText = frameworkName.Substring("uap".Length);
return new[] { new NuGetFramework("UAP", new Version(versionText)), FrameworkConstants.CommonFrameworks.NetStandard20 };
}

case null when frameworkName.StartsWith("netstandard", StringComparison.CurrentCultureIgnoreCase):
{
var versionText = frameworkName.Substring("netstandard".Length);
return new[] { new NuGetFramework(".NETStandard", new Version(versionText)) };
}

return framework ?? Array.Empty<NuGetFramework>();
case null when frameworkName.StartsWith("NetCoreApp", StringComparison.CurrentCultureIgnoreCase):
{
var versionText = frameworkName.Substring("NetCoreApp".Length);
return new[] { new NuGetFramework(".NETCoreApp", new Version(versionText)), FrameworkConstants.CommonFrameworks.NetStandard20 };
}

default:
return framework ?? Array.Empty<NuGetFramework>();
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class PlatformsIntegrationTests
"Xamarin.iOS10",
"uap10.0.16299",
"uap10.0.17763",
"uap10.0.19041"
"uap10.0.19041",
};

/// <summary>
Expand Down

0 comments on commit e453f5d

Please sign in to comment.