-
Notifications
You must be signed in to change notification settings - Fork 564
[.NET 5] fix warning for $(TFV) of 5.0 #4598
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,17 +14,26 @@ public class CheckGoogleSdkRequirements : AndroidTask | |||||
| { | ||||||
| public override string TaskPrefix => "CGS"; | ||||||
|
|
||||||
| [Required] | ||||||
| /// <summary> | ||||||
| /// This will be blank for .NET 5 builds | ||||||
| /// </summary> | ||||||
| public string TargetFrameworkVersion { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// This is used instead of TargetFrameworkVersion for .NET 5 builds | ||||||
| /// </summary> | ||||||
| public int ApiLevel { get; set; } | ||||||
|
|
||||||
| [Required] | ||||||
| public string ManifestFile { get; set; } | ||||||
|
|
||||||
| public override bool RunTask () | ||||||
| { | ||||||
| ManifestDocument manifest = new ManifestDocument (ManifestFile); | ||||||
|
|
||||||
| var compileSdk = MonoAndroidHelper.SupportedVersions.GetApiLevelFromFrameworkVersion (TargetFrameworkVersion); | ||||||
| var compileSdk = string.IsNullOrEmpty (TargetFrameworkVersion) ? | ||||||
| ApiLevel : | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| MonoAndroidHelper.SupportedVersions.GetApiLevelFromFrameworkVersion (TargetFrameworkVersion); | ||||||
|
|
||||||
| if (!int.TryParse (manifest.GetMinimumSdk (), out int minSdk)) { | ||||||
| minSdk = 1; | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more clear in intent than the previous name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this instead be
string TargetAndroidId(plus associated chicanery and conversions), so that it can “reasonably” support preview API levels, such as this year’s currentR(and presumably next year’sS, and...)?AndroidManifest.xmlhas historically allowed//uses-sdk/@android:targetSdkVersionto contain values such asR, and we’ve historically allowed$(TargetFrameworkVersion)to be e.g.v10.0.99to use the preview API level, and we need some form of equivalent in .NET 5, especially since we’ll be losing$(TargetFrameworkVersion)...Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonp for .NET 5 the incoming value here will be
$(_AndroidApiLevel), which is currently coming from:https://github.com/xamarin/xamarin-android/blob/3c94f6f9ae7902919620c1ca26d7ad77ff080620/src/Xamarin.Android.Build.Tasks/Tasks/ResolveAndroidTooling.cs#L188
I don't think we have a way to set this to an unstable API level yet in .NET 5, but the value would be set to
30instead ofR.I think the name
ApiLevelis OK, because we've used this for other tasks that take$(_AndroidApiLevel)as input:https://github.com/xamarin/xamarin-android/blob/3c94f6f9ae7902919620c1ca26d7ad77ff080620/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L810
https://github.com/xamarin/xamarin-android/blob/3c94f6f9ae7902919620c1ca26d7ad77ff080620/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L1860
https://github.com/xamarin/xamarin-android/blob/3c94f6f9ae7902919620c1ca26d7ad77ff080620/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L2366
A couple older tasks use the name
AndroidSdkPlatform, though.