-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] remove TFI == MonoAndroid checks
In preparation for .NET 5, we think the `$(TargetFrameworkMoniker)` *might* be: .NETCoreApp,Version=5.0,Profile=Xamarin.Android It might also be `Profile=Android`, we don't know for sure yet. The TFM currently is: MonoAndroid,Version=v10.0 I think we can (and should) remove any code during the build that looks at `$(TargetFrameworkIdentifier)`. The places we are currently doing this are for performance: * The `_ResolveLibraryProjectImports` or `_GenerateJavaStubs` targets do not need to run against .NET standard assemblies. We can rely on a reference to `Mono.Android.dll` or `Java.Interop.dll` instead. We are already using System.Reflection.Metadata to see if the assembly actually has this reference. So an example of the condition: Condition="'%(ResolvedUserAssemblies.TargetFrameworkIdentifier)' == 'MonoAndroid' Or '%(ResolvedUserAssemblies.HasMonoAndroidReference)' == 'True'" Can just be: Condition="'%(ResolvedUserAssemblies.HasMonoAndroidReference)' == 'True'" One test failure was that `Xamarin.Forms.Platform.dll` *used* to be treated as a "Xamarin.Android" assembly. * It has a `MonoAndroid` TFI * It has *no* reference to `Mono.Android.dll` or `Java.Interop.dll` * It has no `Java.Lang.Object` subclasses * It has no `__AndroidLibraryProjects__.zip` or `*.jar` `EmbeddedResource` files In the case of this assembly, I think everything will continue to work. It is OK for it to not be treated as a "Xamarin.Android" assembly. I also took the opportunity for a small perf improvement: * `<FilterAssemblies/>` only needs to look for obsolete attributes in assemblies that reference `Mono.Android.dll`. ~~ Results ~~ Testing a build with no changes for the SmartHotel360 app: Before: 60 ms FilterAssemblies 2 calls After: 49 ms FilterAssemblies 2 calls I would think there is a small ~11ms performance improvement to all builds of this app.
- Loading branch information
1 parent
b954e34
commit efdd682
Showing
6 changed files
with
17 additions
and
60 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