Commit 8aee88b
committed
[Xamarin.Android.Build.Tasks] Reduce rebuild cascades
Context: 518e57c
The scenario: rebuild `Xamarin.Android.Build.Tasks.csproj`:
$ xbuild src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj
*If nothing has changed*, the expectation is that this should be
reasonably quick, because *nothing has changed*.
Unfortunately, that's not the case; a rebuild could take upwards of
30sec on my local machine, becaues of rebuild cascades:
Target CoreCompile needs to be built as input file 'Xamarin.Android.Tools.BootstrapTasks/GenerateProfile.cs' is newer than output file 'obj/Debug/Xamarin.Android.Tools.BootstrapTasks.dll'
Target _BuildJNIEnv needs to be built as input file '../../bin/BuildDebug/jnienv-gen.exe' is newer than output file 'Android.Runtime/JNIEnv.g.cs'
Target CoreCompile needs to be built as input file 'Android.Runtime/JNIEnv.g.cs' is newer than output file 'obj/Debug/android-25/Mono.Android.dll'
Target _GenerateMonoAndroidDex18 needs to be built as input file '../../bin/Debug/lib/xbuild-frameworks/MonoAndroid/v7.1/mono.android.jar' is newer than output file '../../bin/Debug/lib/xbuild-frameworks/MonoAndroid/v7.1/mono.android.dex'
Target _CopyExtractedMultiDexJar needs to be built as input file '$HOME/android-toolchain/sdk/extras/android/m2repository/com/android/support/multidex/1.0.1/multidex-1.0.1.aar' is newer than output file '../../bin/Debug/lib/xbuild/Xamarin/Android/../../../mandroid/android-support-multidex.jar'
...and if I'm *really* unlucky:
Target _BuildUnlessCached needs to be built as input file '.../xamarin-android/external/mono/autogen.sh' is newer than output file '../../bin/Debug//lib/xbuild-frameworks/MonoAndroid/v1.0/FSharp.Core.dll'
...as that means an `external/mono` rebuild (!).
Most of these are due to missing `<Touch/>` task use, to ensure that a
created/generated file is newer than the `Inputs` of the associated
target.
The `<GenerateProfile/>` task is slightly more complicated: in that
case, we only want the file timestamp to change if the file contents
have changed. Alter the `GenerateProfile.Execute()` logic to perform a
content diff before writing to the file, resulting in a new timestamp.
Finally, fix `GenerateJavaCallableWrappers` target use from
`Mono.Android.csproj` by providing a "real" value for
`$(JavaCallableWrapperAbsAssembly)` so that the
`GenerateJavaCallableWrappers` target's `Inputs` and `Outputs`
reference valid (existing) files. The previous value used a
`$(JavaCallableWrapperOutputPathAbs)` property, which doesn't appear
to have been defined anywhere, and thus was `""`.
Performing these changes reduces my typical "no change"
`Xamarin.Android.Build.Tasks.csproj` rebuild time from ~30sec down to
a more reasonable ~10sec, which is much better (though more than I'd
personally like).1 parent 3ed220d commit 8aee88b
File tree
5 files changed
+17
-3
lines changed- build-tools/mono-runtimes
- src
- Mono.Android
- Xamarin.Android.Build.Tasks
- Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks
5 files changed
+17
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
462 | 465 | | |
463 | 466 | | |
464 | 467 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| 132 | + | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
| 150 | + | |
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
| |||
0 commit comments