From 215f26c183b680c1a154b5628ad8c5f109a77810 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Fri, 31 Aug 2018 11:01:34 +0100 Subject: [PATCH] [Xamarin.Android.Build.Tasks] `_CreateAapt2VersionCache` slow due to wildcard usage Fixes #2121 There were a number of performace issues with `_CreateAapt2VersionCache`. First the wildcards were processing the ENTIRE `$(IntermediateOutputPath)`! What they should have been doing was targeting specific directories. I.e the root of `$(IntermediateOutputPath)` and the directories under `$(IntermediateOutputPath)\lp`. The target did not have a Condition to stop it running if the versions matched, so that has been added. However, even if a target is NOT run. MSbuild will still evaluate the `PropertyGroups` and `ItemGroups` within the targets. So we need to add `Conditon` on the `_CompiledFlataArchive` and `_CompiledFlataStamp` items as well. With these in place the time when this target is skipped is down to 1ms. --- .../Xamarin.Android.Common.targets | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index c435aca888a..18b634dbca8 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -784,7 +784,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. - <_CompiledFlataArchive Include="$(IntermediateOutputPath)\**\*.flata"/> - <_CompiledFlataStamp Include="$(IntermediateOutputPath)\**\compiled.stamp"/> + <_CompiledFlataArchive Include="$(_AndroidLibrayProjectIntermediatePath)**\*.flata" Condition="'$(_Aapt2Version)' != '@(_Aapt2VersionCache)'" /> + <_CompiledFlataArchive Include="$(IntermediateOutputPath)\*.flata" Condition="'$(_Aapt2Version)' != '@(_Aapt2VersionCache)'" /> + <_CompiledFlataStamp Include="$(_AndroidLibrayProjectIntermediatePath)**\compiled.stamp" Condition="'$(_Aapt2Version)' != '@(_Aapt2VersionCache)'" />