-
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] Optionally skip ConvertResourcesCases (#…
…2348) Currently, we run the `<ConvertResourcesCases/>` MSBuild task for all assemblies (on each assembly's `<ResolveLibraryProjectImports/>` output). `<ConvertResourcesCases/>` is one of our slower tasks. Luckily, there are some "well-known" assemblies that we could skip, so we have decided to "whitelist" certain assemblies such as the Android support libraries, Google Play Services, Firebase, etc. A new `@(_AndroidAssemblySkipCases)` item group has been added, e.g.: <_AndroidAssemblySkipCases Include="Xamarin.Android.Support.v7.AppCompat" /> <_AndroidAssemblySkipCases Include="Xamarin.Android.Support.v7.CardView" /> The `@(_AndroidAssemblySkipCases)` item group is 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 currently the default): Before: 9912 ms ConvertResourcesCases 9 calls 2219 ms ResolveLibraryProjectImports 1 calls After: 49 ms ConvertResourcesCases 9 calls 2185 ms ResolveLibraryProjectImports 1 calls Results with `$(AndroidUseAapt2)` disabled: Before: 1564 ms ConvertResourcesCases 1 calls 1826 ms ResolveLibraryProjectImports 1 calls After: 25 ms ConvertResourcesCases 1 calls 1685 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/>` for default projects. This MSBuild task runs on an initial build or incremental builds when Android resources have changed. I have gotten slightly different numbers on the difference, each time I've compared. There does not appear to be any noticeable slowdown in `<ResolveLibraryProjectImports/>` due to the changes.
- Loading branch information
1 parent
dd786dc
commit 02c07ed
Showing
8 changed files
with
325 additions
and
34 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.