Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] timestamp fixes for incremental builds (d…
…otnet#1930) Context: https://github.com/xamarin/Xamarin.Forms/blob/42c07d1ae5aa56eb574b7d169499f1a9af7ec080/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj While working on build performance, I noticed two timestamp issues that are preventing some targets in Xamarin.Android from building incrementally. I spotted both of these while timing builds of the `Xamarin.Forms.ControlGallery.Android` project. It is a good test subject, because it builds PCLs, and seven (or so) Xamarin.Android library projects. ~~ _LinkAssembliesNoShrink ~~ While timing builds, I noticed the following when `_LinkAssembliesNoShrink` runs: Target Name=_LinkAssembliesNoShrink Project=PagesGallery.Droid.csproj Building target "_LinkAssembliesNoShrink" partially, because some output files are out of date with respect to their input files. [ResolvedUserAssemblies: Input=C:\Users\myuser\Desktop\Git\Xamarin.Forms\PagesGallery\PagesGallery.Droid\bin\Debug\PagesGallery.Droid.dll, Output=obj\\Debug\android\assets\PagesGallery.Droid.dll] Input file is newer than output file. ... Skip linking unchanged file: C:\Users\myuser\Desktop\Git\Xamarin.Forms\PagesGallery\PagesGallery.Droid\bin\Debug\PagesGallery.Droid.dll It seems there is a case where MSBuild is thinking the target needs to run (due to timestamp values), but the `LinkAssemblies` MSBuild task does not copy the file. It actually doesn't need to do any work at all here, since this was a build with no changes. The fix here is to apply a timestamp for files that get skipped. This prevents the target from running again when it doesn't need to. I also removed a spot where a `copysrc` variable looks like it was being set an extra time--did not seem to be needed. ~~ _GenerateJavaStubs ~~ After fixing `_LinkAssembliesNoShrink`, I noticed another timestamp issue: Building target "_GenerateJavaStubs" completely. Input file "obj\\Debug\android\assets\PagesGallery.Droid.dll" is newer than output file "obj\\Debug\android\typemap.jm". Looking at the `GenerateJavaStubs` MSBuild task, it was never setting the timestamp on either `typemap.mj` or `typemap.jm`. Fixing these two issues, I was able to get a build with no-changes in this Xamarin.Forms project down from ~23 seconds to ~13 seconds. I also updated the `CheckTimestamps` test to validate these changes.
- Loading branch information