From 58e451b6661713b0338f276e508c12450b3e8a3b Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Fri, 31 Aug 2018 13:43:45 -0500 Subject: [PATCH] [Xamarin.Android.Build.Tasks] simplify inputs to _CompileToDalvik Recently I've been discovering more and more places where usage of `**\*.*` can hurt the performance of our build. In this case, the `_FindCompiledJavaFiles` target: This target is running even in builds with no changes, so we are *always* recursing directories and finding `*.class` files. But since we are using a `classes.zip` file now, we don't need to recurse and find the `*.class` files at all anymore! I was able to remove this target completely, and change `$(_CompileToDalvikInputs)` to use `$(IntermediateOutputPath)android\bin\classes.zip`. Less inputs also help build times, because MSBuild won't have to evaluate timestamps on all the `*.class` files. It can just look at the single `classes.zip` file. To see the difference, a build with no changes was taking: 46 ms _FindCompiledJavaFiles 1 calls 15 ms _CompileToDalvikWithDx 1 calls After these changes: 4 ms _CompileToDalvikWithDx 1 calls `_FindCompiledJavaFiles` is gone completely. I also made sure to include `_CompileJava` in `$(_CompileToDalvikDependsOnTargets)` in place of `_FindCompiledJavaFiles`. --- .../Xamarin.Android.Common.targets | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 6d018c2b0d1..38997de0a12 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -2470,16 +2470,9 @@ because xbuild doesn't support framework reference assemblies. - - - - - - <_CompileToDalvikDependsOnTargets> - _FindCompiledJavaFiles; + _CompileJava; _GetMonoPlatformJarPath; _GetAdditionalResourcesFromAssemblies; _CreateAdditionalResourceCache; @@ -2489,7 +2482,7 @@ because xbuild doesn't support framework reference assemblies. $(MSBuildAllProjects) ;@(_JavaLibrariesToCompileForAppDx) ;@(AndroidExternalJavaLibrary) - ;@(_CompiledJavaFiles) + ;$(IntermediateOutputPath)android\bin\classes.zip ;@(ProguardConfiguration) ;@(MultiDexMainDexList) ;$(_AndroidBuildPropertiesCache)