-
Notifications
You must be signed in to change notification settings - Fork 534
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
[Xamarin.Android.Build.Tasks] introduce $(_AndroidRuntime)
property
#9686
base: main
Are you sure you want to change the base?
Conversation
Context: #9572 (comment) Context: https://github.com/xamarin/xamarin-macios/blob/2009c571aa8a975ab0e0b1785e5484dbd64d6f9b/dotnet/targets/Xamarin.Shared.Sdk.targets#L1004-L1006 To align with xamarin/xamarin-macios, the following public MSBuild properties can be used to select a runtime for iOS, macOS, etc.: * `$(UseMonoRuntime)=true`: MonoVM * `$(UseMonoRuntime)=false`: CoreCLR * `$(PublishAot)=true`: NativeAOT * Defaults if blank, select MonoVM Introduce a private `$(_AndroidRuntime)` property we can use throughout our build to know which runtime is being targetted. This way, if a new property is designed in the future, we can keep using `$(_AndroidRuntime)` and simply update the defaults.
@@ -296,8 +297,8 @@ Dictionary<string, ITaskItem> MaybeGetArchAssemblies (Dictionary<AndroidTargetAr | |||
|
|||
void GenerateAdditionalProviderSources (NativeCodeGenState codeGenState, IList<string> additionalProviders) | |||
{ | |||
if (NativeAot) { | |||
Log.LogDebugMessage ("Skipping MonoRuntimeProvider generation for NativeAot"); | |||
if (!string.Equals (AndroidRuntime, "MonoVM", StringComparison.OrdinalIgnoreCase)) { |
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.
For forward compatibility, I would add an enum in XABT which contains the supported targets and a helper method in MonoAndroidHelper
to parse strings and return the correct enum value.
Also, I think it would be a good idea to make MonoVM
, CoreCLR
and NativeAOT
const string
members in some class (KnownRuntimes
?)
Together, the two changes would minimize potential for mistakes in code.
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.
I'll add a helper/enum for C#.
It seems that, at least right now, we cannot use Setting
|
|
Context: #9572 (comment)
Context: https://github.com/xamarin/xamarin-macios/blob/2009c571aa8a975ab0e0b1785e5484dbd64d6f9b/dotnet/targets/Xamarin.Shared.Sdk.targets#L1004-L1006
To align with xamarin/xamarin-macios, the following public MSBuild properties can be used to select a runtime for iOS, macOS, etc.:
$(UseMonoRuntime)=true
: MonoVM$(UseMonoRuntime)=false
: CoreCLR$(PublishAot)=true
: NativeAOTIntroduce a private
$(_AndroidRuntime)
property we can use throughout our build to know which runtime is being targetted.This way, if a new property is designed in the future, we can keep using
$(_AndroidRuntime)
and simply update the defaults.