-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[One .NET] fix AOT builds with different settings (#6556)
Building a .NET 6 `Release` app with `UseInterpreter=true` and `RunAOTCompilation=true` would fail with: Microsoft.Android.Sdk.Aot.targets(71,5): Unknown Mode value: Interpreter. 'Mode' must be one of: Normal,JustInterp,Full,FullInterp,Hybrid,LLVMOnly,LLVMOnlyInterp Reviewing [Mono's AOT code][0]: public enum MonoAotMode { Normal, JustInterp, Full, FullInterp, Hybrid, LLVMOnly, LLVMOnlyInterp } There does not appear to be a mode for `Normal` + `Interp`. So let's instead have AOT take precedence over `$(UseInterpreter)`. On Android, `$(UseInterpreter)` is a Debug-mode setting for [Hot Reload][1]; the *expectation* is that AOT won't be enabled in Debug config builds as Debug builds should be "fast" while AOT builds are *slow*, so if AOT is explicitly enabled, *presumably* the developer doesn't want the Interpreter. To inform developers of this change, we now emit an XA0119 warning when both `$(UseInterpreter)`=true and `$(RunAOTCompilation)`=true: dotnet build -p:UseInterpreter=true -p:RunAOTCompilation=true … warning XA0119: Disabling the interpreter; using the interpreter and AOT at the same time is not supported. Use the interpreter for hot reload support in Debug configurations and AOT for Release configurations. While testing this new priority order, we found that building a .NET 6 `Debug` config app with `$(RunAOTCompilation)`=true would fail with: Microsoft.Android.Sdk.Aot.targets(49,5): error MSB4044: The "GetAotAssemblies" task was not given a value for the required parameter "AndroidApiLevel". This is because the linker was skipped, particularly this target: <Target Name="_PrepareLinking" Condition=" '$(PublishTrimmed)' == 'true' " AfterTargets="ComputeResolvedFilesToPublishList" DependsOnTargets="GetReferenceAssemblyPaths;_CreatePropertiesCache"> The `_CreatePropertiesCache` target didn't run, and so we have some empty properties in this case. We can simply add `_CreatePropertiesCache` to the `_AndroidAot` MSBuild target's `DependsOnTargets` to solve this issue. [0]: https://github.com/dotnet/runtime/blob/60edc0bdafce1849fec19e3ec4f766074de50fc3/src/tasks/AotCompilerTask/MonoAOTCompiler.cs#L1064-L1073 [1]: https://docs.microsoft.com/visualstudio/debugger/hot-reload
- Loading branch information
1 parent
2773e1f
commit 513f613
Showing
19 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters