Skip to content

Commit

Permalink
[nativeaot] default to $(PublishAotUsingRuntimePack)=true (#9815)
Browse files Browse the repository at this point in the history
Context: https://github.com/xamarin/xamarin-macios/blob/d4baff4c6847a413e6a9c60089edfff50611ea9b/dotnet/targets/Xamarin.Shared.Sdk.props#L192

`$(PublishAotUsingRuntimePack)` needs to be `true` for any NativeAOT
scenario on mobile. This setting is more useful for desktop platforms,
as you aren't cross-compiling anything. Desktop builds can potentially
use the packs from the .NET SDK as the host and target match.

xamarin/xamarin-macios also defaults `$(PublishAotUsingRuntimePack)=true`
when `$(PublishAot)=true`, so we should be safe to follow suit.
  • Loading branch information
jonathanpeppers authored Feb 21, 2025
1 parent 1d1bf33 commit 20bdd5c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions samples/NativeAOT/NativeAOT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
<AndroidPackageFormat>apk</AndroidPackageFormat>
<!-- Default to arm64 device -->
<RuntimeIdentifier>android-arm64</RuntimeIdentifier>
<!-- Current required properties for NativeAOT -->
<!-- Only property required to opt into NativeAOT -->
<PublishAot>true</PublishAot>
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
</PropertyGroup>

<!-- Settings for CI -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<_AndroidRuntime Condition=" '$(PublishAot)' == 'true' and '$(UseMonoRuntime)' != 'true' ">NativeAOT</_AndroidRuntime>
<_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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ public void NativeAOT ()
}
};
proj.SetProperty ("PublishAot", "true");
proj.SetProperty ("PublishAotUsingRuntimePack", "true");
proj.SetProperty ("AndroidNdkDirectory", AndroidNdkPath);
proj.SetProperty ("_ExtraTrimmerArgs", "--verbose");

Expand Down

0 comments on commit 20bdd5c

Please sign in to comment.