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
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 the code: https://github.com/dotnet/runtime/blob/60edc0bdafce1849fec19e3ec4f766074de50fc3/src/tasks/AotCompilerTask/MonoAOTCompiler.cs#L1064-L1073 There does not appear to be a mode of `Normal` + `Interp`. So let's just make AOT take precendence over `$(UseInterpreter)`. On Android `$(UseInterpreter)` is a Debug-mode setting for Hot Reload. Building a .NET 6 `Debug` app `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"> `_CreatePropertiesCache` doesn'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.
- Loading branch information