-
Notifications
You must be signed in to change notification settings - Fork 533
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` for all assemblies (their `ResolveLibraryProjectImports` output). `ConvertResourcesCases` is one of our slower targets. Luckily, there are some "well-known" number of assemblies that we could skip, so it seems beneficial to give library authors a way to do this. So for example, an assembly could contain: [assembly: Android.SkipAndroidResourceProcessing] And this would be an indicator for `ConvertResourcesCases` to just completely skip this assembly. 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! To test this, I kept most of the changes here, except skipped any assemblies starting with "Xamarin.Android.Support". Results with `$(AndroidUseAapt2)` enabled: Before: 15650 ms ConvertResourcesCases 9 calls After: 112 ms ConvertResourcesCases 9 calls Results with `$(AndroidUseAapt2)` disabled: Before: 2847 ms ConvertResourcesCases 1 calls After: 52 ms ConvertResourcesCases 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. This is a proposal, so if someone has a nicer (better!) idea for enabling this functionality, let me know!
- Loading branch information
1 parent
19e3ce5
commit b9e8b2e
Showing
6 changed files
with
92 additions
and
19 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/Mono.Android/Android/SkipAndroidResourceProcessingAttribute.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace Android | ||
{ | ||
[AttributeUsage (AttributeTargets.Assembly)] | ||
public sealed class SkipAndroidResourceProcessingAttribute : Attribute | ||
{ | ||
} | ||
} | ||
|
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