Skip to content

Commit 20bdd5c

Browse files
[nativeaot] default to $(PublishAotUsingRuntimePack)=true (#9815)
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.
1 parent 1d1bf33 commit 20bdd5c

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

samples/NativeAOT/NativeAOT.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
<AndroidPackageFormat>apk</AndroidPackageFormat>
1212
<!-- Default to arm64 device -->
1313
<RuntimeIdentifier>android-arm64</RuntimeIdentifier>
14-
<!-- Current required properties for NativeAOT -->
14+
<!-- Only property required to opt into NativeAOT -->
1515
<PublishAot>true</PublishAot>
16-
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
1716
</PropertyGroup>
1817

1918
<!-- Settings for CI -->

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<_AndroidRuntime Condition=" '$(PublishAot)' == 'true' and '$(UseMonoRuntime)' != 'true' ">NativeAOT</_AndroidRuntime>
3030
<_AndroidRuntime Condition=" '$(PublishAot)' != 'true' and '$(UseMonoRuntime)' != 'true' ">CoreCLR</_AndroidRuntime>
3131
<_AndroidRuntime Condition=" '$(_AndroidRuntime)' == '' ">MonoVM</_AndroidRuntime>
32+
<PublishAotUsingRuntimePack Condition=" '$(PublishAotUsingRuntimePack)' == '' and '$(_AndroidRuntime)' == 'NativeAOT' ">true</PublishAotUsingRuntimePack>
3233
<!-- HACK: make dotnet restore include Microsoft.NETCore.App.Runtime.NativeAOT.linux-bionic-arm64 -->
3334
<_IsPublishing Condition=" '$(_IsPublishing)' == '' and '$(_AndroidRuntime)' == 'NativeAOT' ">true</_IsPublishing>
3435

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ public void NativeAOT ()
133133
}
134134
};
135135
proj.SetProperty ("PublishAot", "true");
136-
proj.SetProperty ("PublishAotUsingRuntimePack", "true");
137136
proj.SetProperty ("AndroidNdkDirectory", AndroidNdkPath);
138137
proj.SetProperty ("_ExtraTrimmerArgs", "--verbose");
139138

0 commit comments

Comments
 (0)