Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ This file contains the CoreCLR-specific MSBuild logic for .NET for Android.
<PropertyGroup>
<_AndroidRuntimePackRuntime>CoreCLR</_AndroidRuntimePackRuntime>
</PropertyGroup>
<!-- Properties for $(OutputType)=Exe (Android Applications) -->
<PropertyGroup Condition=" '$(AndroidApplication)' == 'true' ">
<!-- Default to R2R Composite for CoreCLR Release mode -->
<PublishReadyToRun Condition=" '$(PublishReadyToRun)' == '' and '$(Configuration)' == 'Release' ">true</PublishReadyToRun>
<PublishReadyToRunComposite Condition=" '$(PublishReadyToRunComposite)' == '' and '$(PublishReadyToRun)' == 'true' ">true</PublishReadyToRunComposite>
<_IsPublishing Condition=" '$(_IsPublishing)' == '' and '$(PublishReadyToRun)' == 'true' ">true</_IsPublishing>
<AllowReadyToRunWithoutRuntimeIdentifier Condition=" '$(PublishReadyToRun)' == 'true' and '$(RuntimeIdentifiers)' != '' ">true</AllowReadyToRunWithoutRuntimeIdentifier>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is required for multi-RID builds:

(_CheckForUnsupportedAppHostUsage target) -> 
    C:\a\_work\1\s\bin\Release\dotnet\sdk\10.0.100-preview.6.25304.106\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(219,5):
    error NETSDK1191: A runtime identifier for the property 'PublishReadyToRun' couldn't be inferred. Specify a rid explicitly. 

</PropertyGroup>

<Target Name="_CLRUseLocalRuntimePacks" AfterTargets="ResolveFrameworkReferences"
Condition=" '$(_CLRLocalRuntimePath)' != '' And '$(_AndroidRuntime)' == 'CoreCLR' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
<_AndroidRuntime Condition=" '$(PublishAot)' != 'true' and '$(UseMonoRuntime)' != 'true' ">CoreCLR</_AndroidRuntime>
<_AndroidRuntime Condition=" '$(_AndroidRuntime)' == '' ">MonoVM</_AndroidRuntime>
<PublishAotUsingRuntimePack Condition=" '$(PublishAotUsingRuntimePack)' == '' and '$(_AndroidRuntime)' == 'NativeAOT' ">true</PublishAotUsingRuntimePack>
<!-- HACK: make dotnet restore include Microsoft.NETCore.App.Runtime.NativeAOT.linux-bionic-arm64 -->
<_IsPublishing Condition=" '$(_IsPublishing)' == '' and '$(_AndroidRuntime)' == 'NativeAOT' ">true</_IsPublishing>

<!-- Use $(AndroidMinimumSupportedApiLevel) for $(SupportedOSPlatformVersion) if unset -->
<SupportedOSPlatformVersion Condition=" '$(SupportedOSPlatformVersion)' == '' ">$(AndroidMinimumSupportedApiLevel)</SupportedOSPlatformVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ This file contains the NativeAOT-specific MSBuild logic for .NET for Android.
<AllowPublishAotWithoutRuntimeIdentifier Condition=" '$(AllowPublishAotWithoutRuntimeIdentifier)' == '' ">true</AllowPublishAotWithoutRuntimeIdentifier>
<!-- NativeAOT's targets currently gives an error about cross-compilation -->
<DisableUnsupportedError Condition=" $([MSBuild]::IsOSPlatform('windows')) and '$(DisableUnsupportedError)' == '' ">true</DisableUnsupportedError>
<!-- HACK: make dotnet restore include Microsoft.NETCore.App.Runtime.NativeAOT.linux-bionic-arm64 -->
<_IsPublishing Condition=" '$(_IsPublishing)' == '' ">true</_IsPublishing>
</PropertyGroup>

<!-- Default property values for NativeAOT Debug configuration -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,13 @@ public void BasicApplicationBuildCoreCLR ([Values (true, false)] bool isRelease)
public void BasicApplicationPublishReadyToRun (bool isComposite, string rid)
{
var proj = new XamarinAndroidApplicationProject {
IsRelease = true,
IsRelease = true, // Enables R2R by default
};

proj.SetProperty ("RuntimeIdentifier", rid);
proj.SetProperty ("UseMonoRuntime", "false"); // Enables CoreCLR
proj.SetProperty ("_IsPublishing", "true"); // Make "dotnet build" act as "dotnet publish"
proj.SetProperty ("PublishReadyToRun", "true"); // Enable R2R
proj.SetProperty ("AndroidEnableAssemblyCompression", "false");

if (isComposite)
proj.SetProperty ("PublishReadyToRunComposite", "true"); // Enable R2R composite
proj.SetProperty ("PublishReadyToRunComposite", isComposite.ToString ());

var b = CreateApkBuilder ();
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
Expand Down
Loading