From 35ad986b437a232b4f02f27e96dc0b5f6640e38f Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 5 Sep 2018 21:07:17 +0100 Subject: [PATCH] [Xamarin.Android.Build.Tasks] `_CreateAapt2VersionCache` slow due to wildcard usage (#2124) Fixes: https://github.com/xamarin/xamarin-android/issues/2121 There were a number of performance issues with the `_CreateAapt2VersionCache` target. Firstly the wildcards were processing the *entire* `$(IntermediateOutputPath)` tree! What they should have been doing was targeting specific directories, e.g. the root of `$(IntermediateOutputPath)` and the directories under `$(IntermediateOutputPath)\lp`. Secondly the target did not have a `Condition` to stop it from running if the versions matched, so that has been added. Thirdly, even if a target is NOT run, MSBuild will still evaluate the ``s and ``s within the Target, so we need to add a `Conditon` on the `@(_CompiledFlataArchive)` and `@(_CompiledFlataStamp)` items as well to prevent evaluation and corresponding directory traversal. With these in place the time when this target is reduced to 1ms. --- .../Xamarin.Android.Common.targets | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 09343486213..7a0743ef9a7 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -785,7 +785,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. - - <_CompiledFlataArchive Include="$(IntermediateOutputPath)\**\*.flata"/> - <_CompiledFlataStamp Include="$(IntermediateOutputPath)\**\compiled.stamp"/> + + <_CompiledFlataArchive Include="$(_AndroidLibrayProjectIntermediatePath)**\*.flata" /> + <_CompiledFlataArchive Include="$(IntermediateOutputPath)\*.flata" /> + <_CompiledFlataStamp Include="$(_AndroidLibrayProjectIntermediatePath)**\compiled.stamp" />