-
Notifications
You must be signed in to change notification settings - Fork 516
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
Add support for using NativeAOT. #17374
Changes from all commits
d605221
f964b5a
a766901
7f15d86
d584840
607cc78
ca6f2e4
94c96ec
a3b466b
ab8f928
60e4936
9b24c5d
d5a53d6
b4a67c6
e0e4b77
901be39
3105214
5b8d60b
890d3ca
0db2c5c
595bcdb
13fa769
b36db05
00b2865
8cfee8b
6bd8915
3977493
79b7657
c48d583
2ee5326
617f64e
d601e51
183c76a
e3228d0
a1d707c
0adbf77
7d65804
97b91f1
c49888b
264be70
8ac35ba
e31b0a6
94cdec2
42d6121
3c912d7
b4e3361
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,13 @@ | |
|
||
<!-- Explicitly export symbols using clang command-line option "-exported_symbols_list export_list" --> | ||
<_ExportSymbolsExplicitly Condition="'$(_ExportSymbolsExplicitly)' == ''">true</_ExportSymbolsExplicitly> | ||
|
||
<!-- | ||
Some runtime libraries feature switches defaults that need to be set early | ||
Available feature switches: https://github.com/dotnet/runtime/blob/master/docs/workflow/trimming/feature-switches.md | ||
--> | ||
<!-- AutoreleasePoolSupport needs to be set earlier than other switches, so that illink doesn't override it - https://github.com/dotnet/runtime/pull/86753 - so it's set here, instead of in Xamarin.Shared.Sdk.targets --> | ||
<AutoreleasePoolSupport Condition="'$(AutoreleasePoolSupport)' == ''">true</AutoreleasePoolSupport> | ||
</PropertyGroup> | ||
|
||
<!-- Set the default RuntimeIdentifier if not already specified. --> | ||
|
@@ -95,6 +102,20 @@ | |
<SelfContained>true</SelfContained> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
|
||
SelfContained is automatically enabled if PublishAot is true, and that | ||
doesn't work properly (restore fails because RuntimeIdentifier is not | ||
set) when doing the outer build of a universal apps (when | ||
RuntimeIdentifier=''), so manually disable SelfContained in that case. | ||
|
||
This might not be necessary after: https://github.com/dotnet/sdk/pull/33229 | ||
|
||
--> | ||
<PropertyGroup Condition="'$(PublishAot)' == 'true' And '$(_IsPublishing)' == 'true' And '$(RuntimeIdentifiers)' != '' And '$(RuntimeIdentifier)' == '' And '$(SelfContained)' == ''"> | ||
<SelfContained>false</SelfContained> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
Enable LLVM by default for mobile release builds. | ||
|
||
|
@@ -105,4 +126,22 @@ | |
<PropertyGroup Condition="'$(MtouchUseLlvm)' == '' And '$(Configuration)' == 'Release' And ('$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS')"> | ||
<MtouchUseLlvm>true</MtouchUseLlvm> | ||
</PropertyGroup> | ||
|
||
<!-- Various options when using NativeAOT --> | ||
<PropertyGroup Condition="'$(PublishAot)' == 'true' And '$(_IsPublishing)' == 'true'"> | ||
<!-- Disable our own assembly IL stripping logic, because ILC does that already --> | ||
<EnableAssemblyILStripping>false</EnableAssemblyILStripping> | ||
|
||
<!-- We're using our own native main function when using NativeAOT --> | ||
<CustomNativeMain>true</CustomNativeMain> | ||
|
||
<!-- We must find the BCL libraries using the runtime pack instead of using the built-in NativeAOT BCL --> | ||
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that to deploy an application with NativeAOT one should only include
in order to switch between Mono and NativeAOT deployments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a plan to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, you can set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Does that mean that if the project file is configured with: <PropertyGroup Condition="'$(Configuration)' == 'Release'">
<PublishAot>true</PublishAot>
</PropertyGroup> doing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, and you don't even need the condition: <PropertyGroup>
<PublishAot>true</PublishAot>
</PropertyGroup> This will use MonoAOT:
While this will use NativeAOT:
|
||
|
||
<!-- This turns off some NativeAOT logic we don't want nor need --> | ||
<NativeCompilationDuringPublish>false</NativeCompilationDuringPublish> | ||
|
||
<!-- This works around an issue in NativeAOT: https://github.com/dotnet/runtime/issues/86186 --> | ||
<IlcKeepManagedDebuggerSupport>true</IlcKeepManagedDebuggerSupport> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried earlier today, and things were still broken, so I put the workaround back in for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dotnet/runtime@652433b (for reference). There is some arcade blockage in dotnet/runtime (still not fully resolved) so I imagine it may not have flown through yet... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed to look at it after this PR is in: #18478 |
||
</PropertyGroup> | ||
</Project> |
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.
Do we still need this? (Not sure which dotnet/runtime -> dotnet/sdk is ingested at the moment but the Swift workaround should not be necessary anymore.)
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.
@filipnavara do you know the PR/commit that fixed it?
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.
dotnet/runtime@f42efaa
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.
Filed to look at it after this PR is in: #18477