Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jonathanpeppers
Copy link
Member

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.

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.
@jonathanpeppers jonathanpeppers marked this pull request as ready for review January 15, 2025 19:36
grendello added a commit that referenced this pull request Jan 16, 2025
@grendello
Copy link
Contributor

It seems that, at least right now, we cannot use UseMonoRuntime because it causes build problems because of this code.

Setting UseMonoRuntime=true when building an Android app results in:

XAPerfTest.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.linux-bionic-x86. No packages exist with this id in source(s): darc-pub-dotnet-emsdk-91b783e, darc-pub-dotnet-runtime-ef07c4f, dotnet-eng, dotnet-public, dotnet-tools, dotnet10, dotnet10-transport, dotnet9, dotnet9-transport, xamarin.android util
XAPerfTest.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.linux-bionic-arm. No packages exist with this id in source(s): darc-pub-dotnet-emsdk-91b783e, darc-pub-dotnet-runtime-ef07c4f, dotnet-eng, dotnet-public, dotnet-tools, dotnet10, dotnet10-transport, dotnet9, dotnet9-transport, xamarin.android util

@jonathanpeppers
Copy link
Member Author

It seems that, at least right now, we cannot use UseMonoRuntime because it causes build problems because of this code.

Setting UseMonoRuntime=true when building an Android app results in:

XAPerfTest.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.linux-bionic-x86. No packages exist with this id in source(s): darc-pub-dotnet-emsdk-91b783e, darc-pub-dotnet-runtime-ef07c4f, dotnet-eng, dotnet-public, dotnet-tools, dotnet10, dotnet10-transport, dotnet9, dotnet9-transport, xamarin.android util
XAPerfTest.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.linux-bionic-arm. No packages exist with this id in source(s): darc-pub-dotnet-emsdk-91b783e, darc-pub-dotnet-runtime-ef07c4f, dotnet-eng, dotnet-public, dotnet-tools, dotnet10, dotnet10-transport, dotnet9, dotnet9-transport, xamarin.android util

UseMonoRuntime=true is the default for all Android projects today, and nothing will work without it. I suspect the failure above is related to something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants