-
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
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.
It seems that, at least right now, we cannot use Setting
|
|
@@ -1947,7 +1947,7 @@ because xbuild doesn't support framework reference assemblies. | |||
|
|||
<!-- Shrink Mono.Android.dll by removing attribute only needed for GenerateJavaStubs --> | |||
<RemoveRegisterAttribute | |||
Condition="'$(AndroidLinkMode)' != 'None' and '$(AndroidIncludeDebugSymbols)' != 'true' and '$(AndroidStripILAfterAOT)' != 'true' and '$(_AndroidNativeAot)' != 'true' " | |||
Condition="'$(AndroidLinkMode)' != 'None' and '$(AndroidIncludeDebugSymbols)' != 'true' and '$(AndroidStripILAfterAOT)' != 'true' and '$(_AndroidRuntime)' != 'NativeAOT' " |
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.
Why wouldn't we run <RemoveRegisterAttribute/>
on NativeAOT?
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.
Currently, it runs after the trimmer.
Under NativeAOT, after the trimmer, it's down to a single .so
file, so nothing to do?
We will revisit this, but I was hoping to just move <RemoveRegisterAttribute/>
inside a trimmer step.
<UseMonoRuntime Condition=" '$(PublishAot)' == 'true' and '$(UseMonoRuntime)' == '' ">false</UseMonoRuntime> | ||
<UseMonoRuntime Condition=" '$(UseMonoRuntime)' == '' ">true</UseMonoRuntime> | ||
<_AndroidRuntime Condition=" '$(PublishAot)' == 'true' and '$(UseMonoRuntime)' != 'true' ">NativeAOT</_AndroidRuntime> | ||
<_AndroidRuntime Condition=" '$(PublishAot)' != 'true' and '$(UseMonoRuntime)' != 'true' ">CoreCLR</_AndroidRuntime> | ||
<_AndroidRuntime Condition=" '$(_AndroidRuntime)' == '' ">MonoVM</_AndroidRuntime> |
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 don't quite understand the desired semantics; when would $(UseMonoRuntime)
be set to false? When would CoreCLR be used? Or is it that CoreCLR support is still in-progress via #9572, and thus it currently isn't possible for $(_AndroidRuntime)
to be CoreCLR, and #9572 will change that? Or is the expectation that in the future, to use CoreCLR then devs must explicitly set $(UseMonoRuntime)
=false in their .csproj?
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.
Right now, the best option we have to align with xamarin/xamarin-macios is that you would set UseMonoRuntime=false
in your .csproj
file.
* main: [Xamarin.Android.Build.Tasks] introduce `$(_AndroidRuntime)` property (#9686)
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.