-
Notifications
You must be signed in to change notification settings - Fork 532
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] mechanism to skip ConvertResourcesCases
Currently, we run the `ConvertResourcesCases` MSBuild task for all assemblies (on each assemby's `ResolveLibraryProjectImports` output). `ConvertResourcesCases` is one of our slower targets. Luckily, there are some "well-known" number of assemblies that we could skip, so we have decided to "whitelist" certain assemblies such as the Android support libraries, Google Play Services, Firebase, etc. So a new `@(_AndroidAssemblySkipCases)` item group has been added such as: <_AndroidAssemblySkipCases Include="Xamarin.Android.Support.v7.AppCompat" /> <_AndroidAssemblySkipCases Include="Xamarin.Android.Support.v7.CardView" /> This `<ItemGroup/>` would be an indicator for `ConvertResourcesCases` to just completely skip these assemblies. Additionally, we can flat out skip `aar` files in the same manner. To make this work: - Added support to put `ITaskItem` metadata in the cache file produced by `ResolveLibraryProjectImports` - Added item metadata for `SkipAndroidResourceProcessing` and `OriginalFile`. - `ConvertResourcesCases` now skips these directories and logs `OriginalFile`. - `CollectNonEmptyDirectories` needs to preserve item metadata for `$(AndroidUseAapt2)` to take advantage of the functionality. The results appear to be well worth the effort! Results with `$(AndroidUseAapt2)` enabled (note this is not the default): Before: 7841 ms ConvertResourcesCases 9 calls 1588 ms ResolveLibraryProjectImports 1 calls After: 69 ms ConvertResourcesCases 9 calls 1875 ms ResolveLibraryProjectImports 1 calls Results with `$(AndroidUseAapt2)` disabled: Before: 1216 ms ConvertResourcesCases 1 calls 1521 ms ResolveLibraryProjectImports 1 calls After: 24 ms ConvertResourcesCases 1 calls 1578 ms ResolveLibraryProjectImports 1 calls This was the Xamarin.Forms-Integration project in this repo, an initial clean build. It is basically a "Hello World" Xamarin.Forms project. These updated numbers are from a `Release` build of Xamarin.Android. Overall this will save ~1.2 seconds of `ConvertResourcesCases`, which happens on an initial build or incremental builds when Android resources have changes. There is also a slight slowdown in `ResolveLibraryProjectImports` due to the changes.
- Loading branch information
1 parent
3dc914d
commit 4de096d
Showing
8 changed files
with
323 additions
and
36 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
Oops, something went wrong.