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] 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:
<Target Name="_FindCompiledJavaFiles" DependsOnTargets="_CompileJava">
<CreateItem Include="$(IntermediateOutputPath)android\bin\classes\\**\*.class">
<Output TaskParameter="Include" ItemName="_CompiledJavaFiles" />
</CreateItem>
</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:
51 ms _FindCompiledJavaFiles 1 calls
30 ms _CompileToDalvikWithDx 1 calls
Total time: 3.524s
After these changes:
2 ms _CompileToDalvikWithDx 1 calls
Total time: 2.386s
`_FindCompiledJavaFiles` is gone completely.
You can see there is some time savings in general here, I'm not sure
how MSBuild logs the time it is taking to compute `Inputs` and
`Outputs` of targets.
0 commit comments