You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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!
Log.LogDebugMessage($"Skipping `{dir.ItemSpec}` due to `{ResolveLibraryProjectImports.SkipAndroidResourceProcessing}`, original file: `{originalFile}`...");
0 commit comments