Commit 3d999d3
[Xamarin.Android.Build.Tasks] timestamp fixes for incremental builds (#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.1 parent 0ab8ec1 commit 3d999d3
File tree
3 files changed
+22
-5
lines changed- src/Xamarin.Android.Build.Tasks
- Tasks
- Tests/Xamarin.Android.Build.Tests
3 files changed
+22
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
| 309 | + | |
| 310 | + | |
310 | 311 | | |
311 | 312 | | |
312 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
162 | | - | |
| 163 | + | |
| 164 | + | |
163 | 165 | | |
164 | | - | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
174 | | - | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
170 | 185 | | |
171 | 186 | | |
172 | 187 | | |
| |||
0 commit comments