Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 1e8a41a

Browse files
committed
Fix warn for mismatch on > MonoAndroid90
Newer versions of android shouldn't warn when using android support since there is never going to be an android support for those newer api levels.
1 parent 55b2a36 commit 1e8a41a

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

source/buildtasks/support-annotations/NugetPackages.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ namespace Xamarin.Android.Support.BuildTasks
1616
{
1717
public static class NugetPackages
1818
{
19-
public static readonly Dictionary<int, Version> AndroidApiLevelsAndVersions = new Dictionary<int, Version>
19+
static readonly Dictionary<int, Version> AndroidApiLevelsAndVersions = new Dictionary<int, Version>
2020
{
2121
{ 23, new Version(6, 0) },
2222
{ 24, new Version(7, 0) },
2323
{ 25, new Version(7, 1) },
2424
{ 26, new Version(8, 0) },
2525
{ 27, new Version(8, 1) },
26-
{ 28, new Version(9, 0) },
27-
{ 28, new Version(9, 1) },
28-
{ 28, new Version(10, 0) },
29-
{ 28, new Version(10, 1) },
26+
{ 28, new Version(9, 0) }
3027
};
3128

3229
public static int GetMajorVersion(string version)

source/buildtasks/support-annotations/VerifyVersionsTask.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,19 @@ public override bool Execute()
104104
{
105105
var supportVersion = packageVersions[pkgId];
106106

107+
// Eg: if we have support 27.x installed, we'd get the recommended framework back of 8.1
107108
var frameworkForSupportVersion = NugetPackages.FrameworkVersionForSupportVersion(supportVersion);
108109
var apiLevelForSupportVersion = NugetPackages.GetMajorVersion(supportVersion);
109110

111+
// Eg: if (8.1 < our project's target framework version)
110112
if (frameworkForSupportVersion < frameworkVersion)
111-
invalidSupportVersionsForFramework.Add(Tuple.Create(pkgId, supportVersion, apiLevelForSupportVersion, frameworkForSupportVersion));
113+
{
114+
// We only want to add this warning if the target framework is <= MonoAndroid90 since after that
115+
// there are no more support libraries to match the android api level, instead users should move to androidx
116+
// we may in the future add a warning here to upgrade to androidx in these cases
117+
if (frameworkVersion <= new Version(9, 0))
118+
invalidSupportVersionsForFramework.Add(Tuple.Create(pkgId, supportVersion, apiLevelForSupportVersion, frameworkForSupportVersion));
119+
}
112120
}
113121

114122
if (invalidSupportVersionsForFramework.Any())

0 commit comments

Comments
 (0)